Files
Bubberstation/code/modules/mod/mod_ui.dm
SkyratBot aea69a21b4 [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>
2023-01-19 15:30:05 -05:00

97 lines
3.1 KiB
Plaintext

/obj/item/mod/control/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "MODsuit", name)
ui.open()
/obj/item/mod/control/ui_data(mob/user)
var/data = list()
data["interface_break"] = interface_break
data["malfunctioning"] = malfunctioning
data["open"] = open
data["active"] = active
data["locked"] = locked
data["complexity"] = complexity
data["selected_module"] = selected_module?.name
data["wearer_name"] = wearer ? (wearer.get_authentification_name("Unknown") || "Unknown") : "No Occupant"
data["wearer_job"] = wearer ? wearer.get_assignment("Unknown", "Unknown", FALSE) : "No Job"
// SKYRAT EDIT START - pAIs in MODsuits
data["pAI"] = mod_pai?.name
data["ispAI"] = mod_pai ? mod_pai == user : FALSE
// SKYRAT EDIT END
data["core"] = core?.name
data["charge"] = get_charge_percent()
data["modules"] = list()
for(var/obj/item/mod/module/module as anything in modules)
var/list/module_data = list(
"module_name" = module.name,
"description" = module.desc,
"module_type" = module.module_type,
"module_active" = module.active,
"pinned" = module.pinned_to[REF(user)],
"idle_power" = module.idle_power_cost,
"active_power" = module.active_power_cost,
"use_power" = module.use_power_cost,
"module_complexity" = module.complexity,
"cooldown_time" = module.cooldown_time,
"cooldown" = round(COOLDOWN_TIMELEFT(module, cooldown_timer), 1 SECONDS),
"id" = module.tgui_id,
"ref" = REF(module),
"configuration_data" = module.get_configuration()
)
module_data += module.add_ui_data()
data["modules"] += list(module_data)
return data
/obj/item/mod/control/ui_static_data(mob/user)
var/data = list()
data["ui_theme"] = ui_theme
data["control"] = name
data["complexity_max"] = complexity_max
data["helmet"] = helmet?.name
data["chestplate"] = chestplate?.name
data["gauntlets"] = gauntlets?.name
data["boots"] = boots?.name
return data
/obj/item/mod/control/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()
if(.)
return
// allowed() doesn't allow for pAIs
if((!allowed(usr) || !ispAI(usr)) && locked) // SKYRAT EDIT - pAIs in MODsuits
balloon_alert(usr, "insufficient access!")
playsound(src, 'sound/machines/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE)
return
if(malfunctioning && prob(75))
balloon_alert(usr, "button malfunctions!")
return
switch(action)
if("lock")
locked = !locked
balloon_alert(usr, "[locked ? "locked" : "unlocked"]!")
if("activate")
toggle_activate(usr)
if("select")
var/obj/item/mod/module/module = locate(params["ref"]) in modules
if(!module)
return
module.on_select()
if("configure")
var/obj/item/mod/module/module = locate(params["ref"]) in modules
if(!module)
return
module.configure_edit(params["key"], params["value"])
if("pin")
var/obj/item/mod/module/module = locate(params["ref"]) in modules
if(!module)
return
module.pin(usr)
// SKYRAT EDIT START - pAIs in MODsuits
if("remove_pai")
if(ishuman(usr)) // Only the MODsuit's wearer should be removing the pAI.
var/mob/user = usr
extract_pai(user)
// SKYRAT EDIT END
return TRUE