mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 17:52:36 +00:00
## About The Pull Request so there is a problem of: if 2 modsuit modules were to apply the same trait and 1 were removed, shit would break so now all instances of mod_trait applied to the modsuit wearer are refs instead, with mod_trait used for stuff added to items as that isnt likely to have the same thing also qdeleted modsuits delete their parts apparently accidentally removed at some point. the previous time they did it caused qdel loops but this time it doesnt makes boots need to be out for an ai to move someone in a modsuit improves the ui, non-standard cores now have unique colors for the charging bar, and you can extend/retract things from ui, also adds a configurable button to config menu so that the tether doesnt repurpose the pin function made for circuits redoes modsuit balloon alerts to use simpler language makes the weapon recall module make you pick up the weapon if its on your tile as throws dont work on same tile  ## Why It's Good For The Game futureproofing (also technically presentproofing, if you wear something like infiltrator and normal back modsuit and both have ai control they both will give you a trait) also ai movement doesnt have any checks currently, i think it makes sense that it would require your boots to be out so that the ai has something to move fix stuff change break boom wack
135 lines
4.0 KiB
Plaintext
135 lines
4.0 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()
|
|
// Suit information
|
|
var/suit_status = list(
|
|
"core_name" = core?.name,
|
|
"charge_current" = get_charge(),
|
|
"charge_max" = get_max_charge(),
|
|
"chargebar_color" = get_chargebar_color(),
|
|
"chargebar_string" = get_chargebar_string(),
|
|
"active" = active,
|
|
"ai_name" = ai_assistant?.name,
|
|
"has_pai" = ispAI(ai_assistant),
|
|
"is_ai" = ai_assistant && ai_assistant == user,
|
|
"link_id" = mod_link.id,
|
|
"link_freq" = mod_link.frequency,
|
|
"link_call" = mod_link.get_other()?.id,
|
|
// Wires
|
|
"open" = open,
|
|
"seconds_electrified" = seconds_electrified,
|
|
"malfunctioning" = malfunctioning,
|
|
"locked" = locked,
|
|
"interface_break" = interface_break,
|
|
// Modules
|
|
"complexity" = complexity,
|
|
)
|
|
data["suit_status"] = suit_status
|
|
// User information
|
|
var/user_status = list(
|
|
"user_name" = wearer ? (wearer.get_authentification_name("Unknown") || "Unknown") : "",
|
|
"user_assignment" = wearer ? wearer.get_assignment("Unknown", "Unknown", FALSE) : "",
|
|
)
|
|
data["user_status"] = user_status
|
|
// Module information
|
|
var/module_custom_status = list()
|
|
var/module_info = list()
|
|
for(var/obj/item/mod/module/module as anything in modules)
|
|
module_custom_status += module.add_ui_data()
|
|
module_info += list(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_energy" = module.use_energy_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(user),
|
|
))
|
|
data["module_custom_status"] = module_custom_status
|
|
data["control"] = name
|
|
data["module_info"] = module_info
|
|
var/part_info = list()
|
|
for(var/obj/item/part as anything in get_parts())
|
|
part_info += list(list(
|
|
"slot" = english_list(parse_slot_flags(part.slot_flags)),
|
|
"name" = part.name,
|
|
"deployed" = part.loc != src,
|
|
"ref" = REF(part),
|
|
))
|
|
data["parts"] = part_info
|
|
return data
|
|
|
|
/obj/item/mod/control/ui_static_data(mob/user)
|
|
var/data = list()
|
|
data["ui_theme"] = ui_theme
|
|
data["complexity_max"] = complexity_max
|
|
return data
|
|
|
|
/obj/item/mod/control/ui_state(mob/user)
|
|
if(user == ai_assistant)
|
|
return GLOB.contained_state
|
|
return ..()
|
|
|
|
/obj/item/mod/control/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
if(malfunctioning && prob(75))
|
|
balloon_alert(ui.user, "button malfunctions!")
|
|
return
|
|
switch(action)
|
|
if("lock")
|
|
if(!locked || allowed(ui.user))
|
|
locked = !locked
|
|
balloon_alert(ui.user, "[locked ? "locked" : "unlocked"]")
|
|
else
|
|
balloon_alert(ui.user, "access insufficent!")
|
|
playsound(src, 'sound/machines/scanner/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE)
|
|
if("call")
|
|
if(!mod_link.link_call)
|
|
call_link(ui.user, mod_link)
|
|
else
|
|
mod_link.end_call()
|
|
if("activate")
|
|
toggle_activate(ui.user)
|
|
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(ui.user)
|
|
if("deploy")
|
|
var/obj/item/mod_part = locate(params["ref"]) in get_parts()
|
|
if(!mod_part)
|
|
return
|
|
if(mod_part.loc == src)
|
|
deploy(ui.user, mod_part)
|
|
else
|
|
retract(ui.user, mod_part)
|
|
if("eject_pai")
|
|
if (!ishuman(ui.user))
|
|
return
|
|
remove_pai(ui.user)
|
|
return TRUE
|