[MIRROR] Adds maintenance tablet apps (Health analyzer is one now too) [MDB IGNORE] (#18809)

Adds maintenance tablet apps (Health analyzer is one now too) (#71738)


About The Pull Request

Sprites were generously made by https://github.com/Tramzz

This was a branch I've been putting off for months because my hatred for tablet apps brought me to removing computer parts, tablets, and ntnet, however I've now returned (after a lot more procrastination).

Adds Maintenance tablet applications to the game, so far there's only three of them, for proof of concept;

    The health analyzer app (the chem analyzer part is removed entirely) move away from being given to medical/geneticists/detectives/RD.

There is on exception, which is the CMO, who gets to have the application on their tablet roundstart. Maybe it could be given to their role disk as well?

    A camera application:

image
image

    MODsuit control application:

image
image

image

Maintenance applications stand out from normal tablet apps because they can't be downloaded off the App store, and instead can only be found in maintenance, with a one-use download, cloning the application from a disk to a computer, or vice versa, will delete the old one, meaning you can only have one application at once.
Why It's Good For The Game

This is more as a proof of concept for maintenance applications, but I also think that the analyzer application wasn't really that good as an app, you should either use a health analyzer or the wand in front of medbay, you shouldn't just have one in your tablet at all times because it makes it lame if your analyzer is stolen.
Changelog

cl JohnFulpWillard, sprites by Tramzz
add: Added Maintenance tablet applications, applications that can't be cloned or downloaded from the store, instead you can find one app in maintenance.
balance: The Analyzer tablet application is also a maintenance tablet application now.
/cl

Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-01-19 15:30:05 -05:00
committed by GitHub
co-authored by John Willard
parent f5aa98042a
commit aea69a21b4
23 changed files with 312 additions and 163 deletions
@@ -20,6 +20,10 @@
var/datum/computer_file/program/program_type = new programs
add_file(program_type)
/obj/item/computer_disk/Destroy(force)
. = ..()
QDEL_LIST(stored_files)
/**
* add_file
*
@@ -29,6 +33,7 @@
if((file.size + used_capacity) > max_capacity)
return FALSE
stored_files.Add(file)
file.disk_host = src
used_capacity += file.size
return TRUE
@@ -0,0 +1,13 @@
/obj/item/computer_disk/maintenance
name = "maintenance data disk"
desc = "A data disk forgotten in the depths of maintenance, might have some useful program on it."
/// Medical health analyzer app
/obj/item/computer_disk/maintenance/scanner
starting_programs = list(/datum/computer_file/program/maintenance/phys_scanner)
/obj/item/computer_disk/maintenance/camera
starting_programs = list(/datum/computer_file/program/maintenance/camera)
/obj/item/computer_disk/maintenance/modsuit_control
starting_programs = list(/datum/computer_file/program/maintenance/modsuit_control)
@@ -24,14 +24,12 @@
starting_programs = list(
/datum/computer_file/program/records/security,
/datum/computer_file/program/records/medical,
/datum/computer_file/program/phys_scanner/all,
)
/obj/item/computer_disk/command/cmo
name = "chief medical officer data disk"
desc = "Removable disk used to download essential CMO tablet apps."
starting_programs = list(
/datum/computer_file/program/phys_scanner/all,
/datum/computer_file/program/records/medical,
)
@@ -39,7 +37,6 @@
name = "research director data disk"
desc = "Removable disk used to download essential RD tablet apps."
starting_programs = list(
/datum/computer_file/program/phys_scanner/chemistry,
/datum/computer_file/program/signal_commander,
)
@@ -88,7 +85,6 @@
desc = "Removable disk used to download medical-related tablet apps."
icon_state = "datadisk7"
starting_programs = list(
/datum/computer_file/program/phys_scanner/medical,
/datum/computer_file/program/records/medical,
)
@@ -96,9 +92,6 @@
name = "chemistry data disk"
desc = "Removable disk used to download chemistry-related tablet apps."
icon_state = "datadisk5"
starting_programs = list(
/datum/computer_file/program/phys_scanner/chemistry,
)
/**
* Supply
@@ -81,7 +81,7 @@
/datum/computer_file/program/science,
/datum/computer_file/program/robocontrol,
/datum/computer_file/program/budgetorders,
/datum/computer_file/program/phys_scanner/all,
/datum/computer_file/program/maintenance/phys_scanner,
/datum/computer_file/program/records/medical,
)
@@ -96,7 +96,6 @@
/datum/computer_file/program/science,
/datum/computer_file/program/robocontrol,
/datum/computer_file/program/budgetorders,
/datum/computer_file/program/phys_scanner/chemistry,
/datum/computer_file/program/signal_commander,
)
@@ -136,7 +135,6 @@
/datum/computer_file/program/records/security,
/datum/computer_file/program/crew_manifest,
/datum/computer_file/program/robocontrol,
/datum/computer_file/program/phys_scanner/medical,
)
/obj/item/modular_computer/pda/warden
@@ -196,7 +194,6 @@
greyscale_config = /datum/greyscale_config/tablet/stripe_split
greyscale_colors = "#FAFAFA#000099#0097CA"
starting_programs = list(
/datum/computer_file/program/phys_scanner/medical,
/datum/computer_file/program/records/medical,
)
@@ -209,7 +206,6 @@
greyscale_config = /datum/greyscale_config/tablet/stripe_thick
greyscale_colors = "#FAFAFA#000099#3F96CC"
starting_programs = list(
/datum/computer_file/program/phys_scanner/medical,
/datum/computer_file/program/records/medical,
/datum/computer_file/program/robocontrol,
)
@@ -217,7 +213,6 @@
/obj/item/modular_computer/pda/medical/paramedic
name = "paramedic PDA"
starting_programs = list(
/datum/computer_file/program/phys_scanner/medical,
/datum/computer_file/program/records/medical,
/datum/computer_file/program/radar/lifeline,
)
@@ -227,7 +222,6 @@
greyscale_config = /datum/greyscale_config/tablet/stripe_split
greyscale_colors = "#FAFAFA#355FAC#57C451"
starting_programs = list(
/datum/computer_file/program/phys_scanner/medical,
/datum/computer_file/program/records/medical,
/datum/computer_file/program/robocontrol,
)
@@ -236,9 +230,6 @@
name = "chemist PDA"
greyscale_config = /datum/greyscale_config/tablet/stripe_thick
greyscale_colors = "#FAFAFA#355FAC#EA6400"
starting_programs = list(
/datum/computer_file/program/phys_scanner/chemistry,
)
/**
* Supply
@@ -13,15 +13,21 @@
var/static/file_uid = 0
///The modular computer hosting the file.
var/obj/item/modular_computer/computer
///The computer disk hosting the file.
var/obj/item/computer_disk/disk_host
/datum/computer_file/New()
..()
uid = file_uid++
RegisterSignal(src, COMSIG_MODULAR_COMPUTER_FILE_ADDED, PROC_REF(on_install))
/datum/computer_file/Destroy(force)
if(computer)
computer.remove_file(src)
computer = null
if(disk_host)
disk_host.remove_file(src)
disk_host = null
return ..()
// Returns independent copy of this file.
@@ -36,6 +42,11 @@
temp.filetype = filetype
return temp
///Called post-installation of an application in a computer, after 'computer' var is set.
/datum/computer_file/proc/on_install()
SIGNAL_HANDLER
return
/**
* Called when examining a modular computer
* Args:
@@ -31,7 +31,7 @@
var/available_on_syndinet = FALSE
/// Name of the tgui interface
var/tgui_id
/// Example: "something.gif" - a header image that will be rendered in computer's UI when this program is running at background. Images are taken from /icons/program_icons. Be careful not to use too large images!
/// Example: "something.gif" - a header image that will be rendered in computer's UI when this program is running at background. Images must also be inserted into /datum/asset/simple/headers.
var/ui_header = null
/// Font Awesome icon to use as this program's icon in the modular computer main menu. Defaults to a basic program maximize window icon if not overridden.
var/program_icon = "window-maximize-o"
@@ -77,7 +77,7 @@
*user is the person making the attack action
*params is anything the pre_attack() proc had in the same-named variable.
*/
/datum/computer_file/program/proc/tap(atom/A, mob/living/user, params)
/datum/computer_file/program/proc/tap(atom/tapped_atom, mob/living/user, params)
return FALSE
///Makes sure a program can run on this hardware (for apps limited to tablets/computers/laptops)
@@ -213,7 +213,7 @@
// Calls beginning with "PRG_" are reserved for programs handling.
// Calls beginning with "PC_" are reserved for computer handling (by whatever runs the program)
// ALWAYS INCLUDE PARENT CALL ..() OR DIE IN FIRE.
/datum/computer_file/program/ui_act(action,list/params,datum/tgui/ui)
/datum/computer_file/program/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()
if(.)
return
@@ -14,13 +14,13 @@
/// Station alert datum for showing alerts UI
var/datum/station_alert/alert_control
/datum/computer_file/program/alarm_monitor/New()
/datum/computer_file/program/alarm_monitor/on_install()
. = ..()
//We want to send an alarm if we're in one of the mining home areas
//Or if we're on station. Otherwise, die.
var/list/allowed_areas = GLOB.the_station_areas + typesof(/area/mine)
alert_control = new(computer, list(ALARM_ATMOS, ALARM_FIRE, ALARM_POWER), listener_areas = allowed_areas)
RegisterSignals(alert_control.listener, list(COMSIG_ALARM_LISTENER_TRIGGERED, COMSIG_ALARM_LISTENER_CLEARED), PROC_REF(update_alarm_display))
return ..()
/datum/computer_file/program/alarm_monitor/Destroy()
QDEL_NULL(alert_control)
@@ -0,0 +1,13 @@
/**
* Maintenance programs
*
* Programs that are found from data disks in maintenance
* Can only be cloned once to a modular computer, then deletes itself.
*/
/datum/computer_file/program/maintenance
filetype = "MNT"
available_on_ntnet = FALSE
/datum/computer_file/program/maintenance/clone(rename = FALSE)
. = ..()
qdel(src)
@@ -0,0 +1,64 @@
/datum/computer_file/program/maintenance/camera
filename = "camera_app"
filedesc = "Camera"
program_icon_state = "camera"
category = PROGRAM_CATEGORY_MISC
extended_desc = "This program allows the taking of pictures."
size = 4
usage_flags = PROGRAM_TABLET
tgui_id = "NtosCamera"
program_icon = "camera"
/// Camera built-into the tablet.
var/obj/item/camera/internal_camera
/// Latest picture taken by the app.
var/datum/picture/internal_picture
/// How many pictures were taken already, used for the camera's TGUI photo display
var/picture_number = 1
/datum/computer_file/program/maintenance/camera/on_install()
. = ..()
internal_camera = new(computer)
internal_camera.print_picture_on_snap = FALSE
/datum/computer_file/program/maintenance/camera/Destroy()
if(internal_camera)
QDEL_NULL(internal_camera)
if(internal_picture)
QDEL_NULL(internal_picture)
return ..()
/datum/computer_file/program/maintenance/camera/tap(atom/tapped_atom, mob/living/user, params)
. = ..()
if(internal_picture)
QDEL_NULL(internal_picture)
var/turf/our_turf = get_turf(tapped_atom)
internal_picture = internal_camera.captureimage(our_turf, user, internal_camera.picture_size_x + 1, internal_camera.picture_size_y + 1)
picture_number++
computer.save_photo(internal_picture.picture_image)
/datum/computer_file/program/maintenance/camera/ui_data(mob/user)
var/list/data = get_header_data()
if(!isnull(internal_picture))
user << browse_rsc(internal_picture.picture_image, "tmp_photo[picture_number].png")
data["photo"] = "tmp_photo[picture_number].png"
data["paper_left"] = computer.stored_paper
return data
/datum/computer_file/program/maintenance/camera/ui_act(action, params, datum/tgui/ui)
. = ..()
if(.)
return
var/mob/living/user = usr
switch(action)
if("print_photo")
if(computer.stored_paper <= 0)
to_chat(usr, span_notice("Hardware error: Printer out of paper."))
return
internal_camera.printpicture(user, internal_picture)
computer.stored_paper--
computer.visible_message(span_notice("\The [computer] prints out a paper."))
@@ -0,0 +1,49 @@
/datum/computer_file/program/maintenance/modsuit_control
filename = "modsuit_control"
filedesc = "MODsuit Control"
program_icon_state = "modsuit_control"
category = PROGRAM_CATEGORY_SCI
extended_desc = "This program allows people to connect a MODsuit to it, allowing remote control."
size = 2
tgui_id = "NtosMODsuit"
program_icon = "user-astronaut"
///The suit we have control over.
var/obj/item/mod/control/controlled_suit
/datum/computer_file/program/maintenance/modsuit_control/Destroy()
if(controlled_suit)
unsync_modsuit()
return ..()
/datum/computer_file/program/maintenance/modsuit_control/application_attackby(obj/item/attacking_item, mob/living/user)
. = ..()
if(!istype(attacking_item, controlled_suit))
return FALSE
if(controlled_suit)
unsync_modsuit()
controlled_suit = attacking_item
RegisterSignal(controlled_suit, COMSIG_PARENT_QDELETING, PROC_REF(unsync_modsuit))
user.balloon_alert(user, "suit updated")
return TRUE
/datum/computer_file/program/maintenance/modsuit_control/proc/unsync_modsuit(atom/source)
UnregisterSignal(controlled_suit, COMSIG_PARENT_QDELETING)
controlled_suit = null
/datum/computer_file/program/maintenance/modsuit_control/ui_data(mob/user)
var/list/data = get_header_data()
data["has_suit"] = !!controlled_suit
if(controlled_suit)
data += controlled_suit.ui_data()
return data
/datum/computer_file/program/maintenance/modsuit_control/ui_static_data(mob/user)
return controlled_suit.ui_static_data()
/datum/computer_file/program/maintenance/modsuit_control/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()
if(.)
return
controlled_suit.ui_act(action, params, ui)
@@ -0,0 +1,26 @@
/datum/computer_file/program/maintenance/phys_scanner
filename = "phys_scanner"
filedesc = "Physical Scanner"
category = PROGRAM_CATEGORY_MISC
extended_desc = "This program allows the tablet to scan physical objects and display a data output."
size = 2
usage_flags = PROGRAM_TABLET
tgui_id = "NtosPhysScanner"
program_icon = "barcode"
/// Information from the last scanned person, to display on the app.
var/last_record = ""
/datum/computer_file/program/maintenance/phys_scanner/tap(atom/tapped_atom, mob/living/user, params)
. = ..()
if(!iscarbon(tapped_atom))
return
var/mob/living/carbon/carbon = tapped_atom
carbon.visible_message(span_notice("[user] analyzes [tapped_atom]'s vitals."))
last_record = healthscan(user, carbon, 1, tochat = FALSE)
/datum/computer_file/program/maintenance/phys_scanner/ui_data(mob/user)
var/list/data = get_header_data()
data["last_record"] = last_record
return data
@@ -1,93 +0,0 @@
#define TABLET_MEDICAL_MODE (1<<0)
#define TABLET_CHEMISTRY_MODE (1<<1)
/datum/computer_file/program/phys_scanner
filename = "phys_scanner"
filedesc = "Physical Scanner"
category = PROGRAM_CATEGORY_MISC
extended_desc = "This program allows the tablet to scan physical objects and display a data output."
size = 8
usage_flags = PROGRAM_TABLET
available_on_ntnet = FALSE
tgui_id = "NtosPhysScanner"
program_icon = "barcode"
var/current_mode = 0
var/available_modes = NONE
var/last_record = ""
/datum/computer_file/program/phys_scanner/proc/ReadModes()
var/reads = list()
if(available_modes & TABLET_CHEMISTRY_MODE)
reads += "Reagent"
if(available_modes & TABLET_MEDICAL_MODE)
reads += "Health"
return reads
/datum/computer_file/program/phys_scanner/proc/ReadCurrent()
if(current_mode & TABLET_CHEMISTRY_MODE)
return "Reagent"
if(current_mode & TABLET_MEDICAL_MODE)
return "Health"
/datum/computer_file/program/phys_scanner/tap(atom/A, mob/living/user, params)
. = ..()
switch(current_mode)
if(TABLET_CHEMISTRY_MODE)
if(!isnull(A.reagents))
if(A.reagents.reagent_list.len > 0)
var/reagents_length = A.reagents.reagent_list.len
last_record = "[reagents_length] chemical agent[reagents_length > 1 ? "s" : ""] found."
for (var/re in A.reagents.reagent_list)
last_record += "\t [re]"
else
last_record = "No active chemical agents found in [A]."
else
last_record = "No significant chemical agents found in [A]."
if(TABLET_MEDICAL_MODE)
var/mob/living/carbon/carbon = A
if(istype(carbon))
carbon.visible_message(span_notice("[user] analyzes [A]'s vitals."))
last_record = healthscan(user, carbon, 1, tochat = FALSE)
/datum/computer_file/program/phys_scanner/ui_act(action, list/params, datum/tgui/ui)
. = ..()
if(.)
return
switch(action)
if("selectMode")
switch(params["newMode"])
if("Reagent")
current_mode = TABLET_CHEMISTRY_MODE
if("Health")
current_mode = TABLET_MEDICAL_MODE
return UI_UPDATE
/datum/computer_file/program/phys_scanner/ui_data(mob/user)
var/list/data = get_header_data()
data["set_mode"] = ReadCurrent()
data["last_record"] = last_record
data["available_modes"] = ReadModes()
return data
/datum/computer_file/program/phys_scanner/medical
available_modes = TABLET_MEDICAL_MODE
/datum/computer_file/program/phys_scanner/chemistry
available_modes = TABLET_CHEMISTRY_MODE
/datum/computer_file/program/phys_scanner/all
available_modes = TABLET_MEDICAL_MODE | TABLET_CHEMISTRY_MODE
#undef TABLET_MEDICAL_MODE
#undef TABLET_CHEMISTRY_MODE