mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-15 04:01:41 +00:00
* Adds the Ninja MODsuit * fixes (#14034) Co-authored-by: nevimer <foxmail@protonmail.com> * Fixed the empty contractor outfit breaking CI Co-authored-by: Fikou <23585223+Fikou@users.noreply.github.com> Co-authored-by: nevimer <77420409+nevimer@users.noreply.github.com> Co-authored-by: nevimer <foxmail@protonmail.com> Co-authored-by: GoldenAlpharex <jerego1234@hotmail.com>
97 lines
3.1 KiB
Plaintext
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[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
|