Files
Bubberstation/code/modules/mod/mod_ui.dm
SkyratBot 147f3a296c [MIRROR] some modsuits now have some modules pinned by default [MDB IGNORE] (#18384)
* some modsuits now have some modules pinned by default (#72258)

## About The Pull Request
cleans up some modsuit code i dont like about their modules
removes mod theme blacklists, they are unused and weve not needed them
at all so far
adds support for premade suits to have modules they pin by default
the default pins currently are:

advanced suit: jetpack
loader suit: clamp, magnet, hydraulic arms
mining suit: sphere transformation
safeguard suit: jetpack
magnate suit: advanced jetpack
traitor suit: armor booster, jetpack
elite traitor suit: armor booster, advanced jetpack
nukie suit: armor booster, advanced jetpack
elite nukie suit: armor booster, advanced jetpack
spetsnaz pyro suit: armor booster, advanced jetpack, flamethrower
prototype suit: tether, kinesis
apocryphal suit: jetpack
chrono suit: timestopper, rewinder, timeline jumper, kinesis plus,
timeline eradication
ninja suit: advanced stealth, star dispenser, emp pulse, weapon recall,
adrenaline boost, energy net

## Why It's Good For The Game
quickens some stuff up

## Changelog
🆑
qol: some modsuits now have some modules pinned by default
/🆑

* some modsuits now have some modules pinned by default

* SR modsuits

* word

Co-authored-by: Fikou <23585223+Fikou@users.noreply.github.com>
Co-authored-by: John Doe <gamingskeleton3@gmail.com>
2023-01-02 08:15:57 -08: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, params)
. = ..()
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