diff --git a/citadel.dme b/citadel.dme index 43b58fb1cc8d..fcda75d949a2 100644 --- a/citadel.dme +++ b/citadel.dme @@ -2347,13 +2347,11 @@ #include "code\modules\catalogue\cataloguer_visuals.dm" #include "code\modules\catalogue\cataloguer_vr.dm" #include "code\modules\client\client.dm" -#include "code\modules\client\client_data.dm" #include "code\modules\client\client_procs.dm" #include "code\modules\client\connection.dm" #include "code\modules\client\cutscene.dm" #include "code\modules\client\legacy.dm" #include "code\modules\client\perspective.dm" -#include "code\modules\client\player_data.dm" #include "code\modules\client\security.dm" #include "code\modules\client\spam_prevention.dm" #include "code\modules\client\statpanel.dm" @@ -2361,6 +2359,8 @@ #include "code\modules\client\ui_style.dm" #include "code\modules\client\viewport.dm" #include "code\modules\client\wrappers.dm" +#include "code\modules\client\data\client_data.dm" +#include "code\modules\client\data\player_data.dm" #include "code\modules\client\onboarding\_onboarding.dm" #include "code\modules\client\onboarding\age_verification.dm" #include "code\modules\client\onboarding\panic_bunker.dm" @@ -4696,13 +4696,15 @@ #include "code\modules\tgchat\message.dm" #include "code\modules\tgchat\to_chat.dm" #include "code\modules\tgs\includes.dm" -#include "code\modules\tgui\external.dm" -#include "code\modules\tgui\modal_vr_legacy.dm" +#include "code\modules\tgui\client.dm" +#include "code\modules\tgui\datum.dm" +#include "code\modules\tgui\mob.dm" #include "code\modules\tgui\module.dm" #include "code\modules\tgui\states.dm" #include "code\modules\tgui\status_composers.dm" #include "code\modules\tgui\tgui.dm" #include "code\modules\tgui\tgui_window.dm" +#include "code\modules\tgui\legacy\modal_vr_legacy.dm" #include "code\modules\tgui\modals\tgui_alert.dm" #include "code\modules\tgui\modals\tgui_dynamic_input.dm" #include "code\modules\tgui\modals\tgui_input_list.dm" diff --git a/code/__DEFINES/dcs/signals/signals_datum.dm b/code/__DEFINES/dcs/signals/signals_datum.dm index f4462c131529..119acfbbb124 100644 --- a/code/__DEFINES/dcs/signals/signals_datum.dm +++ b/code/__DEFINES/dcs/signals/signals_datum.dm @@ -18,10 +18,10 @@ /// Handler for vv_do_topic (usr, href_list) ////#define COMSIG_VV_TOPIC "vv_topic" ////#define COMPONENT_VV_HANDLED (1<<0) -/// From datum ui_act (usr, action, list/params, datum/tgui/ui) -#define COMSIG_UI_ACT "ui_act" -/// From datum ui_module_act (usr, module_id, action, list/params, datum/tgui/ui) -#define COMSIG_UI_MODULE_ACT "ui_module_act" +/// From datum ui_act (usr, action, list/params, datum/tgui/ui, datum/tgui_module_context/module_context) +#define COMSIG_DATUM_UI_ACT "ui_act" +/// From datum push_ui_data: (mob/user, datum/tgui/ui, list/data) +#define COMSIG_DATUM_PUSH_UI_DATA "push_ui_data" /// Fires on the target datum when an element is attached to it (/datum/element) ////#define COMSIG_ELEMENT_ATTACH "element_attach" diff --git a/code/__DEFINES/dcs/signals/signals_painting.dm b/code/__DEFINES/dcs/signals/signals_painting.dm index 8a1340e786b2..6261670366f3 100644 --- a/code/__DEFINES/dcs/signals/signals_painting.dm +++ b/code/__DEFINES/dcs/signals/signals_painting.dm @@ -8,5 +8,5 @@ /// From base of /item/proc/set_painting_tool_color(): (chosen_color) ////#define COMSIG_PAINTING_TOOL_SET_COLOR "painting_tool_set_color" -/// From base of /item/canvas/ui_data(): (data) +/// From base of /item/canvas/ui_data(mob/user, datum/tgui/ui) ////#define COMSIG_PAINTING_TOOL_GET_ADDITIONAL_DATA "painting_tool_get_data" diff --git a/code/controllers/subsystem/nanoui.dm b/code/controllers/subsystem/nanoui.dm index c9384bcf05d3..e5bc5d6314f7 100644 --- a/code/controllers/subsystem/nanoui.dm +++ b/code/controllers/subsystem/nanoui.dm @@ -182,7 +182,7 @@ SUBSYSTEM_DEF(nanoui) * * @return bool FALSE if no ui was removed, TRUE if removed successfully */ -/datum/controller/subsystem/nanoui/proc/ui_closed(datum/nanoui/ui) +/datum/controller/subsystem/nanoui/proc/on_ui_closed(datum/nanoui/ui) var/src_object_key = "\ref[ui.src_object]" if (!open_uis[src_object_key] || !open_uis[src_object_key][ui.ui_key]) return FALSE // wasn't open diff --git a/code/controllers/subsystem/tgui.dm b/code/controllers/subsystem/tgui.dm index 1815632e1b23..b3d214da481c 100644 --- a/code/controllers/subsystem/tgui.dm +++ b/code/controllers/subsystem/tgui.dm @@ -361,6 +361,8 @@ SUBSYSTEM_DEF(tgui) ui.user = target target.tgui_open_uis.Add(ui) source.on_ui_transfer(source, target, ui) + for(var/datum/module in ui.modules_processed) + module.on_ui_transfer(source, target, ui, TRUE) // Clear the old list. source.tgui_open_uis.Cut() return TRUE diff --git a/code/controllers/subsystem/vote.dm b/code/controllers/subsystem/vote.dm index f7c293c18075..ab18647de45a 100644 --- a/code/controllers/subsystem/vote.dm +++ b/code/controllers/subsystem/vote.dm @@ -215,7 +215,7 @@ SUBSYSTEM_DEF(vote) ui = new(user, src, "Vote") ui.open() -/datum/controller/subsystem/vote/ui_data(mob/user) +/datum/controller/subsystem/vote/ui_data(mob/user, datum/tgui/ui) var/list/data = list( "choices" = list(), "question" = question, @@ -235,7 +235,7 @@ SUBSYSTEM_DEF(vote) return data -/datum/controller/subsystem/vote/ui_act(action, params) +/datum/controller/subsystem/vote/ui_act(action, list/params, datum/tgui/ui) . = ..() if(.) return diff --git a/code/datums/ability.dm b/code/datums/ability.dm index 6c50c2ba8b8e..a1e9e3d7f682 100644 --- a/code/datums/ability.dm +++ b/code/datums/ability.dm @@ -302,7 +302,7 @@ /** * static data for tgui panel */ -/datum/ability/ui_static_data(mob/user) +/datum/ability/ui_static_data(mob/user, datum/tgui/ui) return list( "$tgui" = tgui_id, "$src" = REF(src), diff --git a/code/datums/changelog.dm b/code/datums/changelog.dm index d1f87095243d..910c72186f2d 100644 --- a/code/datums/changelog.dm +++ b/code/datums/changelog.dm @@ -21,7 +21,7 @@ changelog_items[params["date"]] = changelog_item return ui.send_asset(changelog_item) -/datum/changelog/ui_static_data() +/datum/changelog/ui_static_data(mob/user, datum/tgui/ui) var/list/data = list( "dates" = list() ) var/regex/ymlRegex = regex(@"\.yml", "g") diff --git a/code/datums/character_profile.dm b/code/datums/character_profile.dm index 6a512863e34b..04c95dae753e 100644 --- a/code/datums/character_profile.dm +++ b/code/datums/character_profile.dm @@ -14,7 +14,7 @@ GLOBAL_LIST_EMPTY(cached_previews) /datum/description_profile/ui_state() return GLOB.always_state -/datum/description_profile/ui_static_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/datum/description_profile/ui_static_data(mob/user, datum/tgui/ui) . = ..() var/data[0] var/mob/living/carbon/human/H = host.resolve() diff --git a/code/datums/components/crafting/crafting.dm b/code/datums/components/crafting/crafting.dm index 004d48b53256..48d25e16a09a 100644 --- a/code/datums/components/crafting/crafting.dm +++ b/code/datums/components/crafting/crafting.dm @@ -328,7 +328,7 @@ if(user == parent) INVOKE_ASYNC(src, PROC_REF(ui_interact), user) -/datum/component/personal_crafting/ui_state(mob/user, datum/tgui_module/module) +/datum/component/personal_crafting/ui_state() return GLOB.not_incapacitated_turf_state //For the UI related things we're going to assume the user is a mob rather than typesetting it to an atom as the UI isn't generated if the parent is an atom @@ -344,7 +344,7 @@ ui = new(user, src, "PersonalCrafting") ui.open() -/datum/component/personal_crafting/ui_data(mob/user) +/datum/component/personal_crafting/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["busy"] = busy data["category"] = cur_category @@ -368,7 +368,7 @@ data["craftability"] = craftability return data -/datum/component/personal_crafting/ui_static_data(mob/user) +/datum/component/personal_crafting/ui_static_data(mob/user, datum/tgui/ui) var/list/data = list() var/list/crafting_recipes = list() @@ -395,7 +395,7 @@ data["crafting_recipes"] = crafting_recipes return data -/datum/component/personal_crafting/ui_act(action, params) +/datum/component/personal_crafting/ui_act(action, list/params, datum/tgui/ui) if(..()) return switch(action) diff --git a/code/datums/wires/wires.dm b/code/datums/wires/wires.dm index 110c1dff228d..e7a2edfed2a7 100644 --- a/code/datums/wires/wires.dm +++ b/code/datums/wires/wires.dm @@ -92,10 +92,10 @@ ui = new(user, src, "Wires", "[proper_name] wires") ui.open() -/datum/wires/ui_state(mob/user, datum/tgui_module/module) +/datum/wires/ui_state() return GLOB.physical_state -/datum/wires/ui_data(mob/user) +/datum/wires/ui_data(mob/user, datum/tgui/ui) var/list/data = list() var/list/replace_colors @@ -150,7 +150,7 @@ data["status"] = status return data -/datum/wires/ui_act(action, list/params) +/datum/wires/ui_act(action, list/params, datum/tgui/ui) if(..()) return diff --git a/code/game/click/other_mobs.dm b/code/game/click/other_mobs.dm index 3e68c198d3ed..ae111a9234c1 100644 --- a/code/game/click/other_mobs.dm +++ b/code/game/click/other_mobs.dm @@ -66,7 +66,7 @@ // return FALSE return TRUE -/atom/ui_status(mob/user) +/atom/ui_status(mob/user, datum/ui_state/state) . = ..() if(!can_interact(user) && !IsAdminGhost(user)) . = min(., UI_UPDATE) diff --git a/code/game/machinery/atmo_control.dm b/code/game/machinery/atmo_control.dm index 8a232b6d3163..44618bf10b65 100644 --- a/code/game/machinery/atmo_control.dm +++ b/code/game/machinery/atmo_control.dm @@ -108,7 +108,7 @@ ui = new(user, src, "GeneralAtmoControl", name) ui.open() -/obj/machinery/computer/general_air_control/ui_data(mob/user) +/obj/machinery/computer/general_air_control/ui_data(mob/user, datum/tgui/ui) var/list/data = list() var/sensors_ui[0] if(sensors.len) @@ -144,7 +144,7 @@ var/pressure_setting = ONE_ATMOSPHERE * 45 circuit = /obj/item/circuitboard/air_management/tank_control -/obj/machinery/computer/general_air_control/large_tank_control/ui_data(mob/user) +/obj/machinery/computer/general_air_control/large_tank_control/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["tanks"] = 1 @@ -178,7 +178,7 @@ else ..(signal) -/obj/machinery/computer/general_air_control/large_tank_control/ui_act(action, params) +/obj/machinery/computer/general_air_control/large_tank_control/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE @@ -243,7 +243,7 @@ var/pressure_setting = 100 circuit = /obj/item/circuitboard/air_management/supermatter_core -/obj/machinery/computer/general_air_control/supermatter_core/ui_data(mob/user) +/obj/machinery/computer/general_air_control/supermatter_core/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["core"] = 1 @@ -279,7 +279,7 @@ else ..(signal) -/obj/machinery/computer/general_air_control/supermatter_core/ui_act(action, params) +/obj/machinery/computer/general_air_control/supermatter_core/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE @@ -372,7 +372,7 @@ ..() -/obj/machinery/computer/general_air_control/fuel_injection/ui_data(mob/user) +/obj/machinery/computer/general_air_control/fuel_injection/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["fuel"] = 1 data["automation"] = automation @@ -394,7 +394,7 @@ else ..(signal) -/obj/machinery/computer/general_air_control/fuel_injection/ui_act(action, params) +/obj/machinery/computer/general_air_control/fuel_injection/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/game/machinery/biogenerator.dm b/code/game/machinery/biogenerator.dm index 706e8568478b..6e870364fb62 100644 --- a/code/game/machinery/biogenerator.dm +++ b/code/game/machinery/biogenerator.dm @@ -151,7 +151,7 @@ beaker = null update_appearance() -/obj/machinery/biogenerator/ui_status(mob/user) +/obj/machinery/biogenerator/ui_status(mob/user, datum/ui_state/state) if(machine_stat & BROKEN || panel_open) return UI_CLOSE return ..() @@ -162,7 +162,7 @@ ui = new(user, src, "Biogenerator", name) ui.open() -/obj/machinery/biogenerator/ui_data(mob/user) +/obj/machinery/biogenerator/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["build_eff"] = build_eff @@ -172,7 +172,7 @@ return data -/obj/machinery/biogenerator/ui_static_data(mob/user) +/obj/machinery/biogenerator/ui_static_data(mob/user, datum/tgui/ui) var/list/static_data[0] // Available items - in static data because we don't wanna compute this list every time! It hardly changes. @@ -186,7 +186,7 @@ return static_data -/obj/machinery/biogenerator/ui_act(action, list/params) +/obj/machinery/biogenerator/ui_act(action, list/params, datum/tgui/ui) . = ..() if(.) return diff --git a/code/game/machinery/bomb_tester.dm b/code/game/machinery/bomb_tester.dm index ac36e0354b07..070d81a1fff5 100644 --- a/code/game/machinery/bomb_tester.dm +++ b/code/game/machinery/bomb_tester.dm @@ -117,7 +117,7 @@ ui = new(user, src, "BombTester", name) ui.open() -/obj/machinery/bomb_tester/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/bomb_tester/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["simulating"] = simulating diff --git a/code/game/machinery/colormate.dm b/code/game/machinery/colormate.dm index 571635597c0e..1bb5aa7e0d16 100644 --- a/code/game/machinery/colormate.dm +++ b/code/game/machinery/colormate.dm @@ -137,7 +137,7 @@ ui.set_autoupdate(FALSE) //This might be a bit intensive, better to not update it every few ticks ui.open() -/obj/machinery/gear_painter/ui_data(mob/user) +/obj/machinery/gear_painter/ui_data(mob/user, datum/tgui/ui) . = list() .["activemode"] = active_mode .["matrixcolors"] = list( @@ -167,7 +167,7 @@ else .["item"] = null -/obj/machinery/gear_painter/ui_act(action, params) +/obj/machinery/gear_painter/ui_act(action, list/params, datum/tgui/ui) . = ..() if(.) return diff --git a/code/game/machinery/computer/Operating.dm b/code/game/machinery/computer/Operating.dm index 94e50904ceda..e73cb842326b 100644 --- a/code/game/machinery/computer/Operating.dm +++ b/code/game/machinery/computer/Operating.dm @@ -60,7 +60,7 @@ ui = new(user, src, "OperatingComputer", "Patient Monitor") ui.open() -/obj/machinery/computer/operating/ui_data(mob/user) +/obj/machinery/computer/operating/ui_data(mob/user, datum/tgui/ui) var/data[0] var/mob/living/carbon/human/occupant if(table) @@ -132,7 +132,7 @@ return data -/obj/machinery/computer/operating/ui_act(action, params) +/obj/machinery/computer/operating/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE if((usr.contents.Find(src) || (in_range(src, usr) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon))) diff --git a/code/game/machinery/computer/aifixer.dm b/code/game/machinery/computer/aifixer.dm index 123ea6200666..ff694a8bba40 100644 --- a/code/game/machinery/computer/aifixer.dm +++ b/code/game/machinery/computer/aifixer.dm @@ -59,7 +59,7 @@ ui = new(user, src, "AiRestorer", name) ui.open() -/obj/machinery/computer/aifixer/ui_data(mob/user) +/obj/machinery/computer/aifixer/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["ejectable"] = FALSE @@ -80,7 +80,7 @@ return data -/obj/machinery/computer/aifixer/ui_act(action, params) +/obj/machinery/computer/aifixer/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE if(!occupier) diff --git a/code/game/machinery/computer/arcade/claw_machine.dm b/code/game/machinery/computer/arcade/claw_machine.dm index 1ea2dcc61fa7..9d0e3bc741ff 100644 --- a/code/game/machinery/computer/arcade/claw_machine.dm +++ b/code/game/machinery/computer/arcade/claw_machine.dm @@ -174,7 +174,7 @@ ui.autoupdate = TRUE ui.open() -/obj/machinery/computer/arcade/clawmachine/ui_data(mob/user) +/obj/machinery/computer/arcade/clawmachine/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["wintick"] = wintick @@ -184,7 +184,7 @@ return data -/obj/machinery/computer/arcade/clawmachine/ui_act(action, params) +/obj/machinery/computer/arcade/clawmachine/ui_act(action, list/params, datum/tgui/ui) if(..()) return diff --git a/code/game/machinery/computer/arcade/orion.dm b/code/game/machinery/computer/arcade/orion.dm index 49fb5b748058..c2cb41cefaca 100644 --- a/code/game/machinery/computer/arcade/orion.dm +++ b/code/game/machinery/computer/arcade/orion.dm @@ -156,7 +156,7 @@ GLOBAL_LIST_INIT(orion_events, generate_orion_events()) get_asset_datum(/datum/asset/spritesheet/moods), ) -/obj/machinery/computer/arcade/orion_trail/ui_data(mob/user) +/obj/machinery/computer/arcade/orion_trail/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["gamestatus"] = gameStatus @@ -178,7 +178,7 @@ GLOBAL_LIST_INIT(orion_events, generate_orion_events()) return data -/obj/machinery/computer/arcade/orion_trail/ui_static_data(mob/user) +/obj/machinery/computer/arcade/orion_trail/ui_static_data(mob/user, datum/tgui/ui) var/list/static_data = list() static_data["gamename"] = name static_data["emagged"] = obj_flags & OBJ_EMAGGED @@ -186,7 +186,7 @@ GLOBAL_LIST_INIT(orion_events, generate_orion_events()) static_data["settlermoods"] = settlermoods return static_data -/obj/machinery/computer/arcade/orion_trail/ui_act(action, list/params) +/obj/machinery/computer/arcade/orion_trail/ui_act(action, list/params, datum/tgui/ui) . = ..() if(.) return diff --git a/code/game/machinery/computer/atmos_alert.dm b/code/game/machinery/computer/atmos_alert.dm index 3a54262c390a..d22cfb98a8c2 100644 --- a/code/game/machinery/computer/atmos_alert.dm +++ b/code/game/machinery/computer/atmos_alert.dm @@ -28,7 +28,7 @@ var/global/list/minor_air_alarms = list() ui = new(user, src, "AtmosAlertConsole", name) ui.open() -/obj/machinery/computer/atmos_alert/ui_data(mob/user) +/obj/machinery/computer/atmos_alert/ui_data(mob/user, datum/tgui/ui) . = ..() var/list/major_alarms = list() var/list/minor_alarms = list() @@ -58,7 +58,7 @@ var/global/list/minor_air_alarms = list() /obj/machinery/computer/atmos_alert/proc/on_alarm_update() update_icon() -/obj/machinery/computer/atmos_alert/ui_act(action, params) +/obj/machinery/computer/atmos_alert/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/game/machinery/computer/command/card.dm b/code/game/machinery/computer/command/card.dm index 916d9cdf7112..2428138350ee 100644 --- a/code/game/machinery/computer/command/card.dm +++ b/code/game/machinery/computer/command/card.dm @@ -21,7 +21,7 @@ QDEL_NULL(tgui_cardmod) return ..() -/obj/machinery/computer/card/ui_module_route(action, list/params, datum/tgui/ui, id) +/obj/machinery/computer/card/ui_route(action, list/params, datum/tgui/ui, id) . = ..() if(.) return @@ -29,14 +29,6 @@ if("modify") return tgui_cardmod.ui_act(action, params, ui) -/obj/machinery/computer/card/ui_module_data(mob/user, datum/tgui/ui, datum/ui_state/state) - . = ..() - .["modify"] = tgui_cardmod.data(user, editing, authing) - -/obj/machinery/computer/card/ui_module_static(mob/user, datum/tgui/ui, datum/ui_state/state) - . = ..() - .["modify"] = tgui_cardmod.static_data(user, editing, authing) - /** * for later use: authorized to change slots */ @@ -116,16 +108,17 @@ ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "IdentificationComputer", name) + ui.register_module(tgui_cardmod, "modify") ui.open() -/obj/machinery/computer/card/ui_static_data(mob/user) +/obj/machinery/computer/card/ui_static_data(mob/user, datum/tgui/ui) . = ..() //? manifest // todo: refactor PDA_Manifest and CrewManifest.js data_core.get_manifest_list() .["manifest"] = GLOB.PDA_Manifest -/obj/machinery/computer/card/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/computer/card/ui_data(mob/user, datum/tgui/ui) . = ..() //? general diff --git a/code/game/machinery/computer/guestpass.dm b/code/game/machinery/computer/guestpass.dm index c9ab693d7690..cde5b1d9c146 100755 --- a/code/game/machinery/computer/guestpass.dm +++ b/code/game/machinery/computer/guestpass.dm @@ -115,7 +115,7 @@ deltimer(print_timer) print_timer = null -/obj/machinery/computer/guestpass/ui_static_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/computer/guestpass/ui_static_data(mob/user, datum/tgui/ui) . = ..() .["access"] = SSjob.tgui_access_data() .["allowed"] = allowed_accesses() @@ -124,7 +124,7 @@ .["durationMin"] = min_duration .["auth"] = tgui_inserted_card() -/obj/machinery/computer/guestpass/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/computer/guestpass/ui_data(mob/user, datum/tgui/ui) . = ..() .["guestName"] = guest_name .["guestReason"] = guest_reason diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm index 53e2f8463772..1867b9da4302 100644 --- a/code/game/machinery/computer/medical.dm +++ b/code/game/machinery/computer/medical.dm @@ -116,7 +116,7 @@ ui.set_autoupdate(FALSE) -/obj/machinery/computer/med_data/ui_data(mob/user) +/obj/machinery/computer/med_data/ui_data(mob/user, datum/tgui/ui) var/data[0] data["temp"] = temp data["scan"] = scan ? scan.name : null @@ -202,7 +202,7 @@ data["modal"] = ui_modal_data(src) return data -/obj/machinery/computer/med_data/ui_act(action, params) +/obj/machinery/computer/med_data/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/game/machinery/computer/misc/bioscan.dm b/code/game/machinery/computer/misc/bioscan.dm index 73d22e9764a5..3811989d5fde 100644 --- a/code/game/machinery/computer/misc/bioscan.dm +++ b/code/game/machinery/computer/misc/bioscan.dm @@ -25,7 +25,7 @@ ui = new(user, src, "BioscanConsole") ui.open() -/obj/machinery/computer/bioscan/ui_static_data(mob/user) +/obj/machinery/computer/bioscan/ui_static_data(mob/user, datum/tgui/ui) . = ..() .["scan"] = buffer .["antennas"] = ui_antenna_data() @@ -46,12 +46,12 @@ "y" = T.y, )) -/obj/machinery/computer/bioscan/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/computer/bioscan/ui_data(mob/user, datum/tgui/ui) . = ..() .["scan_ready"] = !on_cooldown() .["network"] = network_key || "" -/obj/machinery/computer/bioscan/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/computer/bioscan/ui_act(action, list/params, datum/tgui/ui) . = ..() switch(action) if("scan") diff --git a/code/game/machinery/computer/prisoner.dm b/code/game/machinery/computer/prisoner.dm index 3454c1ab935f..9171a6cf6115 100644 --- a/code/game/machinery/computer/prisoner.dm +++ b/code/game/machinery/computer/prisoner.dm @@ -27,7 +27,7 @@ ui = new(user, src, "PrisonerManagement", name) ui.open() -/obj/machinery/computer/prisoner/ui_data(mob/user) +/obj/machinery/computer/prisoner/ui_data(mob/user, datum/tgui/ui) var/list/chemImplants = list() var/list/trackImplants = list() if(screen) @@ -64,7 +64,7 @@ return list("locked" = !screen, "chemImplants" = chemImplants, "trackImplants" = trackImplants) -/obj/machinery/computer/prisoner/ui_act(action, list/params) +/obj/machinery/computer/prisoner/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/game/machinery/computer/robot.dm b/code/game/machinery/computer/robot.dm index 818dd977ac3e..477ab3ec77a0 100644 --- a/code/game/machinery/computer/robot.dm +++ b/code/game/machinery/computer/robot.dm @@ -121,7 +121,7 @@ ui = new(user, src, "RoboticsControlConsole", name) ui.open() -/obj/machinery/computer/robotics/ui_data(mob/user) +/obj/machinery/computer/robotics/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["auth"] = is_authenticated(user) data["can_hack"] = can_hack_any(user) @@ -150,7 +150,7 @@ data["show_detonate_all"] = (data["auth"] && length(data["cyborgs"]) > 0 && ishuman(user)) return data -/obj/machinery/computer/robotics/ui_act(action, params) +/obj/machinery/computer/robotics/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE . = FALSE diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index 10cdd39ca8ad..edfeb3565c32 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -101,7 +101,7 @@ ui.set_autoupdate(FALSE) -/obj/machinery/computer/secure_data/ui_data(mob/user) +/obj/machinery/computer/secure_data/ui_data(mob/user, datum/tgui/ui) var/data[0] data["temp"] = temp data["scan"] = scan ? scan.name : null @@ -185,7 +185,7 @@ data["modal"] = ui_modal_data(src) return data -/obj/machinery/computer/secure_data/ui_act(action, params) +/obj/machinery/computer/secure_data/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/game/machinery/computer/skills.dm b/code/game/machinery/computer/skills.dm index 88b58a19ec9f..e026411a300e 100644 --- a/code/game/machinery/computer/skills.dm +++ b/code/game/machinery/computer/skills.dm @@ -80,7 +80,7 @@ ui.open() ui.set_autoupdate(FALSE) -/obj/machinery/computer/skills/ui_data(mob/user) +/obj/machinery/computer/skills/ui_data(mob/user, datum/tgui/ui) var/data[0] data["temp"] = temp @@ -134,7 +134,7 @@ data["modal"] = ui_modal_data(src) return data -/obj/machinery/computer/skills/ui_act(action, params) +/obj/machinery/computer/skills/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/game/machinery/computer/timeclock_vr.dm b/code/game/machinery/computer/timeclock_vr.dm index 1b8cdfdd51bf..a9aa2308ff38 100644 --- a/code/game/machinery/computer/timeclock_vr.dm +++ b/code/game/machinery/computer/timeclock_vr.dm @@ -77,7 +77,7 @@ ui = new(user, src, "TimeClock", name) ui.open() -/obj/machinery/computer/timeclock/ui_data(mob/user) +/obj/machinery/computer/timeclock/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() // Okay, data for showing the user's OWN PTO stuff diff --git a/code/game/machinery/doors/airlock/airlock.dm b/code/game/machinery/doors/airlock/airlock.dm index c89103137b27..92efdd935ce6 100644 --- a/code/game/machinery/doors/airlock/airlock.dm +++ b/code/game/machinery/doors/airlock/airlock.dm @@ -559,7 +559,7 @@ About the new airlock wires panel: ui.open() return TRUE -/obj/machinery/door/airlock/ui_data(mob/user) +/obj/machinery/door/airlock/ui_data(mob/user, datum/tgui/ui) var/list/data = list() var/list/power = list() @@ -673,7 +673,7 @@ About the new airlock wires panel: ..(user) return -/obj/machinery/door/airlock/ui_act(action, params) +/obj/machinery/door/airlock/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE if(!user_allowed(usr)) diff --git a/code/game/machinery/doors/airlock/airlock_electronics.dm b/code/game/machinery/doors/airlock/airlock_electronics.dm index 398eef26b619..987aecfb27d5 100644 --- a/code/game/machinery/doors/airlock/airlock_electronics.dm +++ b/code/game/machinery/doors/airlock/airlock_electronics.dm @@ -16,11 +16,11 @@ ui = new(user, src, "AirlockElectronics") ui.open() -/obj/item/airlock_electronics/ui_static_data(mob/user) +/obj/item/airlock_electronics/ui_static_data(mob/user, datum/tgui/ui) . = ..() .["access"] = SSjob.tgui_access_data() -/obj/item/airlock_electronics/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/item/airlock_electronics/ui_data(mob/user, datum/tgui/ui) . = ..() .["req_access"] = conf_req_access || list() .["req_one_access"] = conf_req_one_access || list() diff --git a/code/game/machinery/doors/airlock/phoronlocks.dm b/code/game/machinery/doors/airlock/phoronlocks.dm index fe21b9c8b75f..fe78efcbece2 100644 --- a/code/game/machinery/doors/airlock/phoronlocks.dm +++ b/code/game/machinery/doors/airlock/phoronlocks.dm @@ -107,7 +107,7 @@ valid_actions = list("cycle_ext", "cycle_int", "force_ext", "force_int", "abort", "secure") var/tag_scrubber -/obj/machinery/embedded_controller/radio/airlock/phoron/ui_data(mob/user) +/obj/machinery/embedded_controller/radio/airlock/phoron/ui_data(mob/user, datum/tgui/ui) . = list( "chamber_pressure" = program.memory["chamber_sensor_pressure"], "chamber_phoron" = program.memory["chamber_sensor_phoron"], diff --git a/code/game/machinery/doors/door_timer.dm b/code/game/machinery/doors/door_timer.dm index 6b85947e5c23..e45245f39a8a 100644 --- a/code/game/machinery/doors/door_timer.dm +++ b/code/game/machinery/doors/door_timer.dm @@ -212,7 +212,7 @@ ui = new(user, src, "BrigTimer", name) ui.open() -/obj/machinery/door_timer/ui_data() +/obj/machinery/door_timer/ui_data(mob/user, datum/tgui/ui) var/list/data = list() var/time_left = time_left(seconds = TRUE) data["seconds"] = round(time_left % 60) @@ -229,7 +229,7 @@ break return data -/obj/machinery/door_timer/ui_act(action, params) +/obj/machinery/door_timer/ui_act(action, list/params, datum/tgui/ui) if(..()) return diff --git a/code/game/machinery/embedded_controller/airlock_controllers.dm b/code/game/machinery/embedded_controller/airlock_controllers.dm index f83bc4bcfb6a..d94a50b2b0c5 100644 --- a/code/game/machinery/embedded_controller/airlock_controllers.dm +++ b/code/game/machinery/embedded_controller/airlock_controllers.dm @@ -25,7 +25,7 @@ //dummy_terminals.Cut() return ..() -/obj/machinery/embedded_controller/radio/airlock/ui_status(mob/user, datum/ui_state/state, datum/tgui_module/module) +/obj/machinery/embedded_controller/radio/airlock/ui_status(mob/user, datum/ui_state/state) . = ..() if(!allowed(user)) return min(UI_UPDATE, .) @@ -34,7 +34,7 @@ /obj/machinery/embedded_controller/radio/airlock/advanced_airlock_controller name = "Advanced Airlock Controller" -/obj/machinery/embedded_controller/radio/airlock/advanced_airlock_controller/ui_data(mob/user) +/obj/machinery/embedded_controller/radio/airlock/advanced_airlock_controller/ui_data(mob/user, datum/tgui/ui) . = list( "chamber_pressure" = round(program.memory["chamber_sensor_pressure"]), "external_pressure" = round(program.memory["external_sensor_pressure"]), @@ -52,7 +52,7 @@ tag_secure = 1 valid_actions = list("cycle_ext", "cycle_int", "force_ext", "force_int", "abort") -/obj/machinery/embedded_controller/radio/airlock/airlock_controller/ui_data(mob/user) +/obj/machinery/embedded_controller/radio/airlock/airlock_controller/ui_data(mob/user, datum/tgui/ui) . = list( "chamber_pressure" = round(program.memory["chamber_sensor_pressure"]), "exterior_status" = program.memory["exterior_status"], @@ -80,7 +80,7 @@ else icon_state = "access_control_off" -/obj/machinery/embedded_controller/radio/airlock/access_controller/ui_data(mob/user) +/obj/machinery/embedded_controller/radio/airlock/access_controller/ui_data(mob/user, datum/tgui/ui) . = list( "exterior_status" = program.memory["exterior_status"], "interior_status" = program.memory["interior_status"], diff --git a/code/game/machinery/embedded_controller/airlock_docking_controller.dm b/code/game/machinery/embedded_controller/airlock_docking_controller.dm index 2d017876ab4d..5965200ef9cf 100644 --- a/code/game/machinery/embedded_controller/airlock_docking_controller.dm +++ b/code/game/machinery/embedded_controller/airlock_docking_controller.dm @@ -35,7 +35,7 @@ else ..() -/obj/machinery/embedded_controller/radio/airlock/docking_port/ui_data(mob/user) +/obj/machinery/embedded_controller/radio/airlock/docking_port/ui_data(mob/user, datum/tgui/ui) var/datum/computer/file/embedded_program/docking/airlock/docking_program = program var/datum/computer/file/embedded_program/airlock/docking/airlock_program = docking_program.airlock_program diff --git a/code/game/machinery/embedded_controller/airlock_docking_controller_multi.dm b/code/game/machinery/embedded_controller/airlock_docking_controller_multi.dm index a0ff624e8da8..375d6a02f600 100644 --- a/code/game/machinery/embedded_controller/airlock_docking_controller_multi.dm +++ b/code/game/machinery/embedded_controller/airlock_docking_controller_multi.dm @@ -15,7 +15,7 @@ for (var/i = 1; i <= tags.len; i++) child_names[tags[i]] = names[i] -/obj/machinery/embedded_controller/radio/docking_port_multi/ui_data(mob/user) +/obj/machinery/embedded_controller/radio/docking_port_multi/ui_data(mob/user, datum/tgui/ui) var/datum/computer/file/embedded_program/docking/multi/docking_program = program // Cast to proper type var/list/airlocks[child_names.len] @@ -29,7 +29,7 @@ "internalTemplateName" = "DockingConsoleMulti", ) -/obj/machinery/embedded_controller/radio/docking_port_multi/ui_act(action, params) +/obj/machinery/embedded_controller/radio/docking_port_multi/ui_act(action, list/params, datum/tgui/ui) . = ..() return //Apparently we swallow all input (this is corrected legacy code) @@ -43,7 +43,7 @@ valid_actions = list("cycle_ext", "cycle_int", "force_ext", "force_int", "abort", "toggle_override") -/obj/machinery/embedded_controller/radio/airlock/docking_port_multi/ui_data(mob/user) +/obj/machinery/embedded_controller/radio/airlock/docking_port_multi/ui_data(mob/user, datum/tgui/ui) var/datum/computer/file/embedded_program/airlock/multi_docking/airlock_program = program // Cast to proper type . = list( diff --git a/code/game/machinery/embedded_controller/embedded_controller_base.dm b/code/game/machinery/embedded_controller/embedded_controller_base.dm index 49b686f3c812..5cc1846c54aa 100644 --- a/code/game/machinery/embedded_controller/embedded_controller_base.dm +++ b/code/game/machinery/embedded_controller/embedded_controller_base.dm @@ -30,7 +30,7 @@ . = ..() stack_trace("WARNING: Embedded controller [src] ([type]) had Topic() called unexpectedly. Please report this.") -/obj/machinery/embedded_controller/ui_act(action, params) +/obj/machinery/embedded_controller/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE if(LAZYLEN(valid_actions)) diff --git a/code/game/machinery/embedded_controller/simple_docking_controller.dm b/code/game/machinery/embedded_controller/simple_docking_controller.dm index eebdc9ea48ff..82a756b617dc 100644 --- a/code/game/machinery/embedded_controller/simple_docking_controller.dm +++ b/code/game/machinery/embedded_controller/simple_docking_controller.dm @@ -5,7 +5,7 @@ var/tag_door valid_actions = list("force_door", "toggle_override") -/obj/machinery/embedded_controller/radio/simple_docking_controller/ui_data(mob/user) +/obj/machinery/embedded_controller/radio/simple_docking_controller/ui_data(mob/user, datum/tgui/ui) var/datum/computer/file/embedded_program/docking/simple/docking_program = program // Cast to proper type . = list( diff --git a/code/game/machinery/exonet_node.dm b/code/game/machinery/exonet_node.dm index 6671564f5025..fb6c5c49b8a2 100644 --- a/code/game/machinery/exonet_node.dm +++ b/code/game/machinery/exonet_node.dm @@ -118,7 +118,7 @@ GLOBAL_LIST_EMPTY(exonet_nodes) // Proc: ui_data() // Parameters: 1 (user - the person using the interface) // Description: Allows the user to turn the machine on or off, or open or close certain 'ports' for things like external PDA messages, newscasters, etc. -/obj/machinery/exonet_node/ui_data(mob/user) +/obj/machinery/exonet_node/ui_data(mob/user, datum/tgui/ui) // this is the data which will be sent to the ui var/list/data = list() @@ -133,7 +133,7 @@ GLOBAL_LIST_EMPTY(exonet_nodes) // Proc: ui_act() // Parameters: 2 (standard ui_act arguments) // Description: Responds to button presses on the TGUI interface. -/obj/machinery/exonet_node/ui_act(action, params) +/obj/machinery/exonet_node/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/game/machinery/holopad.dm b/code/game/machinery/holopad.dm index 2c33429ea9fc..0209055dcd93 100644 --- a/code/game/machinery/holopad.dm +++ b/code/game/machinery/holopad.dm @@ -447,7 +447,7 @@ GLOBAL_VAR_INIT(holopad_connectivity_rebuild_queued, FALSE) ui = new(user, src, "Holopad") ui.open() -/obj/machinery/holopad/ui_static_data(mob/user) +/obj/machinery/holopad/ui_static_data(mob/user, datum/tgui/ui) . = ..() .["connectivity"] = ui_connectivity_data() .["isAI"] = isAI(user) @@ -462,7 +462,7 @@ GLOBAL_VAR_INIT(holopad_connectivity_rebuild_queued, FALSE) .["ringerToggle"] = ringer_toggleable .["autoToggle"] = call_auto_toggle -/obj/machinery/holopad/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/holopad/ui_data(mob/user, datum/tgui/ui) . = ..() .["isAIProjecting"] = isAI(user) && is_ai_projecting(user) .["aiRequested"] = !request_ai_cooldown() @@ -477,7 +477,7 @@ GLOBAL_VAR_INIT(holopad_connectivity_rebuild_queued, FALSE) ringing[++ringing.len] = holocall.ui_caller_id_source() .["ringing"] = ringing -/obj/machinery/holopad/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/holopad/ui_act(action, list/params, datum/tgui/ui) . = ..() switch(action) // user requesting ai @@ -583,7 +583,7 @@ GLOBAL_VAR_INIT(holopad_connectivity_rebuild_queued, FALSE) outgoing_call.cleanup_remote_presence() return TRUE -/obj/machinery/holopad/ui_close(mob/user) +/obj/machinery/holopad/on_ui_close(mob/user, datum/tgui/ui, embedded) . = ..() // if they were remoting, kick 'em - they do get buttons on top left but // we want to enforce interface being open. diff --git a/code/game/machinery/iv_drip.dm b/code/game/machinery/iv_drip.dm index 95cafc612406..cf41670361c3 100644 --- a/code/game/machinery/iv_drip.dm +++ b/code/game/machinery/iv_drip.dm @@ -48,7 +48,7 @@ ui = new(user, src, "IVDrip", name) ui.open() -/obj/machinery/iv_drip/ui_data(mob/user) +/obj/machinery/iv_drip/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["transferRate"] = transfer_rate data["maxInjectRate"] = MAX_IV_TRANSFER_RATE @@ -58,7 +58,7 @@ data["beakerAttached"] = reagent_container ? TRUE : FALSE return data -/obj/machinery/iv_drip/ui_act(action, params) +/obj/machinery/iv_drip/ui_act(action, list/params, datum/tgui/ui) . = ..() if(.) return diff --git a/code/game/machinery/jukebox.dm b/code/game/machinery/jukebox.dm index 73ba949f33cb..25758ac5be7d 100644 --- a/code/game/machinery/jukebox.dm +++ b/code/game/machinery/jukebox.dm @@ -159,7 +159,7 @@ if (panel_open) add_overlay("panel_open") -/obj/machinery/media/jukebox/ui_act(action, list/params, datum/tgui/ui, datum/tgui_module/module) +/obj/machinery/media/jukebox/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE @@ -211,7 +211,7 @@ return ui_interact(user) -/obj/machinery/media/jukebox/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/media/jukebox/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["playing"] = playing @@ -240,7 +240,7 @@ ui = new(user, src, "Jukebox", "RetroBox - Space Style") ui.open() -/obj/machinery/media/jukebox/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/media/jukebox/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/game/machinery/lathes/lathe.dm b/code/game/machinery/lathes/lathe.dm index 458d959da61d..df2a42c9edab 100644 --- a/code/game/machinery/lathes/lathe.dm +++ b/code/game/machinery/lathes/lathe.dm @@ -579,7 +579,7 @@ /// items to use for design - order matters! uses weakref's. var/list/ingredient_parts -/datum/lathe_queue_entry/ui_data() +/datum/lathe_queue_entry/ui_data(mob/user, datum/tgui/ui) return list( "design" = design_id, "amount" = amount, diff --git a/code/game/machinery/pipe/pipe_dispenser.dm b/code/game/machinery/pipe/pipe_dispenser.dm index 7c055ad255b8..d9adc6922ebc 100644 --- a/code/game/machinery/pipe/pipe_dispenser.dm +++ b/code/game/machinery/pipe/pipe_dispenser.dm @@ -27,7 +27,7 @@ ui = new(user, src, "PipeDispenser", name) ui.open() -/obj/machinery/pipedispenser/ui_data(mob/user) +/obj/machinery/pipedispenser/ui_data(mob/user, datum/tgui/ui) var/list/data = list( "disposals" = disposals, "p_layer" = p_layer, @@ -59,7 +59,7 @@ return data -/obj/machinery/pipedispenser/ui_act(action, params) +/obj/machinery/pipedispenser/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/game/machinery/pointdefense.dm b/code/game/machinery/pointdefense.dm index 2c4c8a0b3c15..4d71af4a6196 100644 --- a/code/game/machinery/pointdefense.dm +++ b/code/game/machinery/pointdefense.dm @@ -66,7 +66,7 @@ GLOBAL_LIST_BOILERPLATE(pointdefense_turrets, /obj/machinery/power/pointdefense) PD.Deactivate() return TRUE -/obj/machinery/pointdefense_control/ui_data(mob/user) +/obj/machinery/pointdefense_control/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["id"] = id_tag var/list/turrets = list() diff --git a/code/game/machinery/suit_storage/suit_storage_unit.dm b/code/game/machinery/suit_storage/suit_storage_unit.dm index 5546eeb3deb6..c603140a8cfc 100644 --- a/code/game/machinery/suit_storage/suit_storage_unit.dm +++ b/code/game/machinery/suit_storage/suit_storage_unit.dm @@ -87,7 +87,7 @@ return 0 ui_interact(user) -/obj/machinery/suit_storage_unit/ui_state(mob/user, datum/tgui_module/module) +/obj/machinery/suit_storage_unit/ui_state() return GLOB.notcontained_state /obj/machinery/suit_storage_unit/ui_interact(mob/user, datum/tgui/ui) @@ -96,7 +96,7 @@ ui = new(user, src, "SuitStorageUnit", name) ui.open() -/obj/machinery/suit_storage_unit/ui_data() +/obj/machinery/suit_storage_unit/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["broken"] = isbroken @@ -130,7 +130,7 @@ data["occupied"] = FALSE return data -/obj/machinery/suit_storage_unit/ui_act(action, params) //I fucking HATE this proc +/obj/machinery/suit_storage_unit/ui_act(action, list/params, datum/tgui/ui) if(..() || isUV || isbroken) return TRUE diff --git a/code/game/machinery/telecomms/_telecomms.dm b/code/game/machinery/telecomms/_telecomms.dm index 6742110c2473..7c9f141ca39e 100644 --- a/code/game/machinery/telecomms/_telecomms.dm +++ b/code/game/machinery/telecomms/_telecomms.dm @@ -305,7 +305,7 @@ /obj/machinery/telecomms/attack_ai(var/mob/user as mob) attack_hand(user) -/obj/machinery/telecomms/ui_data(mob/user) +/obj/machinery/telecomms/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["temp"] = temp @@ -357,7 +357,7 @@ return data -/obj/machinery/telecomms/ui_status(mob/user) +/obj/machinery/telecomms/ui_status(mob/user, datum/ui_state/state) if(!issilicon(user)) if(!istype(user.get_active_held_item(), /obj/item/multitool)) return UI_CLOSE @@ -539,7 +539,7 @@ overmap_range = clamp(new_range, overmap_range_min, overmap_range_max) update_idle_power_usage(initial(idle_power_usage)**(overmap_range+1)) -/obj/machinery/telecomms/ui_act(action, params) +/obj/machinery/telecomms/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/game/machinery/telecomms/logbrowser.dm b/code/game/machinery/telecomms/logbrowser.dm index deb1bc024ec4..c1c33182caa4 100644 --- a/code/game/machinery/telecomms/logbrowser.dm +++ b/code/game/machinery/telecomms/logbrowser.dm @@ -18,7 +18,7 @@ req_access = list(ACCESS_ENGINEERING_TELECOMMS) -/obj/machinery/computer/telecomms/server/ui_data(mob/user) +/obj/machinery/computer/telecomms/server/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["universal_translate"] = universal_translate @@ -73,7 +73,7 @@ ui = new(user, src, "TelecommsLogBrowser", name) ui.open() -/obj/machinery/computer/telecomms/server/ui_act(action, params) +/obj/machinery/computer/telecomms/server/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/game/machinery/telecomms/telemonitor.dm b/code/game/machinery/telecomms/telemonitor.dm index f23e06aab2a8..3538ddd6d09e 100644 --- a/code/game/machinery/telecomms/telemonitor.dm +++ b/code/game/machinery/telecomms/telemonitor.dm @@ -20,7 +20,7 @@ var/list/temp = null // temporary feedback messages -/obj/machinery/computer/telecomms/monitor/ui_data(mob/user) +/obj/machinery/computer/telecomms/monitor/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["network"] = network @@ -61,7 +61,7 @@ ui = new(user, src, "TelecommsMachineBrowser", name) ui.open() -/obj/machinery/computer/telecomms/monitor/ui_act(action, params) +/obj/machinery/computer/telecomms/monitor/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/game/machinery/teleporter/console.dm b/code/game/machinery/teleporter/console.dm index 1f57687b2a47..6b5a96a44705 100644 --- a/code/game/machinery/teleporter/console.dm +++ b/code/game/machinery/teleporter/console.dm @@ -95,7 +95,7 @@ ui = new(user, src, "TeleporterConsole", name) // 500, 800 ui.open() -/obj/machinery/computer/teleporter/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/computer/teleporter/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["disabled"] = is_disabled() diff --git a/code/game/mecha/mech_fabricator.dm b/code/game/mecha/mech_fabricator.dm index d2f0957b91cd..8d2e3af026bd 100644 --- a/code/game/mecha/mech_fabricator.dm +++ b/code/game/mecha/mech_fabricator.dm @@ -496,7 +496,7 @@ ui = new(user, src, "ExosuitFabricator", name) ui.open() -/obj/machinery/mecha_part_fabricator/ui_static_data(mob/user) +/obj/machinery/mecha_part_fabricator/ui_static_data(mob/user, datum/tgui/ui) var/list/data = list() var/list/final_sets = list() @@ -533,7 +533,7 @@ return data -/obj/machinery/mecha_part_fabricator/ui_data(mob/user) +/obj/machinery/mecha_part_fabricator/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["materials"] = output_available_resources() @@ -559,7 +559,7 @@ return data -/obj/machinery/mecha_part_fabricator/ui_act(action, var/list/params) +/obj/machinery/mecha_part_fabricator/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/game/mecha/mech_prosthetics.dm b/code/game/mecha/mech_prosthetics.dm index c9c2814e8339..a8fd686c0b1c 100644 --- a/code/game/mecha/mech_prosthetics.dm +++ b/code/game/mecha/mech_prosthetics.dm @@ -79,7 +79,7 @@ for(var/i in I.materials_base) I.materials_base[i] = I.materials_base[i] * component_coeff -/obj/machinery/mecha_part_fabricator/pros/ui_data(mob/user) +/obj/machinery/mecha_part_fabricator/pros/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["species_types"] = species_types diff --git a/code/game/mecha/mecha_control_console.dm b/code/game/mecha/mecha_control_console.dm index 5c807d5fe53a..cd4f58454e7e 100644 --- a/code/game/mecha/mecha_control_console.dm +++ b/code/game/mecha/mecha_control_console.dm @@ -24,7 +24,7 @@ ui = new(user, src, "MechaControlConsole", name) ui.open() -/obj/machinery/computer/mecha/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/computer/mecha/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["beacons"] = list() @@ -75,7 +75,7 @@ icon_state = "motion2" origin_tech = list(TECH_DATA = 2, TECH_MAGNET = 2) -/obj/item/mecha_parts/mecha_tracking/ui_data(mob/user) +/obj/item/mecha_parts/mecha_tracking/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() if(!in_mecha()) return FALSE diff --git a/code/game/objects/items/devices/communicator/UI_tgui.dm b/code/game/objects/items/devices/communicator/UI_tgui.dm index 365a1af80222..60aaeb2f05ca 100644 --- a/code/game/objects/items/devices/communicator/UI_tgui.dm +++ b/code/game/objects/items/devices/communicator/UI_tgui.dm @@ -83,7 +83,7 @@ // Proc: ui_state() // Parameters: User // Description: This tells TGUI to only allow us to be interacted with while in a mob inventory. -/obj/item/communicator/ui_state(mob/user, datum/tgui_module/module) +/obj/item/communicator/ui_state() return GLOB.inventory_state // Proc: ui_interact() @@ -108,7 +108,7 @@ if(custom_state) // Just in case ui.set_state(custom_state) -/obj/item/communicator/ui_close(mob/user, datum/tgui_module/module) +/obj/item/communicator/on_ui_close(mob/user, datum/tgui/ui, embedded) . = ..() if(isnull(user.client)) return // what??? @@ -118,7 +118,7 @@ // Proc: ui_data() // Parameters: User, UI, State // Description: Uses a bunch of for loops to turn lists into lists of lists, so they can be displayed in nanoUI, then displays various buttons to the user. -/obj/item/communicator/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/item/communicator/ui_data(mob/user, datum/tgui/ui) // this is the data which will be sent to the ui var/list/data = list() //General nanoUI information var/list/communicators = list() //List of communicators @@ -298,7 +298,7 @@ // Proc: ui_static_data() // Parameters: User, UI, State // Description: Just like ui_data, except it only gets called once when the user opens the UI, not every tick. -/obj/item/communicator/ui_static_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/item/communicator/ui_static_data(mob/user, datum/tgui/ui) var/list/data = ..() // Update manifest' if(data_core) diff --git a/code/game/objects/items/devices/gps.dm b/code/game/objects/items/devices/gps.dm index f8e2648b7c4b..d9b81f39bcce 100644 --- a/code/game/objects/items/devices/gps.dm +++ b/code/game/objects/items/devices/gps.dm @@ -344,11 +344,11 @@ /obj/item/gps/proc/push_waypoint_data() push_ui_data(data = list("waypoints" = ui_waypoint_data())) -/obj/item/gps/ui_static_data(mob/user) +/obj/item/gps/ui_static_data(mob/user, datum/tgui/ui) . = ..() .["waypoints"] = ui_waypoint_data() -/obj/item/gps/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/item/gps/ui_data(mob/user, datum/tgui/ui) . = ..() .["on"] = !!on diff --git a/code/game/objects/items/devices/radio/headset.dm b/code/game/objects/items/devices/radio/headset.dm index 44487f9ee0e1..998675524adc 100755 --- a/code/game/objects/items/devices/radio/headset.dm +++ b/code/game/objects/items/devices/radio/headset.dm @@ -70,7 +70,7 @@ return ..(freq, level) return -1 -/obj/item/radio/headset/ui_state(mob/user, datum/tgui_module/module) +/obj/item/radio/headset/ui_state() return GLOB.inventory_state /obj/item/radio/headset/syndicate diff --git a/code/game/objects/items/devices/radio/radio.dm b/code/game/objects/items/devices/radio/radio.dm index d5073ab79371..fb10a14016ff 100644 --- a/code/game/objects/items/devices/radio/radio.dm +++ b/code/game/objects/items/devices/radio/radio.dm @@ -160,7 +160,7 @@ GLOBAL_LIST_INIT(default_medbay_channels, list( ui = new(user, src, "Radio", name) ui.open() -/obj/item/radio/ui_data(mob/user) +/obj/item/radio/ui_data(mob/user, datum/tgui/ui) var/data[0] data["rawfreq"] = frequency @@ -187,7 +187,7 @@ GLOBAL_LIST_INIT(default_medbay_channels, list( return data -/obj/item/radio/ui_act(action, params) +/obj/item/radio/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/game/objects/items/devices/transfer_valve.dm b/code/game/objects/items/devices/transfer_valve.dm index 47b3a19302cb..8363b56abbae 100644 --- a/code/game/objects/items/devices/transfer_valve.dm +++ b/code/game/objects/items/devices/transfer_valve.dm @@ -76,7 +76,7 @@ return ui_interact(user) -/obj/item/transfer_valve/ui_state(mob/user, datum/tgui_module/module) +/obj/item/transfer_valve/ui_state() return GLOB.inventory_state /obj/item/transfer_valve/ui_interact(mob/user, datum/tgui/ui = null) @@ -85,7 +85,7 @@ ui = new(user, src, "TransferValve", name) // 460, 320 ui.open() -/obj/item/transfer_valve/ui_data(mob/user) +/obj/item/transfer_valve/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["tank_one"] = tank_one ? tank_one.name : null data["tank_two"] = tank_two ? tank_two.name : null @@ -93,7 +93,7 @@ data["valve"] = valve_open return data -/obj/item/transfer_valve/ui_act(action, params) +/obj/item/transfer_valve/ui_act(action, list/params, datum/tgui/ui) if(..()) return . = TRUE diff --git a/code/game/objects/items/scanners/plant.dm b/code/game/objects/items/scanners/plant.dm index 31eb5b14cafd..a06add08026f 100644 --- a/code/game/objects/items/scanners/plant.dm +++ b/code/game/objects/items/scanners/plant.dm @@ -18,10 +18,10 @@ ui = new(user, src, "PlantAnalyzer", name) ui.open() -/obj/item/plant_analyzer/ui_state(mob/user, datum/tgui_module/module) +/obj/item/plant_analyzer/ui_state() return GLOB.inventory_state -/obj/item/plant_analyzer/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/item/plant_analyzer/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() var/datum/seed/grown_seed = locate(last_seed) diff --git a/code/game/objects/items/stacks/stack.dm b/code/game/objects/items/stacks/stack.dm index f2ed4d9d5ff1..6f42300ce144 100644 --- a/code/game/objects/items/stacks/stack.dm +++ b/code/game/objects/items/stacks/stack.dm @@ -79,7 +79,7 @@ ui = new(user, src, "StackCrafting") ui.open() -/obj/item/stack/ui_static_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/item/stack/ui_static_data(mob/user, datum/tgui/ui) . = ..() .["recipes"] = tgui_recipes() .["maxAmount"] = max_amount @@ -94,7 +94,7 @@ assembled[++assembled.len] = recipe.tgui_recipe_data() return assembled -/obj/item/stack/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/item/stack/ui_data(mob/user, datum/tgui/ui) . = ..() .["amount"] = get_amount() diff --git a/code/game/objects/items/weapons/RPD.dm b/code/game/objects/items/weapons/RPD.dm index 85a2cb1fbd1a..e1ddadbd764b 100644 --- a/code/game/objects/items/weapons/RPD.dm +++ b/code/game/objects/items/weapons/RPD.dm @@ -117,7 +117,7 @@ get_asset_datum(/datum/asset/spritesheet/pipes), ) -/obj/item/pipe_dispenser/ui_state(mob/user, datum/tgui_module/module) +/obj/item/pipe_dispenser/ui_state() return GLOB.inventory_state /obj/item/pipe_dispenser/ui_interact(mob/user, datum/tgui/ui) @@ -127,11 +127,11 @@ ui = new(user, src, "RapidPipeDispenser", name) ui.open() -/obj/item/pipe_dispenser/ui_static_data(mob/user) +/obj/item/pipe_dispenser/ui_static_data(mob/user, datum/tgui/ui) var/list/data = list("paint_colors" = GLOB.pipe_paint_colors) return data -/obj/item/pipe_dispenser/ui_data(mob/user) +/obj/item/pipe_dispenser/ui_data(mob/user, datum/tgui/ui) var/list/data = list( "category" = category, "piping_layer" = piping_layer, @@ -165,7 +165,7 @@ data["init_directions"] = init_directions return data -/obj/item/pipe_dispenser/ui_act(action, params) +/obj/item/pipe_dispenser/ui_act(action, list/params, datum/tgui/ui) . = ..() if(.) return diff --git a/code/game/objects/items/weapons/tanks/tanks.dm b/code/game/objects/items/weapons/tanks/tanks.dm index d223e575b216..a3477920d891 100644 --- a/code/game/objects/items/weapons/tanks/tanks.dm +++ b/code/game/objects/items/weapons/tanks/tanks.dm @@ -224,7 +224,7 @@ var/list/global/tank_gauge_cache = list() if (src.proxyassembly.assembly) src.proxyassembly.assembly.attack_self(user) -/obj/item/weapon/tank/ui_state(mob/user, datum/tgui_module/module) +/obj/item/weapon/tank/ui_state() return GLOB.deep_inventory_state /obj/item/tank/ui_interact(mob/user, datum/tgui/ui) @@ -233,7 +233,7 @@ var/list/global/tank_gauge_cache = list() ui = new(user, src, "Tank", name) ui.open() -/obj/item/tank/ui_static_data(mob/user) +/obj/item/tank/ui_static_data(mob/user, datum/tgui/ui) . = list ( "defaultReleasePressure" = round(TANK_DEFAULT_RELEASE_PRESSURE), "minReleasePressure" = round(TANK_MIN_RELEASE_PRESSURE), @@ -242,7 +242,7 @@ var/list/global/tank_gauge_cache = list() "fragmentPressure" = round(TANK_FRAGMENT_PRESSURE) ) -/obj/item/tank/ui_data(mob/user) +/obj/item/tank/ui_data(mob/user, datum/tgui/ui) . = list( "tankPressure" = round(air_contents.return_pressure()), "releasePressure" = round(distribute_pressure) @@ -266,7 +266,7 @@ var/list/global/tank_gauge_cache = list() return . -/obj/item/tank/ui_act(action, params) +/obj/item/tank/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE switch(action) diff --git a/code/game/verbs/character_directory.dm b/code/game/verbs/character_directory.dm index bb241e4ac7ff..1ee1d7e975de 100644 --- a/code/game/verbs/character_directory.dm +++ b/code/game/verbs/character_directory.dm @@ -17,7 +17,7 @@ GLOBAL_DATUM(character_directory, /datum/character_directory) // This is a global singleton. Keep in mind that all operations should occur on usr, not src. /datum/character_directory -/datum/character_directory/ui_state(mob/user, datum/tgui_module/module) +/datum/character_directory/ui_state() return GLOB.always_state /datum/character_directory/ui_interact(mob/user, datum/tgui/ui, datum/tgui/parent_ui) @@ -26,7 +26,7 @@ GLOBAL_DATUM(character_directory, /datum/character_directory) ui = new(user, src, "CharacterDirectory", "Character Directory") ui.open() -/datum/character_directory/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/datum/character_directory/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["personalVisibility"] = user?.client?.prefs?.show_in_directory @@ -35,7 +35,7 @@ GLOBAL_DATUM(character_directory, /datum/character_directory) return data -/datum/character_directory/ui_static_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/datum/character_directory/ui_static_data(mob/user, datum/tgui/ui) var/list/data = ..() var/list/directory_mobs = list() diff --git a/code/modules/admin/view_variables/color_matrix_editor.dm b/code/modules/admin/view_variables/color_matrix_editor.dm index 5e142d6f7e9a..f8db04662751 100644 --- a/code/modules/admin/view_variables/color_matrix_editor.dm +++ b/code/modules/admin/view_variables/color_matrix_editor.dm @@ -75,16 +75,16 @@ INITIALIZE_IMMEDIATE(/atom/movable/screen/color_matrix_proxy_view) QDEL_NULL(proxy_view) return ..() -/datum/color_matrix_editor/ui_state(mob/user, datum/tgui_module/module) +/datum/color_matrix_editor/ui_state() return GLOB.admin_state -/datum/color_matrix_editor/ui_static_data(mob/user) +/datum/color_matrix_editor/ui_static_data(mob/user, datum/tgui/ui) var/list/data = list() data["mapRef"] = proxy_view.assigned_map return data -/datum/color_matrix_editor/ui_data(mob/user) +/datum/color_matrix_editor/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["currentColor"] = current_color @@ -108,7 +108,7 @@ INITIALIZE_IMMEDIATE(/atom/movable/screen/color_matrix_proxy_view) on_confirm() SStgui.close_uis(src) -/datum/color_matrix_editor/ui_close(mob/user, datum/tgui_module/module) +/datum/color_matrix_editor/on_ui_close(mob/user, datum/tgui/ui, embedded) . = ..() closed = TRUE diff --git a/code/modules/admin/view_variables/filteriffic.dm b/code/modules/admin/view_variables/filteriffic.dm index adf7e795e7ca..747a7b1a9ab8 100644 --- a/code/modules/admin/view_variables/filteriffic.dm +++ b/code/modules/admin/view_variables/filteriffic.dm @@ -4,7 +4,7 @@ /datum/filter_editor/New(atom/target) src.target = target -/datum/filter_editor/ui_state(mob/user, datum/tgui_module/module) +/datum/filter_editor/ui_state() return GLOB.admin_state /datum/filter_editor/ui_interact(mob/user, datum/tgui/ui) @@ -13,18 +13,18 @@ ui = new(user, src, "Filteriffic") ui.open() -/datum/filter_editor/ui_static_data(mob/user) +/datum/filter_editor/ui_static_data(mob/user, datum/tgui/ui) var/list/data = list() data["filter_info"] = GLOB.master_filter_info return data -/datum/filter_editor/ui_data() +/datum/filter_editor/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["target_name"] = target.name data["target_filter_data"] = target.filter_data return data -/datum/filter_editor/ui_act(action, list/params) +/datum/filter_editor/ui_act(action, list/params, datum/tgui/ui) . = ..() if(.) return diff --git a/code/modules/assembly/assembly.dm b/code/modules/assembly/assembly.dm index 36664ba32cc3..84b8bba7b24f 100644 --- a/code/modules/assembly/assembly.dm +++ b/code/modules/assembly/assembly.dm @@ -107,7 +107,7 @@ ui_interact(user) return TRUE -/obj/item/device/assembly/ui_state(mob/user, datum/tgui_module/module) +/obj/item/device/assembly/ui_state() return GLOB.deep_inventory_state /obj/item/device/assembly/ui_interact(mob/user, datum/tgui/ui) diff --git a/code/modules/assembly/infrared.dm b/code/modules/assembly/infrared.dm index eed0dc9d6274..dea3be27a78d 100644 --- a/code/modules/assembly/infrared.dm +++ b/code/modules/assembly/infrared.dm @@ -168,7 +168,7 @@ ui = new(user, src, "AssemblyInfrared", name) ui.open() -/obj/item/assembly/infra/ui_data(mob/user) +/obj/item/assembly/infra/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["on"] = on diff --git a/code/modules/assembly/proximity.dm b/code/modules/assembly/proximity.dm index 4f4d01326db9..73bee405191b 100644 --- a/code/modules/assembly/proximity.dm +++ b/code/modules/assembly/proximity.dm @@ -110,7 +110,7 @@ ui = new(user, src, "AssemblyProx", name) ui.open() -/obj/item/assembly/prox_sensor/ui_data(mob/user) +/obj/item/assembly/prox_sensor/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["time"] = time * 10 diff --git a/code/modules/assembly/signaler.dm b/code/modules/assembly/signaler.dm index 3b0491d168d7..c27af1c62fb7 100644 --- a/code/modules/assembly/signaler.dm +++ b/code/modules/assembly/signaler.dm @@ -42,7 +42,7 @@ ui = new(user, src, "Signaler", name) ui.open() -/obj/item/assembly/signaler/ui_data(mob/user) +/obj/item/assembly/signaler/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["frequency"] = frequency data["code"] = code @@ -50,7 +50,7 @@ data["maxFrequency"] = RADIO_HIGH_FREQ return data -/obj/item/assembly/signaler/ui_act(action, params) +/obj/item/assembly/signaler/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/modules/assembly/timer.dm b/code/modules/assembly/timer.dm index 2a7500586063..45df510a221f 100644 --- a/code/modules/assembly/timer.dm +++ b/code/modules/assembly/timer.dm @@ -75,7 +75,7 @@ ui = new(user, src, "AssemblyTimer", name) ui.open() -/obj/item/assembly/timer/ui_data(mob/user) +/obj/item/assembly/timer/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() var/time_left = time data["seconds"] = round(time_left % 60) diff --git a/code/modules/atmospherics/machinery/air_alarm.dm b/code/modules/atmospherics/machinery/air_alarm.dm index 7b9412ca40f0..8bb68fd1be79 100644 --- a/code/modules/atmospherics/machinery/air_alarm.dm +++ b/code/modules/atmospherics/machinery/air_alarm.dm @@ -523,7 +523,7 @@ GLOBAL_LIST_EMPTY(air_alarms) ui_interact(user) wires.Interact(user) -/obj/machinery/air_alarm/ui_status(mob/user) +/obj/machinery/air_alarm/ui_status(mob/user, datum/ui_state/state) if(isAI(user) && aidisabled) to_chat(user, "AI control has been disabled.") else if(!shorted) @@ -538,7 +538,7 @@ GLOBAL_LIST_EMPTY(air_alarms) ui.set_state(state) ui.open() -/obj/machinery/air_alarm/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/air_alarm/ui_data(mob/user, datum/tgui/ui) . = ..() var/datum/gas_mixture/environment = loc.return_air() .["environment"] = environment.tgui_analyzer_scan(GAS_GROUP_REAGENT | GAS_GROUP_UNKNOWN) @@ -572,7 +572,7 @@ GLOBAL_LIST_EMPTY(air_alarms) . += data //! end -/obj/machinery/air_alarm/ui_static_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/air_alarm/ui_static_data(mob/user, datum/tgui/ui) . = ..() .["gasContext"] = global.gas_data.tgui_gas_context() .["gasTLV"] = tlv_ids @@ -588,7 +588,7 @@ GLOBAL_LIST_EMPTY(air_alarms) data["temperatureTLV"] = tlv_temperature push_ui_data(data = data) -/obj/machinery/air_alarm/ui_act(action, params, datum/tgui/ui) +/obj/machinery/air_alarm/ui_act(action, list/params, datum/tgui/ui) . = ..() if(.) return diff --git a/code/modules/atmospherics/machinery/components/binary_devices/algae_generator_vr.dm b/code/modules/atmospherics/machinery/components/binary_devices/algae_generator_vr.dm index 912826c25079..799768392e2d 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/algae_generator_vr.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/algae_generator_vr.dm @@ -171,7 +171,7 @@ ui = new(user, src, "AlgaeFarm", name) ui.open() -/obj/machinery/atmospherics/component/binary/algae_farm/ui_data(mob/user) +/obj/machinery/atmospherics/component/binary/algae_farm/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["panelOpen"] = panel_open @@ -207,7 +207,7 @@ return data -/obj/machinery/atmospherics/component/binary/algae_farm/ui_act(action, params) +/obj/machinery/atmospherics/component/binary/algae_farm/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/modules/atmospherics/machinery/components/binary_devices/heat_pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/heat_pump.dm index 9f7248f61d89..c82a1c20ac79 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/heat_pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/heat_pump.dm @@ -196,7 +196,7 @@ ui = new(user, src, "heat_pump", name) ui.open() -/obj/machinery/atmospherics/component/binary/heat_pump/ui_data(mob/user) +/obj/machinery/atmospherics/component/binary/heat_pump/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["target_temp"] = target_temp data["current_temp"] = air2.temperature @@ -209,10 +209,10 @@ return data -/obj/machinery/atmospherics/component/binary/heat_pump/ui_state(mob/user, datum/tgui_module/module) +/obj/machinery/atmospherics/component/binary/heat_pump/ui_state() return GLOB.physical_state -/obj/machinery/atmospherics/component/binary/heat_pump/ui_act(action, params) +/obj/machinery/atmospherics/component/binary/heat_pump/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE switch(action) diff --git a/code/modules/atmospherics/machinery/components/binary_devices/massive_gas_pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/massive_gas_pump.dm index 0dc4032904ce..0ac892f84e8f 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/massive_gas_pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/massive_gas_pump.dm @@ -132,7 +132,7 @@ ui.open() //This is the data which will be sent to the ui -/obj/machinery/atmospherics/component/binary/massive_gas_pump/ui_data(mob/user) +/obj/machinery/atmospherics/component/binary/massive_gas_pump/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data = list( @@ -156,7 +156,7 @@ return ui_interact(user) -/obj/machinery/atmospherics/component/binary/massive_gas_pump/ui_act(action, params) +/obj/machinery/atmospherics/component/binary/massive_gas_pump/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/modules/atmospherics/machinery/components/binary_devices/massive_heat_pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/massive_heat_pump.dm index b689c6986e2c..78d367089246 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/massive_heat_pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/massive_heat_pump.dm @@ -165,7 +165,7 @@ ui.open() //This is the data which will be sent to the ui -/obj/machinery/atmospherics/component/binary/massive_heat_pump/ui_data(mob/user) +/obj/machinery/atmospherics/component/binary/massive_heat_pump/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data = list( @@ -192,7 +192,7 @@ return ui_interact(user) -/obj/machinery/atmospherics/component/binary/massive_heat_pump/ui_act(action, params) +/obj/machinery/atmospherics/component/binary/massive_heat_pump/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm b/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm index 5582317ccee3..a93a66e7a0ec 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm @@ -186,7 +186,7 @@ ui.open() //This is the data which will be sent to the ui -/obj/machinery/atmospherics/component/binary/passive_gate/ui_data(mob/user) +/obj/machinery/atmospherics/component/binary/passive_gate/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data = list( @@ -202,7 +202,7 @@ return data -/obj/machinery/atmospherics/component/binary/passive_gate/ui_act(action, params) +/obj/machinery/atmospherics/component/binary/passive_gate/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm index f9742e64dad8..5420eaf6c469 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm @@ -183,7 +183,7 @@ Thus, the two variables affect pump operation are set in New(): ui.open() //This is the data which will be sent to the ui -/obj/machinery/atmospherics/component/binary/pump/ui_data(mob/user) +/obj/machinery/atmospherics/component/binary/pump/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data = list( @@ -240,7 +240,7 @@ Thus, the two variables affect pump operation are set in New(): return ui_interact(user) -/obj/machinery/atmospherics/component/binary/pump/ui_act(action, params) +/obj/machinery/atmospherics/component/binary/pump/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/modules/atmospherics/machinery/components/component.dm b/code/modules/atmospherics/machinery/components/component.dm index 1b095b237cd0..5948abc1c676 100644 --- a/code/modules/atmospherics/machinery/components/component.dm +++ b/code/modules/atmospherics/machinery/components/component.dm @@ -70,15 +70,15 @@ // todo: use a special state to handle multitool hijacking -// /obj/machinery/atmospherics/component/ui_state(mob/user, datum/tgui_module/module) +// /obj/machinery/atmospherics/component/ui_state() // return GLOB.default_state -/obj/machinery/atmospherics/component/ui_static_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/atmospherics/component/ui_static_data(mob/user, datum/tgui/ui) . = ..() .["powerRating"] = power_maximum .["controlFlags"] = atmos_component_ui_flags -/obj/machinery/atmospherics/component/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/atmospherics/component/ui_data(mob/user, datum/tgui/ui) . = ..() if(!tgui_interface) return diff --git a/code/modules/atmospherics/machinery/components/omni_devices/filter.dm b/code/modules/atmospherics/machinery/components/omni_devices/filter.dm index 09ec71b720cf..a9e9720d729f 100644 --- a/code/modules/atmospherics/machinery/components/omni_devices/filter.dm +++ b/code/modules/atmospherics/machinery/components/omni_devices/filter.dm @@ -96,7 +96,7 @@ ui.open() -/obj/machinery/atmospherics/component/quaternary/atmos_filter/ui_data(mob/user) +/obj/machinery/atmospherics/component/quaternary/atmos_filter/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["power"] = use_power @@ -150,7 +150,7 @@ else return null -/obj/machinery/atmospherics/component/quaternary/atmos_filter/ui_act(action, params) +/obj/machinery/atmospherics/component/quaternary/atmos_filter/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/modules/atmospherics/machinery/components/omni_devices/mixer.dm b/code/modules/atmospherics/machinery/components/omni_devices/mixer.dm index ee481208f058..b91f390752e2 100644 --- a/code/modules/atmospherics/machinery/components/omni_devices/mixer.dm +++ b/code/modules/atmospherics/machinery/components/omni_devices/mixer.dm @@ -130,7 +130,7 @@ ui = new(user, src, "OmniMixer", name) ui.open() -/obj/machinery/atmospherics/component/quaternary/mixer/ui_data(mob/user) +/obj/machinery/atmospherics/component/quaternary/mixer/ui_data(mob/user, datum/tgui/ui) var/list/data = new() data["power"] = use_power @@ -163,7 +163,7 @@ return data -/obj/machinery/atmospherics/component/quaternary/mixer/ui_act(action, params) +/obj/machinery/atmospherics/component/quaternary/mixer/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm index cd89e667103d..9b4494fb2e4c 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm @@ -71,17 +71,17 @@ /obj/machinery/atmospherics/component/trinary/filter/proc/set_rate(liters) flow_setting = clamp(liters, 0, air1.volume) -/obj/machinery/atmospherics/component/trinary/filter/ui_data(mob/user) +/obj/machinery/atmospherics/component/trinary/filter/ui_data(mob/user, datum/tgui/ui) . = ..() .["filtering"] = filtering .["maxRate"] = air1.volume .["rate"] = flow_setting -/obj/machinery/atmospherics/component/trinary/filter/ui_static_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/atmospherics/component/trinary/filter/ui_static_data(mob/user, datum/tgui/ui) . = ..() .["atmosContext"] = global.gas_data.tgui_gas_context() -/obj/machinery/atmospherics/component/trinary/filter/ui_act(action, params) +/obj/machinery/atmospherics/component/trinary/filter/ui_act(action, list/params, datum/tgui/ui) . = ..() if(.) return diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm index c0f8e340a368..3d096b613794 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm @@ -83,7 +83,7 @@ ui = new(user, src, "AtmosMixer", name) ui.open() -/obj/machinery/atmospherics/component/trinary/mixer/ui_data(mob/user) +/obj/machinery/atmospherics/component/trinary/mixer/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["on"] = use_power data["set_pressure"] = round(set_flow_rate) @@ -100,7 +100,7 @@ return ui_interact(user) -/obj/machinery/atmospherics/component/trinary/mixer/ui_act(action, params) +/obj/machinery/atmospherics/component/trinary/mixer/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/molar_filter.dm b/code/modules/atmospherics/machinery/components/trinary_devices/molar_filter.dm index fd7bafa66c41..9075c54bb305 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/molar_filter.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/molar_filter.dm @@ -69,7 +69,7 @@ /obj/machinery/atmospherics/component/trinary/molar_filter/proc/set_rate(liters) flow_setting = clamp(liters, 0, air1.volume) -/obj/machinery/atmospherics/component/trinary/molar_filter/ui_data(mob/user) +/obj/machinery/atmospherics/component/trinary/molar_filter/ui_data(mob/user, datum/tgui/ui) . = ..() .["lower"] = mass_lower .["upper"] = mass_upper @@ -77,7 +77,7 @@ .["maxRate"] = air1.volume .["rate"] = flow_setting -/obj/machinery/atmospherics/component/trinary/molar_filter/ui_act(action, params) +/obj/machinery/atmospherics/component/trinary/molar_filter/ui_act(action, list/params, datum/tgui/ui) . = ..() if(.) return diff --git a/code/modules/atmospherics/machinery/components/unary/cold_sink.dm b/code/modules/atmospherics/machinery/components/unary/cold_sink.dm index 96f174187295..e0df0c43d522 100644 --- a/code/modules/atmospherics/machinery/components/unary/cold_sink.dm +++ b/code/modules/atmospherics/machinery/components/unary/cold_sink.dm @@ -68,7 +68,7 @@ ui = new(user, src, "GasTemperatureSystem", name) ui.open() -/obj/machinery/atmospherics/component/unary/freezer/ui_data(mob/user) +/obj/machinery/atmospherics/component/unary/freezer/ui_data(mob/user, datum/tgui/ui) // this is the data which will be sent to the ui var/data[0] data["on"] = use_power ? 1 : 0 @@ -88,7 +88,7 @@ return data -/obj/machinery/atmospherics/component/unary/freezer/ui_act(action, params) +/obj/machinery/atmospherics/component/unary/freezer/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/modules/atmospherics/machinery/components/unary/heat_source.dm b/code/modules/atmospherics/machinery/components/unary/heat_source.dm index 4e37184dbdc2..1e3a14a325c5 100644 --- a/code/modules/atmospherics/machinery/components/unary/heat_source.dm +++ b/code/modules/atmospherics/machinery/components/unary/heat_source.dm @@ -82,7 +82,7 @@ ui = new(user, src, "GasTemperatureSystem", name) ui.open() -/obj/machinery/atmospherics/component/unary/heater/ui_data(mob/user) +/obj/machinery/atmospherics/component/unary/heater/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["on"] = use_power ? 1 : 0 @@ -100,7 +100,7 @@ return data -/obj/machinery/atmospherics/component/unary/heater/ui_act(action, params) +/obj/machinery/atmospherics/component/unary/heater/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/modules/atmospherics/machinery/components/unary/outlet_injector.dm b/code/modules/atmospherics/machinery/components/unary/outlet_injector.dm index 4314a1d5a4de..22662a5f222a 100644 --- a/code/modules/atmospherics/machinery/components/unary/outlet_injector.dm +++ b/code/modules/atmospherics/machinery/components/unary/outlet_injector.dm @@ -102,14 +102,14 @@ ui = new(user, src, "AtmosPump", name) ui.open() -/obj/machinery/atmospherics/component/unary/outlet_injector/ui_data() +/obj/machinery/atmospherics/component/unary/outlet_injector/ui_data(mob/user, datum/tgui/ui) var/data = list() data["on"] = injecting data["rate"] = round(volume_rate) data["max_rate"] = round(air_contents.volume) return data -/obj/machinery/atmospherics/component/unary/outlet_injector/ui_act(action, params) +/obj/machinery/atmospherics/component/unary/outlet_injector/ui_act(action, list/params, datum/tgui/ui) if(..()) return diff --git a/code/modules/atmospherics/machinery/components/unary/vent_pump.dm b/code/modules/atmospherics/machinery/components/unary/vent_pump.dm index 086b243e4b84..43fccbf9b744 100644 --- a/code/modules/atmospherics/machinery/components/unary/vent_pump.dm +++ b/code/modules/atmospherics/machinery/components/unary/vent_pump.dm @@ -312,7 +312,7 @@ ui = new(user, src, "AtmosVentPump") ui.open() -/obj/machinery/atmospherics/component/unary/vent_pump/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/atmospherics/component/unary/vent_pump/ui_data(mob/user, datum/tgui/ui) . = ..() .["state"] = ui_vent_data() .["name"] = name diff --git a/code/modules/atmospherics/machinery/components/unary/vent_scrubber.dm b/code/modules/atmospherics/machinery/components/unary/vent_scrubber.dm index 2a5bce6b6b3a..16e68c169514 100644 --- a/code/modules/atmospherics/machinery/components/unary/vent_scrubber.dm +++ b/code/modules/atmospherics/machinery/components/unary/vent_scrubber.dm @@ -318,11 +318,11 @@ scrub_groups ^= target return TRUE -/obj/machinery/atmospherics/component/unary/vent_scrubber/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/atmospherics/component/unary/vent_scrubber/ui_data(mob/user, datum/tgui/ui) . = ..() .["state"] = ui_scrubber_data() -/obj/machinery/atmospherics/component/unary/vent_scrubber/ui_static_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/atmospherics/component/unary/vent_scrubber/ui_static_data(mob/user, datum/tgui/ui) . = ..() .["gasContext"] = global.gas_data.tgui_gas_context() .["name"] = name diff --git a/code/modules/atmospherics/machinery/portable/area_atmos_computer.dm b/code/modules/atmospherics/machinery/portable/area_atmos_computer.dm index e4ea08ae3daf..b7f1e566ce16 100644 --- a/code/modules/atmospherics/machinery/portable/area_atmos_computer.dm +++ b/code/modules/atmospherics/machinery/portable/area_atmos_computer.dm @@ -34,7 +34,7 @@ ui = new(user, src, "AreaScrubberControl", name) ui.open() -/obj/machinery/computer/area_atmos/ui_data(mob/user) +/obj/machinery/computer/area_atmos/ui_data(mob/user, datum/tgui/ui) var/list/working = list() for(var/id in connectedscrubbers) var/obj/machinery/portable_atmospherics/powered/scrubber/huge/scrubber = connectedscrubbers[id] @@ -53,7 +53,7 @@ return list("scrubbers" = working) -/obj/machinery/computer/area_atmos/ui_act(action, params) +/obj/machinery/computer/area_atmos/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/modules/atmospherics/machinery/portable/canister.dm b/code/modules/atmospherics/machinery/portable/canister.dm index d1b24dcbde76..2aa49452e0ef 100644 --- a/code/modules/atmospherics/machinery/portable/canister.dm +++ b/code/modules/atmospherics/machinery/portable/canister.dm @@ -299,7 +299,7 @@ update_flag /obj/machinery/portable_atmospherics/canister/attack_hand(mob/user, list/params) return src.ui_interact(user) -/obj/machinery/portable_atmospherics/canister/ui_state(mob/user, datum/tgui_module/module) +/obj/machinery/portable_atmospherics/canister/ui_state() return GLOB.physical_state /obj/machinery/portable_atmospherics/canister/ui_interact(mob/user, datum/tgui/ui) @@ -308,7 +308,7 @@ update_flag ui = new(user, src, "Canister", name) ui.open() -/obj/machinery/portable_atmospherics/canister/ui_static_data(mob/user) +/obj/machinery/portable_atmospherics/canister/ui_static_data(mob/user, datum/tgui/ui) return list( "defaultReleasePressure" = round(CAN_DEFAULT_RELEASE_PRESSURE), "minReleasePressure" = round(can_min_release_pressure), @@ -318,7 +318,7 @@ update_flag "holdingTankFragPressure" = round(TANK_FRAGMENT_PRESSURE) ) -/obj/machinery/portable_atmospherics/canister/ui_data() +/obj/machinery/portable_atmospherics/canister/ui_data(mob/user, datum/tgui/ui) . = list( "portConnected" = !!connected_port, "tankPressure" = round(air_contents.return_pressure()), @@ -347,7 +347,7 @@ update_flag ) ) -/obj/machinery/portable_atmospherics/canister/ui_act(action, params) +/obj/machinery/portable_atmospherics/canister/ui_act(action, list/params, datum/tgui/ui) . = ..() if(.) return diff --git a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm index 056f5d25cd6a..07e76b1e7ed7 100644 --- a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm +++ b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm @@ -86,13 +86,13 @@ ui = new(user, src, tgui_interface) ui.open() -/obj/machinery/portable_atmospherics/ui_static_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/portable_atmospherics/ui_static_data(mob/user, datum/tgui/ui) . = ..() .["controlFlags"] = atmos_portable_ui_flags .["useCharge"] = FALSE .["flowMax"] = flow_maximum -/obj/machinery/portable_atmospherics/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/portable_atmospherics/ui_data(mob/user, datum/tgui/ui) . = ..() .["flow"] = flow_current .["flowSetting"] = flow_setting diff --git a/code/modules/atmospherics/machinery/portable/powered.dm b/code/modules/atmospherics/machinery/portable/powered.dm index 9fcc1a04732f..f84ae88b01dd 100644 --- a/code/modules/atmospherics/machinery/portable/powered.dm +++ b/code/modules/atmospherics/machinery/portable/powered.dm @@ -30,14 +30,14 @@ return 1 return 0 -/obj/machinery/portable_atmospherics/powered/ui_static_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/portable_atmospherics/powered/ui_static_data(mob/user, datum/tgui/ui) . = ..() .["useCharge"] = TRUE .["maxCharge"] = isnull(cell)? 0 : cell.maxcharge .["powerRating"] = power_maximum .["useCell"] = use_cell -/obj/machinery/portable_atmospherics/powered/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/portable_atmospherics/powered/ui_data(mob/user, datum/tgui/ui) . = ..() .["charge"] = isnull(cell)? 0 : cell.charge if(atmos_portable_ui_flags & (ATMOS_PORTABLE_UI_SEE_POWER | ATMOS_PORTABLE_UI_SET_POWER)) diff --git a/code/modules/atmospherics/machinery/portable/pump.dm b/code/modules/atmospherics/machinery/portable/pump.dm index deb7c648c979..e3fea77858f7 100644 --- a/code/modules/atmospherics/machinery/portable/pump.dm +++ b/code/modules/atmospherics/machinery/portable/pump.dm @@ -113,10 +113,10 @@ ui.open() -/obj/machinery/portable_atmospherics/powered/pump/ui_state(mob/user, datum/tgui_module/module) +/obj/machinery/portable_atmospherics/powered/pump/ui_state() return GLOB.physical_state -/obj/machinery/portable_atmospherics/powered/pump/ui_data(mob/user) +/obj/machinery/portable_atmospherics/powered/pump/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["on"] = on ? TRUE : FALSE @@ -142,7 +142,7 @@ return data -/obj/machinery/portable_atmospherics/powered/pump/ui_act(action, params) +/obj/machinery/portable_atmospherics/powered/pump/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/modules/atmospherics/machinery/portable/scrubber.dm b/code/modules/atmospherics/machinery/portable/scrubber.dm index b62aa7494e32..9db12e6bd6bb 100644 --- a/code/modules/atmospherics/machinery/portable/scrubber.dm +++ b/code/modules/atmospherics/machinery/portable/scrubber.dm @@ -55,17 +55,17 @@ //! LEGACY ABOVE -/obj/machinery/portable_atmospherics/powered/scrubber/ui_static_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/portable_atmospherics/powered/scrubber/ui_static_data(mob/user, datum/tgui/ui) . = ..() .["atmosContext"] = global.gas_data.tgui_gas_context() .["scrubbingIds"] = scrubbing_ids .["scrubbingGroups"] = scrubbing_groups -/obj/machinery/portable_atmospherics/powered/scrubber/ui_data(mob/user) +/obj/machinery/portable_atmospherics/powered/scrubber/ui_data(mob/user, datum/tgui/ui) . = ..() .["moleRate"] = transfer_current -/obj/machinery/portable_atmospherics/powered/scrubber/ui_act(action, params) +/obj/machinery/portable_atmospherics/powered/scrubber/ui_act(action, list/params, datum/tgui/ui) . = ..() if(.) return diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm index bbc85354d316..9daabd9d104f 100644 --- a/code/modules/client/client_procs.dm +++ b/code/modules/client/client_procs.dm @@ -74,7 +74,7 @@ // Tgui Topic middleware - if(tgui_Topic(href_list)) + if(tgui_topic(href_list)) if(CONFIG_GET(flag/emergency_tgui_logging)) log_href("[src] (usr:[usr]\[[COORD(usr)]\]) : [hsrc ? "[hsrc] " : ""][href]") return diff --git a/code/modules/client/client_data.dm b/code/modules/client/data/client_data.dm similarity index 97% rename from code/modules/client/client_data.dm rename to code/modules/client/data/client_data.dm index 056317a2c602..280ead576af6 100644 --- a/code/modules/client/client_data.dm +++ b/code/modules/client/data/client_data.dm @@ -13,9 +13,6 @@ GLOBAL_LIST_EMPTY(client_data) * client data datums, to hold * round-based data that we don't want wiped * by a disconnect. - * - * this can absolutely contain player specific data, especially if we don't - * want to reload it every connect. */ /datum/client_data /// owner ckey @@ -68,6 +65,44 @@ GLOBAL_LIST_EMPTY(client_data) log_shadowban("[ckey] autobanned based on [why].") message_admins(SPAN_DANGER("Automatically shadowbanning [ckey] based on configuration (matched on [why]). Varedit client.persistent.ligma to change this.")) +/datum/client_data/proc/block_on_account_age_loaded(timeout = INFINITY) + var/timed_out = world.time + timeout + UNTIL(!isnull(account_age) || world.time > timed_out) + return account_age + +/datum/client_data/proc/load_account_age() + if(is_guest) + account_age = 0 + return + var/list/http = world.Export("http://byond.com/members/[ckey]?format=text") + if(!http) + log_world("Failed to connect to byond age check for [ckey]") + return + var/F = file2text(http["CONTENT"]) + . = null + if(F) + // year-month-day + var/regex/R = regex("joined = \"(\\d{4}-\\d{2}-\\d{2})\"") + if(R.Find(F)) + var/str = R.group[1] + account_join = str + if(!SSdbcore.Connect()) + account_age = null + return + var/datum/db_query/query = SSdbcore.RunQuery( + "SELECT DATEDIFF(Now(), :date)", + list( + "date" = str, + ) + ) + if(query.NextRow()) + . = text2num(query.item[1]) + else + CRASH("Age check regex failed for [src.ckey]") + account_age = . + +//* External - Playtime *// + /datum/client_data/proc/load_playtime() set waitfor = FALSE if(playtime_loaded) @@ -112,39 +147,3 @@ GLOBAL_LIST_EMPTY(client_data) var/timed_out = world.time + timeout load_playtime() UNTIL(playtime_loaded || world.time > timed_out) - -/datum/client_data/proc/block_on_account_age_loaded(timeout = INFINITY) - var/timed_out = world.time + timeout - UNTIL(!isnull(account_age) || world.time > timed_out) - return account_age - -/datum/client_data/proc/load_account_age() - if(is_guest) - account_age = 0 - return - var/list/http = world.Export("http://byond.com/members/[ckey]?format=text") - if(!http) - log_world("Failed to connect to byond age check for [ckey]") - return - var/F = file2text(http["CONTENT"]) - . = null - if(F) - // year-month-day - var/regex/R = regex("joined = \"(\\d{4}-\\d{2}-\\d{2})\"") - if(R.Find(F)) - var/str = R.group[1] - account_join = str - if(!SSdbcore.Connect()) - account_age = null - return - var/datum/db_query/query = SSdbcore.RunQuery( - "SELECT DATEDIFF(Now(), :date)", - list( - "date" = str, - ) - ) - if(query.NextRow()) - . = text2num(query.item[1]) - else - CRASH("Age check regex failed for [src.ckey]") - account_age = . diff --git a/code/modules/client/player_data.dm b/code/modules/client/data/player_data.dm similarity index 98% rename from code/modules/client/player_data.dm rename to code/modules/client/data/player_data.dm index 51f18a385f37..b66b1f7ab374 100644 --- a/code/modules/client/player_data.dm +++ b/code/modules/client/data/player_data.dm @@ -1,3 +1,5 @@ +// todo: this has to be globally cached for new admin panel + /** * holds db-related data * loaded every connect diff --git a/code/modules/client/onboarding/age_verification.dm b/code/modules/client/onboarding/age_verification.dm index 9f85b5f0416b..b462ed39edaa 100644 --- a/code/modules/client/onboarding/age_verification.dm +++ b/code/modules/client/onboarding/age_verification.dm @@ -40,7 +40,7 @@ GLOBAL_DATUM_INIT(age_verify_menu, /datum/age_verify_menu, new) ui = new(user, src, "AgeVerifyMenu") ui.open() -/datum/age_verify_menu/ui_status(mob/user, datum/ui_state/state, datum/tgui_module/module) +/datum/age_verify_menu/ui_status(mob/user, datum/ui_state/state) return UI_INTERACTIVE /datum/age_verify_menu/ui_act(action, list/params, datum/tgui/ui) diff --git a/code/modules/detectivework/microscope/dnascanner.dm b/code/modules/detectivework/microscope/dnascanner.dm index 23106071b3f3..58699c567182 100644 --- a/code/modules/detectivework/microscope/dnascanner.dm +++ b/code/modules/detectivework/microscope/dnascanner.dm @@ -59,7 +59,7 @@ ui.open() -/obj/machinery/dnaforensics/ui_data(mob/user) +/obj/machinery/dnaforensics/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["scan_progress"] = round(scanner_progress) @@ -70,7 +70,7 @@ return data -/obj/machinery/dnaforensics/ui_act(action, list/params) +/obj/machinery/dnaforensics/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/modules/economy/machines/ATM.dm b/code/modules/economy/machines/ATM.dm index 4da4bb650bc3..e2967158e2c9 100644 --- a/code/modules/economy/machines/ATM.dm +++ b/code/modules/economy/machines/ATM.dm @@ -142,7 +142,7 @@ GLOBAL_LIST_INIT(atm_sounds, list('sound/items/polaroid1.ogg', 'sound/items/pola ui = new(user, src, "ATM", "[machine_id]") ui.open() -/obj/machinery/atm/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/atm/ui_data(mob/user, datum/tgui/ui) . = ..() var/data[0] diff --git a/code/modules/fishing/aquarium/aquarium.dm b/code/modules/fishing/aquarium/aquarium.dm index 6d05d3de5f96..e31e680b5742 100644 --- a/code/modules/fishing/aquarium/aquarium.dm +++ b/code/modules/fishing/aquarium/aquarium.dm @@ -219,7 +219,7 @@ else if(dead_fish > 0) to_chat(user, SPAN_WARNING("The fish are all dead!")) -/obj/structure/aquarium/ui_data(mob/user) +/obj/structure/aquarium/ui_data(mob/user, datum/tgui/ui) . = ..() .["fluid_type"] = fluid_type .["temperature"] = fluid_temp @@ -229,7 +229,7 @@ content_data += list(list("name"=fish.name,"ref"=ref(fish))) .["contents"] = content_data -/obj/structure/aquarium/ui_static_data(mob/user) +/obj/structure/aquarium/ui_static_data(mob/user, datum/tgui/ui) . = ..() //I guess these should depend on the fluid so lava critters can get high or stuff below water freezing point but let's keep it simple for now. .["minTemperature"] = min_fluid_temp diff --git a/code/modules/fishing/equipment/catalog.dm b/code/modules/fishing/equipment/catalog.dm index d67c7130a93d..d8ce1d083f77 100644 --- a/code/modules/fishing/equipment/catalog.dm +++ b/code/modules/fishing/equipment/catalog.dm @@ -14,7 +14,7 @@ ui = new(user, src, "FishCatalog", name) ui.open() -/obj/item/book/fish_catalog/ui_static_data(mob/user) +/obj/item/book/fish_catalog/ui_static_data(mob/user, datum/tgui/ui) . = ..() var/static/fish_info if(!fish_info) diff --git a/code/modules/fishing/equipment/rod.dm b/code/modules/fishing/equipment/rod.dm index 4af1ad639709..017c8a110f98 100644 --- a/code/modules/fishing/equipment/rod.dm +++ b/code/modules/fishing/equipment/rod.dm @@ -310,7 +310,7 @@ return TRUE return ..() -/obj/item/fishing_rod/ui_data(mob/user) +/obj/item/fishing_rod/ui_data(mob/user, datum/tgui/ui) . = ..() var/list/data = list() @@ -343,7 +343,7 @@ return FALSE return TRUE -/obj/item/fishing_rod/ui_act(action, list/params) +/obj/item/fishing_rod/ui_act(action, list/params, datum/tgui/ui) . = ..() if(.) return . diff --git a/code/modules/fishing/minigame/fishing_calculator.dm b/code/modules/fishing/minigame/fishing_calculator.dm index 18614bcd5244..fd7f148e0522 100644 --- a/code/modules/fishing/minigame/fishing_calculator.dm +++ b/code/modules/fishing/minigame/fishing_calculator.dm @@ -21,23 +21,23 @@ ui = new(user, src, "FishingCalculator") ui.open() -/datum/fishing_calculator/ui_state(mob/user) +/datum/fishing_calculator/ui_state() return GLOB.always_state -/datum/fishing_calculator/ui_close(mob/user) +/datum/fishing_calculator/on_ui_close(mob/user, datum/tgui/ui, embedded) qdel(src) -/datum/fishing_calculator/ui_static_data(mob/user) +/datum/fishing_calculator/ui_static_data(mob/user, datum/tgui/ui) . = ..() .["rod_types"] = typesof(/obj/item/fishing_rod) .["hook_types"] = typesof(/obj/item/fishing_hook) .["line_types"] = typesof(/obj/item/fishing_line) .["spot_types"] = subtypesof(/datum/fish_source) -/datum/fishing_calculator/ui_data(mob/user) +/datum/fishing_calculator/ui_data(mob/user, datum/tgui/ui) return list("info" = current_table) -/datum/fishing_calculator/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) +/datum/fishing_calculator/ui_act(action, list/params, datum/tgui/ui) . = ..() var/mob/user = usr switch(action) diff --git a/code/modules/fishing/minigame/fishing_minigame.dm b/code/modules/fishing/minigame/fishing_minigame.dm index 93253ded593f..78a914fd5211 100644 --- a/code/modules/fishing/minigame/fishing_minigame.dm +++ b/code/modules/fishing/minigame/fishing_minigame.dm @@ -155,16 +155,16 @@ ui.set_mouse_hook(TRUE) ui.open() -/datum/fishing_challenge/ui_host(mob/user) +/datum/fishing_challenge/ui_host() return lure //Could be the target really // Manually closing the ui is treated as lose -/datum/fishing_challenge/ui_close(mob/user) +/datum/fishing_challenge/on_ui_close(mob/user, datum/tgui/ui, embedded) . = ..() if(!completed) complete(FALSE) -/datum/fishing_challenge/ui_static_data(mob/user) +/datum/fishing_challenge/ui_static_data(mob/user, datum/tgui/ui) . = ..() .["difficulty"] = max(1,min(difficulty,100)) .["fish_ai"] = fish_ai @@ -180,7 +180,7 @@ ui_status_user_is_abled(user, lure), ) -/datum/fishing_challenge/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) +/datum/fishing_challenge/ui_act(action, list/params, datum/tgui/ui) . = ..() if(.) return diff --git a/code/modules/ghostroles/menu.dm b/code/modules/ghostroles/menu.dm index 14e914526a5f..5d86f3cb84ff 100644 --- a/code/modules/ghostroles/menu.dm +++ b/code/modules/ghostroles/menu.dm @@ -2,7 +2,7 @@ GLOBAL_DATUM_INIT(ghostrole_menu, /datum/ghostrole_menu, new) /datum/ghostrole_menu -/datum/ghostrole_menu/ui_state(mob/user, datum/tgui_module/module) +/datum/ghostrole_menu/ui_state() return GLOB.observer_state /datum/ghostrole_menu/ui_interact(mob/user, datum/tgui/ui) @@ -11,7 +11,7 @@ GLOBAL_DATUM_INIT(ghostrole_menu, /datum/ghostrole_menu, new) ui = new(user, src, "SpawnersMenu") ui.open() -/datum/ghostrole_menu/ui_static_data(mob/user) +/datum/ghostrole_menu/ui_static_data(mob/user, datum/tgui/ui) . = ..() var/list/spawners = list() .["spawners"] = spawners @@ -31,7 +31,7 @@ GLOBAL_DATUM_INIT(ghostrole_menu, /datum/ghostrole_menu, new) data["amount_left"] = slots == INFINITY? -1 : slots spawners += list(data) // wrap -/datum/ghostrole_menu/ui_act(action, params) +/datum/ghostrole_menu/ui_act(action, list/params, datum/tgui/ui) if(..()) return if(!isobserver(usr)) diff --git a/code/modules/guidebook/guidebook.dm b/code/modules/guidebook/guidebook.dm index 357b3d303fd5..6aa92d6e6f1f 100644 --- a/code/modules/guidebook/guidebook.dm +++ b/code/modules/guidebook/guidebook.dm @@ -12,14 +12,14 @@ GLOBAL_DATUM_INIT(guidebook, /datum/guidebook, new) /// open instances mapped to list of ids var/list/opened = list() -/datum/guidebook/ui_state(mob/user, datum/tgui_module/module) +/datum/guidebook/ui_state() return GLOB.always_state -/datum/guidebook/ui_close(mob/user, datum/tgui_module/module) +/datum/guidebook/on_ui_close(mob/user, datum/tgui/ui, embedded) opened -= user return ..() -/datum/guidebook/on_ui_transfer(mob/old_mob, mob/new_mob, datum/tgui/ui) +/datum/guidebook/on_ui_transfer(mob/old_mob, mob/new_mob, datum/tgui/ui, embedded) opened[new_mob] = opened[old_mob] opened -= old_mob return ..() diff --git a/code/modules/hydroponics/seed_machines.dm b/code/modules/hydroponics/seed_machines.dm index 4d8fd05a68af..958072247786 100644 --- a/code/modules/hydroponics/seed_machines.dm +++ b/code/modules/hydroponics/seed_machines.dm @@ -143,7 +143,7 @@ ui = new(user, src, "BotanyIsolator", name) ui.open() -/obj/machinery/botany/extractor/ui_data(mob/user) +/obj/machinery/botany/extractor/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() var/list/geneMasks = SSplants.gene_masked_list @@ -271,7 +271,7 @@ ui = new(user, src, "BotanyEditor", name) ui.open() -/obj/machinery/botany/editor/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/botany/editor/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["activity"] = active diff --git a/code/modules/hydroponics/seed_storage.dm b/code/modules/hydroponics/seed_storage.dm index ec86d7b2155e..2d8ddb5c6885 100644 --- a/code/modules/hydroponics/seed_storage.dm +++ b/code/modules/hydroponics/seed_storage.dm @@ -244,7 +244,7 @@ ui = new(user, src, "SeedStorage", name) ui.open() -/obj/machinery/seed_storage/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/seed_storage/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() if(smart) diff --git a/code/modules/integrated_electronics/core/assemblies.dm b/code/modules/integrated_electronics/core/assemblies.dm index 8f01bafa908d..2a9dc47f3337 100644 --- a/code/modules/integrated_electronics/core/assemblies.dm +++ b/code/modules/integrated_electronics/core/assemblies.dm @@ -153,7 +153,7 @@ return battery // TGUI -/obj/item/electronic_assembly/ui_state(mob/user, datum/tgui_module/module) +/obj/item/electronic_assembly/ui_state() return GLOB.physical_state /obj/item/electronic_assembly/ui_interact(mob/user, datum/tgui/ui, datum/tgui/parent_ui) @@ -162,7 +162,7 @@ ui = new(user, src, "ICAssembly", name, parent_ui) ui.open() -/obj/item/electronic_assembly/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/item/electronic_assembly/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() var/total_parts = 0 diff --git a/code/modules/integrated_electronics/core/detailer.dm b/code/modules/integrated_electronics/core/detailer.dm index 85046f6c44d1..c3a9c4b43c52 100644 --- a/code/modules/integrated_electronics/core/detailer.dm +++ b/code/modules/integrated_electronics/core/detailer.dm @@ -35,7 +35,7 @@ detail_overlay.color = detail_color add_overlay(detail_overlay) -/obj/item/integrated_electronics/detailer/ui_state(mob/user, datum/tgui_module/module) +/obj/item/integrated_electronics/detailer/ui_state() return GLOB.inventory_state /obj/item/integrated_electronics/detailer/ui_interact(mob/user, datum/tgui/ui, datum/tgui/parent_ui) @@ -44,7 +44,7 @@ ui = new(user, src, "ICDetailer", name) ui.open() -/obj/item/integrated_electronics/detailer/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/item/integrated_electronics/detailer/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["detail_color"] = detail_color data["color_list"] = color_list diff --git a/code/modules/integrated_electronics/core/integrated_circuit.dm b/code/modules/integrated_electronics/core/integrated_circuit.dm index 9e5dd206b690..8786d1a7011b 100644 --- a/code/modules/integrated_electronics/core/integrated_circuit.dm +++ b/code/modules/integrated_electronics/core/integrated_circuit.dm @@ -125,10 +125,10 @@ a creative player the means to solve many problems. Circuits are held inside an to_chat(M, SPAN_NOTICE("The circuit '[src.name]' is now labeled '[input]'.")) displayed_name = input -/obj/item/integrated_circuit/ui_state(mob/user, datum/tgui_module/module) +/obj/item/integrated_circuit/ui_state() return GLOB.physical_state -/obj/item/integrated_circuit/ui_host(mob/user, datum/tgui_module/module) +/obj/item/integrated_circuit/ui_host() if(istype(loc, /obj/item/electronic_assembly)) return loc.ui_host() return ..() @@ -139,7 +139,7 @@ a creative player the means to solve many problems. Circuits are held inside an ui = new(user, src, "ICCircuit", name, parent_ui) ui.open() -/obj/item/integrated_circuit/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/item/integrated_circuit/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["name"] = name diff --git a/code/modules/integrated_electronics/core/printer.dm b/code/modules/integrated_electronics/core/printer.dm index 1b33e1f4d06e..44a7e43c0145 100644 --- a/code/modules/integrated_electronics/core/printer.dm +++ b/code/modules/integrated_electronics/core/printer.dm @@ -176,7 +176,7 @@ return ui_interact(user) -/obj/item/integrated_circuit_printer/ui_state(mob/user, datum/tgui_module/module) +/obj/item/integrated_circuit_printer/ui_state() return GLOB.physical_state /obj/item/integrated_circuit_printer/ui_interact(mob/user, datum/tgui/ui) @@ -189,7 +189,7 @@ ui = new(user, src, "ICPrinter", name) // 500, 600 ui.open() -/obj/item/integrated_circuit_printer/ui_static_data(mob/user) +/obj/item/integrated_circuit_printer/ui_static_data(mob/user, datum/tgui/ui) var/list/data = ..() var/list/categories = list() @@ -233,7 +233,7 @@ return data -/obj/item/integrated_circuit_printer/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/item/integrated_circuit_printer/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["metal"] = cur_metal diff --git a/code/modules/media/walkpod.dm b/code/modules/media/walkpod.dm index 139f199fda33..72b18113818c 100644 --- a/code/modules/media/walkpod.dm +++ b/code/modules/media/walkpod.dm @@ -171,7 +171,7 @@ ui = new(user, src, "Jukebox", "PodZu Music Player") ui.open() -/obj/item/device/walkpod/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/item/device/walkpod/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["playing"] = playing @@ -193,7 +193,7 @@ return data -/obj/item/device/walkpod/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) +/obj/item/device/walkpod/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/modules/mob/characteristics/ui.dm b/code/modules/mob/characteristics/ui.dm index 2f4823d9066c..2a1289597fab 100644 --- a/code/modules/mob/characteristics/ui.dm +++ b/code/modules/mob/characteristics/ui.dm @@ -3,9 +3,9 @@ /datum/characteristics_holder/ui_act(action, list/params, datum/tgui/ui) . = ..() -/datum/characteristics_holder/ui_static_data(mob/user) +/datum/characteristics_holder/ui_static_data(mob/user, datum/tgui/ui) . = ..() -/datum/characteristics_holder/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/datum/characteristics_holder/ui_data(mob/user, datum/tgui/ui) . = ..() diff --git a/code/modules/mob/living/bot/cleanbot.dm b/code/modules/mob/living/bot/cleanbot.dm index ff5233c93df0..08b8d8664cc6 100644 --- a/code/modules/mob/living/bot/cleanbot.dm +++ b/code/modules/mob/living/bot/cleanbot.dm @@ -149,7 +149,7 @@ ui = new(user, src, "Cleanbot", name) ui.open() -/mob/living/bot/cleanbot/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/mob/living/bot/cleanbot/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["on"] = on data["open"] = open diff --git a/code/modules/mob/living/bot/edCLNbot.dm b/code/modules/mob/living/bot/edCLNbot.dm index e136b78e1136..86ad18ba4fe8 100644 --- a/code/modules/mob/living/bot/edCLNbot.dm +++ b/code/modules/mob/living/bot/edCLNbot.dm @@ -81,7 +81,7 @@ qdel(src) return -/mob/living/bot/cleanbot/edCLN/ui_data(mob/user) +/mob/living/bot/cleanbot/edCLN/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["version"] = "v3.0" data["rgbpanel"] = TRUE diff --git a/code/modules/mob/living/bot/farmbot.dm b/code/modules/mob/living/bot/farmbot.dm index 78ad53957f1c..368a1ccc4861 100644 --- a/code/modules/mob/living/bot/farmbot.dm +++ b/code/modules/mob/living/bot/farmbot.dm @@ -42,7 +42,7 @@ ui = new(user, src, "Farmbot", name) ui.open() -/mob/living/bot/farmbot/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/mob/living/bot/farmbot/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["on"] = on diff --git a/code/modules/mob/living/bot/floorbot.dm b/code/modules/mob/living/bot/floorbot.dm index 5774345a8e81..211c434951a3 100644 --- a/code/modules/mob/living/bot/floorbot.dm +++ b/code/modules/mob/living/bot/floorbot.dm @@ -65,7 +65,7 @@ ui = new(user, src, "Floorbot", name) ui.open() -/mob/living/bot/floorbot/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/mob/living/bot/floorbot/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["on"] = on diff --git a/code/modules/mob/living/bot/medibot.dm b/code/modules/mob/living/bot/medibot.dm index 4c180701c351..bc25e6d098d8 100644 --- a/code/modules/mob/living/bot/medibot.dm +++ b/code/modules/mob/living/bot/medibot.dm @@ -268,7 +268,7 @@ ui = new(user, src, "Medibot", name) ui.open() -/mob/living/bot/medibot/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/mob/living/bot/medibot/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["on"] = on data["open"] = open diff --git a/code/modules/mob/living/bot/mulebot.dm b/code/modules/mob/living/bot/mulebot.dm index 44284820f858..ceeea75368c3 100644 --- a/code/modules/mob/living/bot/mulebot.dm +++ b/code/modules/mob/living/bot/mulebot.dm @@ -79,7 +79,7 @@ ui = new(user, src, "MuleBot", "Mulebot [suffix ? "([suffix])" : ""]") ui.open() -/mob/living/bot/mulebot/ui_data(mob/user) +/mob/living/bot/mulebot/ui_data(mob/user, datum/tgui/ui) var/list/data = list( "suffix" = suffix, "power" = on, @@ -93,7 +93,7 @@ ) return data -/mob/living/bot/mulebot/ui_act(action, params) +/mob/living/bot/mulebot/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/modules/mob/living/bot/secbot.dm b/code/modules/mob/living/bot/secbot.dm index e2957d985c8f..da0e584d1f61 100644 --- a/code/modules/mob/living/bot/secbot.dm +++ b/code/modules/mob/living/bot/secbot.dm @@ -138,7 +138,7 @@ ui = new(user, src, "Secbot", name) ui.open() -/mob/living/bot/secbot/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/mob/living/bot/secbot/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["on"] = on diff --git a/code/modules/mob/living/silicon/robot/drone/drone_console.dm b/code/modules/mob/living/silicon/robot/drone/drone_console.dm index edc82f84704c..e11d2eab337b 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone_console.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone_console.dm @@ -14,7 +14,7 @@ /obj/machinery/computer/drone_control/attack_ai(var/mob/user as mob) return src.attack_hand(user) -/obj/machinery/computer/drone_control/ui_status(mob/user) +/obj/machinery/computer/drone_control/ui_status(mob/user, datum/ui_state/state) if(!allowed(user)) return UI_CLOSE return ..() @@ -31,7 +31,7 @@ ui = new(user, src, "DroneConsole", name) ui.open() -/obj/machinery/computer/drone_control/ui_data(mob/user) +/obj/machinery/computer/drone_control/ui_data(mob/user, datum/tgui/ui) var/list/data = list() var/list/drones = list() @@ -59,7 +59,7 @@ return data -/obj/machinery/computer/drone_control/ui_act(action, params) +/obj/machinery/computer/drone_control/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/modules/mob/new_player/join_menu.dm b/code/modules/mob/new_player/join_menu.dm index 7504ad42ab39..434213414763 100644 --- a/code/modules/mob/new_player/join_menu.dm +++ b/code/modules/mob/new_player/join_menu.dm @@ -14,10 +14,10 @@ GLOBAL_DATUM_INIT(join_menu, /datum/join_menu, new) /datum/join_menu/proc/queue_update() addtimer(CALLBACK(src, TYPE_PROC_REF(/datum, update_static_data)), 0, TIMER_UNIQUE | TIMER_OVERRIDE) -/datum/join_menu/ui_state(mob/user, datum/tgui_module/module) +/datum/join_menu/ui_state() return GLOB.explicit_new_player_state -/datum/join_menu/ui_static_data(mob/user) +/datum/join_menu/ui_static_data(mob/user, datum/tgui/ui) var/list/data = ..() // every entry will have: // - faction @@ -89,7 +89,7 @@ GLOBAL_DATUM_INIT(join_menu, /datum/join_menu, new) ghostroles += list(ghostrole_data) // wrap list return data -/datum/join_menu/ui_data(mob/user) +/datum/join_menu/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() // common info goes into ui data var/level = "green" diff --git a/code/modules/mob/observer/dead/orbit.dm b/code/modules/mob/observer/dead/orbit.dm index 51c04a647a40..512c6ea7bc28 100644 --- a/code/modules/mob/observer/dead/orbit.dm +++ b/code/modules/mob/observer/dead/orbit.dm @@ -6,7 +6,7 @@ qdel(src) owner = new_owner -/datum/orbit_menu/ui_state(mob/user) +/datum/orbit_menu/ui_state() return GLOB.observer_state /datum/orbit_menu/ui_interact(mob/user, datum/tgui/ui) @@ -15,7 +15,7 @@ ui = new(user, src, "Orbit") ui.open() -/datum/orbit_menu/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) +/datum/orbit_menu/ui_act(action, list/params, datum/tgui/ui) . = ..() if(.) return @@ -35,7 +35,7 @@ update_static_data() . = TRUE -/datum/orbit_menu/ui_static_data(mob/user) +/datum/orbit_menu/ui_static_data(mob/user, datum/tgui/ui) var/list/data = list() var/list/players = list() diff --git a/code/modules/modular_computers/computers/modular_computer/ui.dm b/code/modules/modular_computers/computers/modular_computer/ui.dm index 8affd6852890..2ae564ead147 100644 --- a/code/modules/modular_computers/computers/modular_computer/ui.dm +++ b/code/modules/modular_computers/computers/modular_computer/ui.dm @@ -33,7 +33,7 @@ ui.set_autoupdate(TRUE) ui.open() -/obj/item/modular_computer/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/item/modular_computer/ui_data(mob/user, datum/tgui/ui) var/list/data = get_header_data() data["login"] = list() @@ -76,7 +76,7 @@ return data // Handles user's GUI input -/obj/item/modular_computer/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) +/obj/item/modular_computer/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/modules/modular_computers/file_system/program.dm b/code/modules/modular_computers/file_system/program.dm index 3e0b98ee803f..ff1c41b2f6ba 100644 --- a/code/modules/modular_computers/file_system/program.dm +++ b/code/modules/modular_computers/file_system/program.dm @@ -167,9 +167,13 @@ ui = SStgui.try_update_ui(user, src, ui) if(!ui && tgui_id) ui = new(user, src, tgui_id, filedesc) + ui_pre_open(ui) ui.open() return 1 +/datum/computer_file/program/proc/ui_pre_open(datum/tgui/ui) + return + // CONVENTIONS, READ THIS WHEN CREATING NEW PROGRAM AND OVERRIDING THIS PROC: // Topic calls are automagically forwarded from NanoModule this program contains. // Calls beginning with "PRG_" are reserved for programs handling. @@ -186,7 +190,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) if(..()) return 1 if(computer) diff --git a/code/modules/modular_computers/file_system/programs/antagonist/access_decrypter.dm b/code/modules/modular_computers/file_system/programs/antagonist/access_decrypter.dm index 959ee3ee2184..e4312cdb1554 100644 --- a/code/modules/modular_computers/file_system/programs/antagonist/access_decrypter.dm +++ b/code/modules/modular_computers/file_system/programs/antagonist/access_decrypter.dm @@ -77,7 +77,7 @@ ntnet_global.intrusion_detection_alarm = TRUE return TRUE -/datum/computer_file/program/access_decrypter/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/datum/computer_file/program/access_decrypter/ui_data(mob/user, datum/tgui/ui) if(!ntnet_global) return var/list/data = get_header_data() diff --git a/code/modules/modular_computers/file_system/programs/antagonist/dos.dm b/code/modules/modular_computers/file_system/programs/antagonist/dos.dm index a329f183466a..3d61fe057e55 100644 --- a/code/modules/modular_computers/file_system/programs/antagonist/dos.dm +++ b/code/modules/modular_computers/file_system/programs/antagonist/dos.dm @@ -40,7 +40,7 @@ ..(forced) -/datum/computer_file/program/ntnet_dos/ui_data(mob/user) +/datum/computer_file/program/ntnet_dos/ui_data(mob/user, datum/tgui/ui) if(!ntnet_global) return @@ -62,7 +62,7 @@ return data -/datum/computer_file/program/ntnet_dos/ui_act(action, params) +/datum/computer_file/program/ntnet_dos/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE switch(action) diff --git a/code/modules/modular_computers/file_system/programs/antagonist/revelation.dm b/code/modules/modular_computers/file_system/programs/antagonist/revelation.dm index 595c79f6cfd2..b9d379f2cd17 100644 --- a/code/modules/modular_computers/file_system/programs/antagonist/revelation.dm +++ b/code/modules/modular_computers/file_system/programs/antagonist/revelation.dm @@ -37,7 +37,7 @@ if(computer.tesla_link && prob(50)) qdel(computer.tesla_link) -/datum/computer_file/program/revelation/ui_act(action, params) +/datum/computer_file/program/revelation/ui_act(action, list/params, datum/tgui/ui) if(..()) return switch(action) @@ -59,7 +59,7 @@ temp.armed = armed return temp -/datum/computer_file/program/revelation/ui_data(mob/user) +/datum/computer_file/program/revelation/ui_data(mob/user, datum/tgui/ui) var/list/data = get_header_data() data["armed"] = armed diff --git a/code/modules/modular_computers/file_system/programs/command/card.dm b/code/modules/modular_computers/file_system/programs/command/card.dm index 3036fab9d87a..78f9e82325c1 100644 --- a/code/modules/modular_computers/file_system/programs/command/card.dm +++ b/code/modules/modular_computers/file_system/programs/command/card.dm @@ -18,21 +18,17 @@ . = ..() QDEL_NULL(tgui_cardmod) -/datum/computer_file/program/card_mod/ui_static_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/datum/computer_file/program/card_mod/ui_static_data(mob/user, datum/tgui/ui) . = get_header_data() -/datum/computer_file/program/card_mod/ui_module_route(action, list/params, datum/tgui/ui, id) - . = ..() - if(.) - return - switch(id) - if("modify") - return tgui_cardmod.ui_act(action, params, ui) - -/datum/computer_file/program/card_mod/ui_module_data(mob/user, datum/tgui/ui, datum/ui_state/state) - . = ..() - .["modify"] = tgui_cardmod.data(user, computer.card_slot.stored_card, user.GetIdCard()) +/datum/computer_file/program/card_mod/ui_route(action, list/params, datum/tgui/ui, id) + . = ..() + if(.) + return + switch(id) + if("modify") + return tgui_cardmod.ui_act(action, params, ui) -/datum/computer_file/program/card_mod/ui_module_static(mob/user, datum/tgui/ui, datum/ui_state/state) - . = ..() - .["modify"] = tgui_cardmod.static_data(user, computer.card_slot.stored_card, user.GetIdCard()) +/datum/computer_file/program/card_mod/ui_pre_open(datum/tgui/ui) + ui.register_module(tgui_cardmod, "modify") + return ..() diff --git a/code/modules/modular_computers/file_system/programs/generic/file_browser.dm b/code/modules/modular_computers/file_system/programs/generic/file_browser.dm index 034bf6a6f83f..4d5782179774 100644 --- a/code/modules/modular_computers/file_system/programs/generic/file_browser.dm +++ b/code/modules/modular_computers/file_system/programs/generic/file_browser.dm @@ -140,7 +140,7 @@ HDD.store_file(C) return TRUE -/datum/computer_file/program/filemanager/ui_data(mob/user) +/datum/computer_file/program/filemanager/ui_data(mob/user, datum/tgui/ui) var/list/data = get_header_data() var/obj/item/computer_hardware/hard_drive/HDD = computer.hard_drive diff --git a/code/modules/modular_computers/file_system/programs/generic/game.dm b/code/modules/modular_computers/file_system/programs/generic/game.dm index fa7bba9c1ea0..5fe42f33b9d1 100644 --- a/code/modules/modular_computers/file_system/programs/generic/game.dm +++ b/code/modules/modular_computers/file_system/programs/generic/game.dm @@ -90,7 +90,7 @@ /** * This provides all of the relevant data to the UI in a list(). */ -/datum/computer_file/program/game/ui_data(mob/user) +/datum/computer_file/program/game/ui_data(mob/user, datum/tgui/ui) var/list/data = get_header_data() data["Hitpoints"] = boss_hp data["PlayerHitpoints"] = player_hp @@ -105,7 +105,7 @@ /** * This is tgui's replacement for Topic(). It handles any user input from the UI. */ -/datum/computer_file/program/game/ui_act(action, list/params) +/datum/computer_file/program/game/ui_act(action, list/params, datum/tgui/ui) if(..()) // Always call parent in ui_act, it handles making sure the user is allowed to interact with the UI. return TRUE diff --git a/code/modules/modular_computers/file_system/programs/generic/news_browser.dm b/code/modules/modular_computers/file_system/programs/generic/news_browser.dm index 4e8f4c3ad9a7..efdaa3569f4d 100644 --- a/code/modules/modular_computers/file_system/programs/generic/news_browser.dm +++ b/code/modules/modular_computers/file_system/programs/generic/news_browser.dm @@ -36,7 +36,7 @@ requires_ntnet = 0 // Turn off NTNet requirement as we already loaded the file into local memory. SStgui.update_uis(src) -/datum/computer_file/program/newsbrowser/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/datum/computer_file/program/newsbrowser/ui_data(mob/user, datum/tgui/ui) var/list/data = get_header_data() var/list/all_articles = list() diff --git a/code/modules/modular_computers/file_system/programs/generic/ntdownloader.dm b/code/modules/modular_computers/file_system/programs/generic/ntdownloader.dm index 310a7a7bce34..139b1896f01d 100644 --- a/code/modules/modular_computers/file_system/programs/generic/ntdownloader.dm +++ b/code/modules/modular_computers/file_system/programs/generic/ntdownloader.dm @@ -105,7 +105,7 @@ download_netspeed = NTNETSPEED_ETHERNET download_completion += download_netspeed -/datum/computer_file/program/ntnetdownload/ui_act(action, params) +/datum/computer_file/program/ntnetdownload/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE switch(action) @@ -127,7 +127,7 @@ return TRUE return FALSE -/datum/computer_file/program/ntnetdownload/ui_data(mob/user) +/datum/computer_file/program/ntnetdownload/ui_data(mob/user, datum/tgui/ui) my_computer = computer if(!istype(my_computer)) return diff --git a/code/modules/modular_computers/file_system/programs/generic/ntnrc_client.dm b/code/modules/modular_computers/file_system/programs/generic/ntnrc_client.dm index 23374990a508..30629e870a26 100644 --- a/code/modules/modular_computers/file_system/programs/generic/ntnrc_client.dm +++ b/code/modules/modular_computers/file_system/programs/generic/ntnrc_client.dm @@ -24,7 +24,7 @@ username = "DefaultUser[rand(100, 999)]" ntnet = ntnet_global -/datum/computer_file/program/chatclient/ui_act(action, params) +/datum/computer_file/program/chatclient/ui_act(action, list/params, datum/tgui/ui) if(..()) return @@ -170,12 +170,12 @@ channel.remove_client(src) ..() -/datum/computer_file/program/chatclient/ui_static_data(mob/user) +/datum/computer_file/program/chatclient/ui_static_data(mob/user, datum/tgui/ui) var/list/data = list() data["can_admin"] = can_run(user, FALSE, ACCESS_NETWORK) return data -/datum/computer_file/program/chatclient/ui_data(mob/user) +/datum/computer_file/program/chatclient/ui_data(mob/user, datum/tgui/ui) if(!ntnet_global || !ntnet_global.chat_channels) return list() diff --git a/code/modules/modular_computers/file_system/programs/generic/nttransfer.dm b/code/modules/modular_computers/file_system/programs/generic/nttransfer.dm index b5fff1167ee6..4d2cccd12c1a 100644 --- a/code/modules/modular_computers/file_system/programs/generic/nttransfer.dm +++ b/code/modules/modular_computers/file_system/programs/generic/nttransfer.dm @@ -75,7 +75,7 @@ var/global/nttransfer_uid = 0 remote = null download_completion = 0 -/datum/computer_file/program/nttransfer/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/datum/computer_file/program/nttransfer/ui_data(mob/user, datum/tgui/ui) var/list/data = get_header_data() data["error"] = error diff --git a/code/modules/modular_computers/file_system/programs/generic/wordprocessor.dm b/code/modules/modular_computers/file_system/programs/generic/wordprocessor.dm index 0170a4dd30e6..a98dbac94ea1 100644 --- a/code/modules/modular_computers/file_system/programs/generic/wordprocessor.dm +++ b/code/modules/modular_computers/file_system/programs/generic/wordprocessor.dm @@ -182,7 +182,7 @@ return TRUE return TRUE -/datum/computer_file/program/wordprocessor/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/datum/computer_file/program/wordprocessor/ui_data(mob/user, datum/tgui/ui) var/list/data = get_header_data() var/obj/item/computer_hardware/hard_drive/HDD = computer.hard_drive diff --git a/code/modules/modular_computers/file_system/programs/research/email_administration.dm b/code/modules/modular_computers/file_system/programs/research/email_administration.dm index 40d58b1ec7da..16c8ef1187a2 100644 --- a/code/modules/modular_computers/file_system/programs/research/email_administration.dm +++ b/code/modules/modular_computers/file_system/programs/research/email_administration.dm @@ -15,7 +15,7 @@ var/datum/computer_file/data/email_message/current_message = null var/error = "" -/datum/computer_file/program/email_administration/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/datum/computer_file/program/email_administration/ui_data(mob/user, datum/tgui/ui) var/list/data = get_header_data() data["error"] = error diff --git a/code/modules/modular_computers/file_system/programs/research/ntmonitor.dm b/code/modules/modular_computers/file_system/programs/research/ntmonitor.dm index cd734a9c4b53..1979a8d625b0 100644 --- a/code/modules/modular_computers/file_system/programs/research/ntmonitor.dm +++ b/code/modules/modular_computers/file_system/programs/research/ntmonitor.dm @@ -11,7 +11,7 @@ available_on_ntnet = TRUE tgui_id = "NtosNetMonitor" -/datum/computer_file/program/ntnetmonitor/ui_data(mob/user) +/datum/computer_file/program/ntnetmonitor/ui_data(mob/user, datum/tgui/ui) if(!ntnet_global) return var/list/data = get_header_data() @@ -38,7 +38,7 @@ return data -/datum/computer_file/program/ntnetmonitor/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) +/datum/computer_file/program/ntnetmonitor/ui_act(action, list/params, datum/tgui/ui) if(..()) return switch(action) @@ -60,7 +60,7 @@ return TRUE var/response = alert(usr, "Really disable NTNet wireless? If your computer is connected wirelessly you won't be able to turn it back on! This will affect all connected wireless devices.", "NTNet shutdown", "Yes", "No") - if(response == "Yes" && ui_status(usr, state) == UI_INTERACTIVE) + if(response == "Yes" && ui?.still_interactive()) ntnet_global.setting_disabled = TRUE return TRUE if("purgelogs") @@ -81,13 +81,13 @@ if(!ntnet_global) return var/nid = input(usr,"Enter NID of device which you want to block from the network:", "Enter NID") as null|num - if(nid && ui_status(usr, state) == UI_INTERACTIVE) + if(nid && ui?.still_interactive()) ntnet_global.banned_nids |= nid return TRUE if("unban_nid") if(!ntnet_global) return var/nid = input(usr,"Enter NID of device which you want to unblock from the network:", "Enter NID") as null|num - if(nid && ui_status(usr, state) == UI_INTERACTIVE) + if(nid && ui?.still_interactive()) ntnet_global.banned_nids -= nid return TRUE diff --git a/code/modules/modular_computers/file_system/programs/security/digitalwarrant.dm b/code/modules/modular_computers/file_system/programs/security/digitalwarrant.dm index 1b2c0edd1f99..a9d70ef27dcc 100644 --- a/code/modules/modular_computers/file_system/programs/security/digitalwarrant.dm +++ b/code/modules/modular_computers/file_system/programs/security/digitalwarrant.dm @@ -25,7 +25,7 @@ var/global/warrant_uid = 0 var/datum/data/record/warrant/activewarrant -/datum/computer_file/program/digitalwarrant/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/datum/computer_file/program/digitalwarrant/ui_data(mob/user, datum/tgui/ui) var/list/data = get_header_data() data["warrantname"] = null @@ -52,7 +52,7 @@ var/global/warrant_uid = 0 return data -/datum/computer_file/program/digitalwarrant/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) +/datum/computer_file/program/digitalwarrant/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE @@ -81,7 +81,7 @@ var/global/warrant_uid = 0 . = TRUE var/datum/data/record/warrant/W = new() var/temp = sanitize(input(usr, "Do you want to create a search-, or an arrest warrant?") as null|anything in list("search","arrest")) - if(ui_status(usr, state) == UI_INTERACTIVE) + if(ui?.still_interactive()) if(temp == "arrest") W.fields["namewarrant"] = "Unknown" W.fields["charges"] = "No charges present" @@ -110,7 +110,7 @@ var/global/warrant_uid = 0 for(var/datum/data/record/t in data_core.general) namelist += t.fields["name"] var/new_name = sanitize(input(usr, "Please input name") as null|anything in namelist) - if(ui_status(usr, state) == UI_INTERACTIVE) + if(ui?.still_interactive()) if (!new_name) return activewarrant.fields["namewarrant"] = new_name @@ -118,7 +118,7 @@ var/global/warrant_uid = 0 if("editwarrantnamecustom") . = TRUE var/new_name = sanitize(input("Please input name") as null|text) - if(ui_status(usr, state) == UI_INTERACTIVE) + if(ui?.still_interactive()) if (!new_name) return activewarrant.fields["namewarrant"] = new_name @@ -126,7 +126,7 @@ var/global/warrant_uid = 0 if("editwarrantcharges") . = TRUE var/new_charges = sanitize(input("Please input charges", "Charges", activewarrant.fields["charges"]) as null|text) - if(ui_status(usr, state) == UI_INTERACTIVE) + if(ui?.still_interactive()) if (!new_charges) return activewarrant.fields["charges"] = new_charges diff --git a/code/modules/nanites/chamber_control.dm b/code/modules/nanites/chamber_control.dm index e1615a48a56c..8a76664cfa41 100644 --- a/code/modules/nanites/chamber_control.dm +++ b/code/modules/nanites/chamber_control.dm @@ -73,7 +73,7 @@ linked.try_refresh_protean(usr) return TRUE -/obj/machinery/computer/nanite_chamber/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/computer/nanite_chamber/ui_data(mob/user, datum/tgui/ui) . = ..() if(isnull(linked)) return @@ -81,7 +81,7 @@ .["locked"] = linked.locked .["operating"] = linked.operating -/obj/machinery/computer/nanite_chamber/ui_static_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/computer/nanite_chamber/ui_static_data(mob/user, datum/tgui/ui) . = ..() if(isnull(linked)) .["hasChamber"] = FALSE diff --git a/code/modules/nano/nanoui.dm b/code/modules/nano/nanoui.dm index 43bed334a403..628d66c0f4e2 100644 --- a/code/modules/nano/nanoui.dm +++ b/code/modules/nano/nanoui.dm @@ -445,7 +445,7 @@ */ /datum/nanoui/proc/close() is_auto_updating = 0 - SSnanoui.ui_closed(src) + SSnanoui.on_ui_closed(src) user << browse(null, "window=[window_id]") for(var/datum/nanoui/child in children) child.close() diff --git a/code/modules/nifsoft/nif_tgui.dm b/code/modules/nifsoft/nif_tgui.dm index 882c5a88e77c..ad09f0c6535b 100644 --- a/code/modules/nifsoft/nif_tgui.dm +++ b/code/modules/nifsoft/nif_tgui.dm @@ -96,7 +96,7 @@ /** * The NIF State ensures that only our authorized implanted user can touch us. */ -/obj/item/nif/ui_state(mob/user, datum/tgui_module/module) +/obj/item/nif/ui_state() return GLOB.ui_nif_main_state /** @@ -112,7 +112,7 @@ * ui_data gives the UI any relevant data it needs. * In our case, that's basically everything from our statpanel. */ -/obj/item/nif/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/item/nif/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["theme"] = save_data["ui_theme"] diff --git a/code/modules/overmap/legacy/disperser/disperser_console.dm b/code/modules/overmap/legacy/disperser/disperser_console.dm index 838c34a77682..2261dadb54a7 100644 --- a/code/modules/overmap/legacy/disperser/disperser_console.dm +++ b/code/modules/overmap/legacy/disperser/disperser_console.dm @@ -127,7 +127,7 @@ ui = new(user, src, "OvermapDisperser", "[linked.name] ORB control") // 400, 550 ui.open() -/obj/machinery/computer/ship/disperser/ui_data(mob/user) +/obj/machinery/computer/ship/disperser/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["faillink"] = FALSE data["calibration"] = null diff --git a/code/modules/overmap/legacy/ships/computers/engine_control.dm b/code/modules/overmap/legacy/ships/computers/engine_control.dm index 4c6b58fee70e..98e3fbb4dc52 100644 --- a/code/modules/overmap/legacy/ships/computers/engine_control.dm +++ b/code/modules/overmap/legacy/ships/computers/engine_control.dm @@ -23,7 +23,7 @@ ui = new(user, src, "OvermapEngines", "[linked.name] Engines Control") // 390, 530 ui.open() -/obj/machinery/computer/ship/engines/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/computer/ship/engines/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["global_state"] = linked.engines_state data["global_limit"] = round(linked.thrust_limit*100) diff --git a/code/modules/overmap/legacy/ships/computers/helm.dm b/code/modules/overmap/legacy/ships/computers/helm.dm index c1a1c019300b..cbd8d4cfaa18 100644 --- a/code/modules/overmap/legacy/ships/computers/helm.dm +++ b/code/modules/overmap/legacy/ships/computers/helm.dm @@ -95,7 +95,7 @@ GLOBAL_LIST_EMPTY(all_waypoints) ui = new(user, src, "OvermapHelm", "[linked.name] Helm Control") // 565, 545 ui.open() -/obj/machinery/computer/ship/helm/ui_data(mob/user) +/obj/machinery/computer/ship/helm/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() var/turf/T = get_turf(linked) diff --git a/code/modules/overmap/legacy/ships/computers/sensors.dm b/code/modules/overmap/legacy/ships/computers/sensors.dm index 05284c9f09f9..4daa1aeb0ca4 100644 --- a/code/modules/overmap/legacy/ships/computers/sensors.dm +++ b/code/modules/overmap/legacy/ships/computers/sensors.dm @@ -37,7 +37,7 @@ ui = new(user, src, "OvermapShipSensors", "[linked.name] Sensors Control") // 420, 530 ui.open() -/obj/machinery/computer/ship/sensors/ui_data(mob/user) +/obj/machinery/computer/ship/sensors/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["viewing"] = viewing_overmap(user) diff --git a/code/modules/overmap/legacy/ships/computers/ship.dm b/code/modules/overmap/legacy/ships/computers/ship.dm index 22a1601538e9..cb34713e2439 100644 --- a/code/modules/overmap/legacy/ships/computers/ship.dm +++ b/code/modules/overmap/legacy/ships/computers/ship.dm @@ -101,7 +101,7 @@ /obj/machinery/computer/ship/proc/viewing_overmap(mob/user) return (WEAKREF(user) in viewers) -/obj/machinery/computer/ship/ui_status(mob/user) +/obj/machinery/computer/ship/ui_status(mob/user, datum/ui_state/state) . = ..() if(. > UI_DISABLED) if(viewing_overmap(user)) @@ -109,7 +109,7 @@ return unlook(user) -/obj/machinery/computer/ship/ui_close(mob/user, datum/tgui_module/module) +/obj/machinery/computer/ship/on_ui_close(mob/user, datum/tgui/ui, embedded) . = ..() user.unset_machine() unlook(user) diff --git a/code/modules/overmap/legacy/ships/computers/shuttle.dm b/code/modules/overmap/legacy/ships/computers/shuttle.dm index 8141287349fa..e367340352fc 100644 --- a/code/modules/overmap/legacy/ships/computers/shuttle.dm +++ b/code/modules/overmap/legacy/ships/computers/shuttle.dm @@ -25,7 +25,7 @@ "fuel_span" = fuel_span ) -/obj/machinery/computer/shuttle_control/explore/ui_act(action, list/params) +/obj/machinery/computer/shuttle_control/explore/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/modules/paperwork/filingcabinet.dm b/code/modules/paperwork/filingcabinet.dm index b934c3fc88c6..b9ecb5dd6704 100644 --- a/code/modules/paperwork/filingcabinet.dm +++ b/code/modules/paperwork/filingcabinet.dm @@ -83,7 +83,7 @@ return to_chat(user, SPAN_NOTICE("You find nothing in [src].")) -/obj/structure/filingcabinet/ui_state(mob/user, datum/tgui_module/module) +/obj/structure/filingcabinet/ui_state() return GLOB.physical_state /obj/structure/filingcabinet/ui_interact(mob/user, datum/tgui/ui) @@ -93,7 +93,7 @@ ui.set_autoupdate(FALSE) ui.open() -/obj/structure/filingcabinet/ui_data(mob/user) +/obj/structure/filingcabinet/ui_data(mob/user, datum/tgui/ui) var/list/files = list() for(var/obj/item/P in src) files.Add(list(list( @@ -103,7 +103,7 @@ return list("contents" = files) -/obj/structure/filingcabinet/ui_act(action, params) +/obj/structure/filingcabinet/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index a6e76ca15c0b..a42390756d02 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -1002,7 +1002,7 @@ GLOBAL_LIST_EMPTY(apcs) ui = new(user, src, "APC", name) // 510, 460 ui.open() -/obj/machinery/power/apc/ui_data(mob/user) +/obj/machinery/power/apc/ui_data(mob/user, datum/tgui/ui) var/list/data = list( "locked" = locked, "normallyLocked" = locked, @@ -1058,7 +1058,7 @@ GLOBAL_LIST_EMPTY(apcs) return data -/obj/machinery/power/apc/ui_act(action, params) +/obj/machinery/power/apc/ui_act(action, list/params, datum/tgui/ui) if(..() || !can_use(usr, TRUE)) return TRUE diff --git a/code/modules/power/generator.dm b/code/modules/power/generator.dm index 372564cb0d8f..55f00fb7aa43 100644 --- a/code/modules/power/generator.dm +++ b/code/modules/power/generator.dm @@ -202,7 +202,7 @@ GLOBAL_LIST_EMPTY(all_turbines) ui = new(user, src, "TEGenerator", name) ui.open() -/obj/machinery/power/generator/ui_data(mob/user) +/obj/machinery/power/generator/ui_data(mob/user, datum/tgui/ui) // this is the data which will be sent to the ui var/vertical = 0 if (dir == NORTH || dir == SOUTH) diff --git a/code/modules/power/gravitygenerator.dm b/code/modules/power/gravitygenerator.dm index 27ec2fa4f12d..d4bcc7eebf22 100644 --- a/code/modules/power/gravitygenerator.dm +++ b/code/modules/power/gravitygenerator.dm @@ -251,7 +251,7 @@ GLOBAL_LIST_EMPTY(gravity_generators) ui = new(user, src, "GravityGenerator", name) ui.open() -/obj/machinery/gravity_generator/main/ui_data(mob/user) +/obj/machinery/gravity_generator/main/ui_data(mob/user, datum/tgui/ui) var/data[0] data["breaker"] = breaker @@ -262,7 +262,7 @@ GLOBAL_LIST_EMPTY(gravity_generators) return data -/obj/machinery/gravity_generator/main/ui_act(action, params) +/obj/machinery/gravity_generator/main/ui_act(action, list/params, datum/tgui/ui) if((..())) return TRUE diff --git a/code/modules/power/port_gen.dm b/code/modules/power/port_gen.dm index 6d63e7f0bcd3..c74746180773 100644 --- a/code/modules/power/port_gen.dm +++ b/code/modules/power/port_gen.dm @@ -317,7 +317,7 @@ ui = new(user, src, "PortableGenerator", name) ui.open() -/obj/machinery/power/port_gen/pacman/ui_data(mob/user) +/obj/machinery/power/port_gen/pacman/ui_data(mob/user, datum/tgui/ui) // todo: rewrite the whole fuckin' UI. var/list/data = list() @@ -349,7 +349,7 @@ return data -/obj/machinery/power/port_gen/pacman/ui_act(action, params) +/obj/machinery/power/port_gen/pacman/ui_act(action, list/params, datum/tgui/ui) if(..()) return diff --git a/code/modules/power/sensors/powernet_sensor.dm b/code/modules/power/sensors/powernet_sensor.dm index 3cdbd9524531..5d78626e640b 100644 --- a/code/modules/power/sensors/powernet_sensor.dm +++ b/code/modules/power/sensors/powernet_sensor.dm @@ -92,7 +92,7 @@ if(demand.len > record_size) demand.Cut(1, 2) -/obj/machinery/power/sensor/ui_data() +/obj/machinery/power/sensor/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["name"] = name_tag diff --git a/code/modules/power/smes/smes.dm b/code/modules/power/smes/smes.dm index 2a744c29053a..9d2082dd458d 100644 --- a/code/modules/power/smes/smes.dm +++ b/code/modules/power/smes/smes.dm @@ -312,7 +312,7 @@ GLOBAL_LIST_EMPTY(smeses) ui = new(user, src, "Smes", name) ui.open() -/obj/machinery/power/smes/ui_data() +/obj/machinery/power/smes/ui_data(mob/user, datum/tgui/ui) var/list/data = list( "capacity" = capacity, "capacityPercent" = round(100.0*charge/capacity, 0.1), @@ -330,7 +330,7 @@ GLOBAL_LIST_EMPTY(smeses) ) return data -/obj/machinery/power/smes/ui_act(action, params) +/obj/machinery/power/smes/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE switch(action) diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm index 6baeccbbb8c3..a952df51bce6 100644 --- a/code/modules/power/supermatter/supermatter.dm +++ b/code/modules/power/supermatter/supermatter.dm @@ -416,7 +416,7 @@ ui.open() // This is purely informational UI that may be accessed by AIs or robots -/obj/machinery/power/supermatter/ui_data(mob/user) +/obj/machinery/power/supermatter/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["integrity_percentage"] = round(get_integrity()) diff --git a/code/modules/preferences/preference_setup/helpers/language_pick.dm b/code/modules/preferences/preference_setup/helpers/language_pick.dm index 7ebdef1abbcf..eb7a52085f2a 100644 --- a/code/modules/preferences/preference_setup/helpers/language_pick.dm +++ b/code/modules/preferences/preference_setup/helpers/language_pick.dm @@ -60,10 +60,10 @@ GLOBAL_LIST_EMPTY(language_picker_active) ui.autoupdate = FALSE // why the fuck are you updating language data?? ui.open() -/datum/tgui_language_picker/ui_status(mob/user, datum/ui_state/state, datum/tgui_module/module) +/datum/tgui_language_picker/ui_status(mob/user, datum/ui_state/state) return UI_INTERACTIVE -/datum/tgui_language_picker/ui_static_data(mob/user) +/datum/tgui_language_picker/ui_static_data(mob/user, datum/tgui/ui) var/list/data = ..() var/list/built = list() var/list/categories = list("General") @@ -81,7 +81,7 @@ GLOBAL_LIST_EMPTY(language_picker_active) data["categories"] = categories return data -/datum/tgui_language_picker/ui_close(mob/user, datum/tgui_module/module) +/datum/tgui_language_picker/on_ui_close(mob/user, datum/tgui/ui, embedded) . = ..() if(!QDELING(src)) qdel(src) diff --git a/code/modules/preferences/preference_setup/helpers/species_pick.dm b/code/modules/preferences/preference_setup/helpers/species_pick.dm index 46c240433a37..06786ee3474f 100644 --- a/code/modules/preferences/preference_setup/helpers/species_pick.dm +++ b/code/modules/preferences/preference_setup/helpers/species_pick.dm @@ -113,10 +113,10 @@ GLOBAL_LIST_EMPTY(species_picker_active) ui.autoupdate = FALSE // why the fuck are you updating species data?? ui.open() -/datum/tgui_species_picker/ui_status(mob/user, datum/ui_state/state, datum/tgui_module/module) +/datum/tgui_species_picker/ui_status(mob/user, datum/ui_state/state) return UI_INTERACTIVE -/datum/tgui_species_picker/ui_static_data(mob/user) +/datum/tgui_species_picker/ui_static_data(mob/user, datum/tgui/ui) var/list/data = ..() data["whitelisted"] = whitelisted data["species"] = SScharacters.character_species_cache @@ -124,7 +124,7 @@ GLOBAL_LIST_EMPTY(species_picker_active) data["admin"] = !!admin_datums[user.ckey] return data -/datum/tgui_species_picker/ui_close(mob/user, datum/tgui_module/module) +/datum/tgui_species_picker/on_ui_close(mob/user, datum/tgui/ui, embedded) . = ..() if(!QDELING(src)) qdel(src) diff --git a/code/modules/preferences/preference_setup/loadout/loadout.dm b/code/modules/preferences/preference_setup/loadout/loadout.dm index 3af7b92af1da..30e516b56042 100644 --- a/code/modules/preferences/preference_setup/loadout/loadout.dm +++ b/code/modules/preferences/preference_setup/loadout/loadout.dm @@ -98,7 +98,7 @@ . = FALSE current_cost += entry.cost -/datum/category_item/player_setup_item/loadout/gear/ui_static_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/datum/category_item/player_setup_item/loadout/gear/ui_static_data(mob/user, datum/tgui/ui) . = ..() .["gearContext"] = tgui_loadout_context() var/list/allowed_ids = list() @@ -114,7 +114,7 @@ ui = new(user, src, "CharacterLoadoutStandalone") ui.open() -/datum/category_item/player_setup_item/loadout/gear/ui_status(mob/user, datum/ui_state/state, datum/tgui_module/module) +/datum/category_item/player_setup_item/loadout/gear/ui_status(mob/user, datum/ui_state/state) return UI_INTERACTIVE /datum/category_item/player_setup_item/loadout/gear/proc/tgui_loadout_selected(list/loadout_slot) diff --git a/code/modules/reagents/machinery/chem_master.dm b/code/modules/reagents/machinery/chem_master.dm index bf6379db1b9a..7e3150abd0ae 100644 --- a/code/modules/reagents/machinery/chem_master.dm +++ b/code/modules/reagents/machinery/chem_master.dm @@ -217,7 +217,7 @@ ui = new(user, src, "ChemMaster", name) ui.open() -/obj/machinery/chem_master/ui_data(mob/user) +/obj/machinery/chem_master/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["mode"] = mode @@ -265,7 +265,7 @@ return data -/obj/machinery/chem_master/ui_static_data(mob/user) +/obj/machinery/chem_master/ui_static_data(mob/user, datum/tgui/ui) var/list/static_data = list() //Calculated once since it'll never change if(!pill_styles || !bottle_styles || !chosen_patch_style || !patch_styles) @@ -277,7 +277,7 @@ return static_data -/obj/machinery/chem_master/ui_act(action, params) +/obj/machinery/chem_master/ui_act(action, list/params, datum/tgui/ui) . = ..() if(.) return diff --git a/code/modules/reagents/machinery/dispenser/dispenser.dm b/code/modules/reagents/machinery/dispenser/dispenser.dm index df36bf660746..d88724dd427c 100644 --- a/code/modules/reagents/machinery/dispenser/dispenser.dm +++ b/code/modules/reagents/machinery/dispenser/dispenser.dm @@ -155,7 +155,7 @@ macros_built[++macros_built.len] = L | list("index" = ++index) return macros_built -/obj/machinery/chemical_dispenser/ui_static_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/chemical_dispenser/ui_static_data(mob/user, datum/tgui/ui) . = ..() .["cartridges"] = ui_cartridge_data() var/list/chems_built = list() @@ -180,7 +180,7 @@ .["macros_full"] = length(macros) >= MAX_MACROS .["macros_max_steps"] = MAX_MACRO_STEPS -/obj/machinery/chemical_dispenser/ui_data(mob/user) +/obj/machinery/chemical_dispenser/ui_data(mob/user, datum/tgui/ui) . = ..() .["amount"] = dispense_amount .["amount_max"] = dispense_amount_max @@ -198,7 +198,7 @@ .["recharging"] = charging .["recharge_rate"] = recharge_rate -/obj/machinery/chemical_dispenser/ui_act(action, params) +/obj/machinery/chemical_dispenser/ui_act(action, list/params, datum/tgui/ui) . = ..() if(.) return diff --git a/code/modules/recycling/sortingmachinery.dm b/code/modules/recycling/sortingmachinery.dm index c624b7ddff68..d2627e04d297 100644 --- a/code/modules/recycling/sortingmachinery.dm +++ b/code/modules/recycling/sortingmachinery.dm @@ -329,7 +329,7 @@ item_state = "electronic" slot_flags = SLOT_BELT -/obj/item/destTagger/ui_state(mob/user, datum/tgui_module/module) +/obj/item/destTagger/ui_state() return GLOB.inventory_state /obj/item/destTagger/ui_interact(mob/user, datum/tgui/ui) @@ -352,7 +352,7 @@ return ui_interact(user) -/obj/item/destTagger/ui_act(action, params) +/obj/item/destTagger/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE add_fingerprint(usr) diff --git a/code/modules/research/machinery/rdconsole_tgui.dm b/code/modules/research/machinery/rdconsole_tgui.dm index 95a256cf3d36..78b658178a81 100644 --- a/code/modules/research/machinery/rdconsole_tgui.dm +++ b/code/modules/research/machinery/rdconsole_tgui.dm @@ -19,12 +19,12 @@ ui = new(user, src, "ResearchConsole", name) ui.open() -/obj/machinery/computer/rdconsole/ui_status(mob/user) +/obj/machinery/computer/rdconsole/ui_status(mob/user, datum/ui_state/state) . = ..() if(locked && !allowed(user) && !emagged) . = min(., UI_UPDATE) -/obj/machinery/computer/rdconsole/ui_static_data(mob/user) +/obj/machinery/computer/rdconsole/ui_static_data(mob/user, datum/tgui/ui) var/list/data = ..() data["tech"] = tgui_GetResearchLevelsInfo() @@ -35,7 +35,7 @@ return data -/obj/machinery/computer/rdconsole/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/computer/rdconsole/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["locked"] = locked diff --git a/code/modules/research/machinery/server.dm b/code/modules/research/machinery/server.dm index b55ba68b2cbd..933962807f28 100644 --- a/code/modules/research/machinery/server.dm +++ b/code/modules/research/machinery/server.dm @@ -156,7 +156,7 @@ var/list/consoles = list() var/badmin = 0 -/obj/machinery/computer/rdservercontrol/ui_status(mob/user) +/obj/machinery/computer/rdservercontrol/ui_status(mob/user, datum/ui_state/state) . = ..() if(!allowed(user) && !emagged) . = min(., UI_UPDATE) @@ -167,7 +167,7 @@ ui = new(user, src, "ResearchServerController", name) ui.open() -/obj/machinery/computer/rdservercontrol/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/computer/rdservercontrol/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["badmin"] = badmin diff --git a/code/modules/shieldgen/shield_generator.dm b/code/modules/shieldgen/shield_generator.dm index 169fcecce179..65caacedfc4e 100644 --- a/code/modules/shieldgen/shield_generator.dm +++ b/code/modules/shieldgen/shield_generator.dm @@ -402,7 +402,7 @@ ui = new(user, src, "OvermapShieldGenerator", name) // 500, 800 ui.open() -/obj/machinery/power/shield_generator/ui_data(mob/user) +/obj/machinery/power/shield_generator/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["running"] = running @@ -439,7 +439,7 @@ return ui_interact(user) -/obj/machinery/power/shield_generator/ui_status(mob/user) +/obj/machinery/power/shield_generator/ui_status(mob/user, datum/ui_state/state) if(issilicon(user) && !Adjacent(user) && ai_control_disabled) return UI_UPDATE if(panel_open) diff --git a/code/modules/shuttles/escape_pods.dm b/code/modules/shuttles/escape_pods.dm index 1752386de6e7..d1452c4c70a4 100644 --- a/code/modules/shuttles/escape_pods.dm +++ b/code/modules/shuttles/escape_pods.dm @@ -47,7 +47,7 @@ program = /datum/computer/file/embedded_program/docking/simple var/datum/shuttle/autodock/ferry/escape_pod/pod -/obj/machinery/embedded_controller/radio/simple_docking_controller/escape_pod/ui_data(mob/user) +/obj/machinery/embedded_controller/radio/simple_docking_controller/escape_pod/ui_data(mob/user, datum/tgui/ui) var/datum/computer/file/embedded_program/docking/simple/docking_program = program // Cast to proper type . = list( @@ -59,7 +59,7 @@ "internalTemplateName" = "EscapePodConsole", ) -/obj/machinery/embedded_controller/radio/simple_docking_controller/escape_pod/ui_act(action, params) +/obj/machinery/embedded_controller/radio/simple_docking_controller/escape_pod/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE @@ -81,7 +81,7 @@ program = /datum/computer/file/embedded_program/docking/simple/escape_pod_berth valid_actions = list("toggle_override", "force_door") -/obj/machinery/embedded_controller/radio/simple_docking_controller/escape_pod_berth/ui_data(mob/user) +/obj/machinery/embedded_controller/radio/simple_docking_controller/escape_pod_berth/ui_data(mob/user, datum/tgui/ui) var/datum/computer/file/embedded_program/docking/simple/docking_program = program // Cast to proper type var/armed = null diff --git a/code/modules/shuttles/shuttle_console.dm b/code/modules/shuttles/shuttle_console.dm index a4314251b010..9459cc25fba8 100644 --- a/code/modules/shuttles/shuttle_console.dm +++ b/code/modules/shuttles/shuttle_console.dm @@ -72,7 +72,7 @@ return FALSE return TRUE -/obj/machinery/computer/shuttle_control/ui_act(action, list/params) +/obj/machinery/computer/shuttle_control/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE if(skip_act) @@ -113,7 +113,7 @@ ui.open() // We delegate populating data to another proc to make it easier for overriding types to add their data. -/obj/machinery/computer/shuttle_control/ui_data(mob/user) +/obj/machinery/computer/shuttle_control/ui_data(mob/user, datum/tgui/ui) var/datum/shuttle/autodock/shuttle = SSshuttle.shuttles[shuttle_tag] if(!istype(shuttle)) to_chat(user, "Unable to establish link with the shuttle.") diff --git a/code/modules/shuttles/shuttle_console_multi.dm b/code/modules/shuttles/shuttle_console_multi.dm index 5850d8ca656f..7e15717798fa 100644 --- a/code/modules/shuttles/shuttle_console_multi.dm +++ b/code/modules/shuttles/shuttle_console_multi.dm @@ -14,7 +14,7 @@ // "engines_charging" = ((shuttle.last_move + (shuttle.cooldown SECONDS)) > world.time), // Replaced by longer warmup_time ) -/obj/machinery/computer/shuttle_control/multi/ui_act(action, list/params) +/obj/machinery/computer/shuttle_control/multi/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/modules/shuttles/shuttles_web.dm b/code/modules/shuttles/shuttles_web.dm index a72fc239b5d0..9e490e524741 100644 --- a/code/modules/shuttles/shuttles_web.dm +++ b/code/modules/shuttles/shuttles_web.dm @@ -205,7 +205,7 @@ return ..() -/obj/machinery/computer/shuttle_control/web/ui_data(mob/user) +/obj/machinery/computer/shuttle_control/web/ui_data(mob/user, datum/tgui/ui) var/list/data = list() var/list/routes[0] @@ -289,7 +289,7 @@ return data -/obj/machinery/computer/shuttle_control/web/ui_act(action, list/params) +/obj/machinery/computer/shuttle_control/web/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/modules/stockmarket/computer.dm b/code/modules/stockmarket/computer.dm index 6d16aa4ee95a..666891005f5d 100644 --- a/code/modules/stockmarket/computer.dm +++ b/code/modules/stockmarket/computer.dm @@ -30,7 +30,7 @@ //! ## MAIN TGUI SCREEN ## !// -/obj/machinery/computer/stockexchange/ui_act(action, params, datum/tgui/ui) +/obj/machinery/computer/stockexchange/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE @@ -104,7 +104,7 @@ if(vmode > 1) vmode = 0 -/obj/machinery/computer/stockexchange/ui_data(mob/user) +/obj/machinery/computer/stockexchange/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["stationName"] = (LEGACY_MAP_DATUM).station_name @@ -207,12 +207,12 @@ ui = new(user, src, "StockExchangeHistory") ui.open() -/obj/machinery/computer/stockexchange/history/ui_data(mob/user) +/obj/machinery/computer/stockexchange/history/ui_data(mob/user, datum/tgui/ui) var/list/data = list() //data["var"] = var return data -/obj/machinery/computer/stockexchange/history/ui_act(action, params) +/obj/machinery/computer/stockexchange/history/ui_act(action, list/params, datum/tgui/ui) if(..()) return switch(action) @@ -230,12 +230,12 @@ ui = new(user, src, "StockExchangeArchive") ui.open() -/obj/machinery/computer/stockexchange/archive/ui_data(mob/user) +/obj/machinery/computer/stockexchange/archive/ui_data(mob/user, datum/tgui/ui) var/list/data = list() //data["var"] = var return data -/obj/machinery/computer/stockexchange/archive/ui_act(action, params) +/obj/machinery/computer/stockexchange/archive/ui_act(action, list/params, datum/tgui/ui) if(..()) return diff --git a/code/modules/tgui/client.dm b/code/modules/tgui/client.dm new file mode 100644 index 000000000000..75b5a9b15ce5 --- /dev/null +++ b/code/modules/tgui/client.dm @@ -0,0 +1,88 @@ +/** + * External tgui definitions, such as src_object APIs. + * + *! Copyright (c) 2020 Aleksej Komarov + *! SPDX-License-Identifier: MIT + */ + + +/** + * global + * + * Tracks open windows for a user. + */ +/client/var/list/tgui_windows = list() + +/** + * global + * + * TRUE if cache was reloaded by tgui dev server at least once. + */ +/client/var/tgui_cache_reloaded = FALSE + +/** + * verb + * + * Called by UIs when they are closed. + * Must be a verb so winset() can call it. + * + * required uiref ref The UI that was closed. + */ +/client/verb/uiclose(window_id as text) + // Name the verb, and hide it from the user panel. + set name = "uiclose" + set hidden = TRUE + var/mob/user = src?.mob + if(!user) + return + // Close all tgui datums based on window_id. + SStgui.force_close_window(user, window_id) + +/** + * Middleware for /client/Topic. + * + * return bool If TRUE, prevents propagation of the topic call. + */ +/client/proc/tgui_topic(list/href_list) + // Skip non-tgui topics + if(!href_list["tgui"]) + return FALSE + var/type = href_list["type"] + // Unconditionally collect tgui logs + if(type == "log") + var/context = href_list["window_id"] + if (href_list["ns"]) + context += " ([href_list["ns"]])" + log_tgui(usr, href_list["message"], + context = context) + // Reload all tgui windows + if(type == "cacheReloaded") + log_tgui(usr, context = "debug/reload") + // Mark as reloaded + usr.client.tgui_cache_reloaded = TRUE + // Notify windows + var/list/windows = usr.client.tgui_windows + for(var/window_id in windows) + var/datum/tgui_window/window = windows[window_id] + if (window.status == TGUI_WINDOW_READY) + window.on_message(type, null, href_list) + return TRUE + // Locate window + var/window_id = href_list["window_id"] + var/datum/tgui_window/window + if(window_id) + window = usr.client.tgui_windows[window_id] + if(!window) + log_tgui(usr, + "Error: Couldn't find the window datum, force closing.", + context = window_id) + SStgui.force_close_window(usr, window_id) + return TRUE + // Decode payload + var/payload + if(href_list["payload"]) + payload = json_decode(href_list["payload"]) + // Pass message to window + if(window) + window.on_message(type, payload, href_list) + return TRUE diff --git a/code/modules/tgui/datum.dm b/code/modules/tgui/datum.dm new file mode 100644 index 000000000000..e5ff133698a0 --- /dev/null +++ b/code/modules/tgui/datum.dm @@ -0,0 +1,331 @@ +/** + * External tgui definitions, such as src_object APIs. + * + *! Copyright (c) 2020 Aleksej Komarov + *! SPDX-License-Identifier: MIT + */ + +/** + * global + * + * Associative list of JSON-encoded shared states that were set by + * tgui clients. + */ +/datum/var/list/tgui_shared_states + +//* API - Main - UI devs, look here! *// + +/** + * public + * + * Called on an object when a tgui object is being created, allowing you to + * push various assets to tgui, for examples spritesheets. + * + * todo: support typepaths + * todo: support file paths + * todo: this should be sent to embedding interfaces + * + * return list List of asset datum instances (must be /datum/asset instance, not path) + */ +/datum/proc/ui_assets(mob/user) + return list() + +/** + * public + * + * Called on a UI when the UI receieves a href. + * Think of this as Topic(). + * + * @params + * * action - the string of the TGUI-side act() that was invoked by the user + * * params - the list of key-value parameters of the act() invocation. This is always strings for both key and value! + * * ui - the TGUI instance invoking this (host window) + * + * @return bool If the user's input has been handled and the UI should update. + */ +/datum/proc/ui_act(action, list/params, datum/tgui/ui) + SHOULD_CALL_PARENT(TRUE) + // If UI is not interactive or usr calling Topic is not the UI user, bail. + if(!ui || ui.status != UI_INTERACTIVE) + return TRUE + +/** + * public + * + * Data to be sent to the UI. + * This must be implemented for a UI to work. + * + * @params + * * user - (optional) the mob using the UI + * * ui - (optional) the host tgui + * + * return list Data to be sent to the UI. + */ +/datum/proc/ui_data(mob/user, datum/tgui/ui) + return list() // Not implemented. + +/** + * public + * + * Static Data to be sent to the UI. + * + * Static data differs from normal data in that it's large data that should be + * sent infrequently. This is implemented optionally for heavy uis that would + * be sending a lot of redundant data frequently. Gets squished into one + * object on the frontend side, but the static part is cached. + * + * + * @params + * * user - (optional) the mob using the UI + * * ui - (optional) the host tgui + * + * return list Static Data to be sent to the UI. + */ +/datum/proc/ui_static_data(mob/user, datum/tgui/ui) + return list() + +/** + * public + * + * Used to open and update UIs. + * If this proc is not implemented properly, the UI will not update correctly. + * + * todo: how should i ruin this proc? i don't really like update being twined with opening, but it makes sense..? ~silicons + * + * required user mob The mob who opened/is using the UI. + * optional ui datum/tgui The UI to be updated, if it exists. + * + *! ## To-Be-Deprecated. + * optional parent_ui datum/tgui A parent UI that, when closed, closes this UI as well. + */ +/datum/proc/ui_interact(mob/user, datum/tgui/ui, datum/tgui/parent_ui) + return FALSE // Not implemented. + +/** + * private + * + * todo: this is just completely ignored for modules/embedding. is this a good thing? ~silicons + * + * The UI's host object (usually src_object). + * This allows modules/datums to have the UI attached to them, + * and be a part of another object. + */ +/datum/proc/ui_host() + return src // Default src. + +/** + * private + * + * todo: this is just completely ignored for modules/embedding. is this a good thing? ~silicons + * + * The UI's state controller to be used for created uis + * This is a proc over a var for memory reasons + */ +/datum/proc/ui_state() + return GLOB.default_state + +/** + * Called to route UI act calls to modules. + * + * This is a proc so you can override yourself - very useful if you're doing your own module system + * rather than copy-pasting module code. + * + * @params + * * action - the action string of the ui_act + * * params - list of string key-values; this is always strings, text2num your number args if needed! + * * ui - the host window ui datum + * * id - the module ID of the route request + * + * @return TRUE if it was handled by modules. + */ +/datum/proc/ui_route(action, list/params, datum/tgui/ui, id) + SHOULD_CALL_PARENT(TRUE) + // todo: the fact this is here is probably a bad thing, as it's very poorly documented. + // this basically matches the useModule<>() hook used on the UI side, because id is null if + // we're a host window, and not an act call from an embedded component. + if(!id) + return ui_act(action, params, ui) + return FALSE + +/** + * public + * + * Checks the overall UI state for a mob. + * + * todo: this is just completely ignored for modules/embedding. is this a good thing? ~silicons + * + * @params + * * user - The mob who opened/is using the UI. + * * state - The state to check. + * + * return UI_state The state of the UI. + */ +/datum/proc/ui_status(mob/user, datum/ui_state/state) + var/src_object = ui_host(user) + . = UI_CLOSE + if(!state) + return + + if(isobserver(user)) + // If they turn on ghost AI control, admins can always interact. + if(IsAdminGhost(user)) + . = max(., UI_INTERACTIVE) + + // Regular ghosts can always at least view if in range. + if(user.client) + // todo: in view range for zooming + if(get_dist(src_object, user) < max(CEILING(user.client.current_viewport_width / 2, 1), CEILING(user.client.current_viewport_height / 2, 1))) + . = max(., UI_UPDATE) + + // Check if the state allows interaction + var/result = state.can_use_topic(src_object, user) + . = max(., result) + +//* API - Update - Optimizers, look here! *// + +/** + * public + * + * Forces an update to regular UI data. + * + * If no user is provided, every user will be updated. + * + * todo: this does not update embedders + * + * @params + * * user - (optional) the mob to update + * * ui - (optional) the /datum/tgui to update + */ +/datum/proc/update_ui_data(mob/user, datum/tgui/ui) + if(isnull(user)) + SStgui.update_uis(src) + else + SStgui.try_update_ui(user, src, ui) + +/** + * public + * + * Forces an update on static data. Should be done manually whenever something + * happens to change static data. + * + * If no user is provided, every user will be updated. + * + * todo: this does not update embedders + * + * optional user the mob currently interacting with the ui + * optional ui tgui to be updated + * optional hard_refreshion use if you need to block the ui from showing if the refresh queues + */ +/datum/proc/update_static_data(mob/user, datum/tgui/ui, hard_refresh) + if(!user) + for (var/datum/tgui/window as anything in SStgui.open_uis_by_src[REF(src)]) + window.send_full_update(hard_refresh = hard_refresh) + return + if(!ui) + ui = SStgui.get_open_ui(user, src) + if(ui) + ui.send_full_update(hard_refresh = hard_refresh) + +/** + * immediately shunts this data to either an user, an ui, or all users. + * + * prefer to use this instead of update_static_data or update_ui_data, because this supports embedding + * and is generally faster. + * + * @params + * * user - when specified, only pushes this user. else, pushes to all windows. + * * ui - when specified, only pushes this ui for a given user. + * * updates - list(id = list(data...), ...) for modules. the reducer on tgui-side will only overwrite provided data keys. + */ +/datum/proc/push_ui_data(mob/user, datum/tgui/ui, list/data) + // todo: the way this works is so jank; this should be COMSIG_DATUM_HOOK_UI_PUSH instead? + // todo: this is because user, ui, data needs to go to the signal before being auto-resolved, as modules + // todo: won't necessarily match the values! + // FUCK + // ~silicons + SEND_SIGNAL(src, COMSIG_DATUM_PUSH_UI_DATA, user, ui, data) + if(!user) + for (var/datum/tgui/window as anything in SStgui.open_uis_by_src[REF(src)]) + window.push_data(data) + return + if(!ui) + ui = SStgui.get_open_ui(user, src) + if(ui) + // todo: this is force because otherwise static data can be desynced. should static data be on another proc instead? + ui.push_data(data, TRUE) + +/** + * immediately pushes module updates to user, an ui, or all users + * + * @params + * * user - when specified, only pushes this user. else, pushes to all windows. + * * ui - when specified, only pushes this ui for a given user. + * * updates - list(id = list(data...), ...) for modules. the reducer on tgui-side will only overwrite provided data keys. + */ +/datum/proc/push_ui_modules(mob/user, datum/tgui/ui, list/updates) + if(!user) + for (var/datum/tgui/window as anything in SStgui.open_uis_by_src[REF(src)]) + window.push_modules(updates) + return + if(!ui) + ui = SStgui.get_open_ui(user, src) + if(ui) + ui.push_modules(updates) + +//* Checks *// + +/** + * public + * + * checks if UIs are open + */ +/datum/proc/has_open_ui() + return length(SStgui.open_uis_by_src[REF(src)]) + +//* Hooks *// + +/** + * Called when a new UI is opened with this datum as the host, or when this datum is embedded into another UI. + * + * Called once per embed, if multiple windows embedding this datum is transferred. Handle this accordingly! + * + * When overriding this, be sure to cast embed_context to the right type for your datum. + * + * @params + * * user - opening mob + * * ui - the tgui instance + * * embedded - this was an embedded ui / the datum is being embedded + */ +/datum/proc/on_ui_open(mob/user, datum/tgui/ui, embedded) + SIGNAL_HANDLER + +/** + * Called when an UI with this datum as the host is closed, or when an UI is no longer embedding this datum. + * + * Called once per embed, if multiple windows embedding this datum is transferred. Handle this accordingly! + * + * When overriding this, be sure to cast embed_context to the right type for your datum. + * + * @params + * * user - opening mob + * * ui - the tgui instance + * * embedded - this was an embedded ui / the datum is being un-embedded + */ +/datum/proc/on_ui_close(mob/user, datum/tgui/ui, embedded) + SIGNAL_HANDLER + +/** + * Called on a UI's object when the UI is transferred from one mob to another. + * + * Called once per embed, if multiple windows embedding this datum is transferred. Handle this accordingly! + * + * When overriding this, be sure to cast embed_context to the right type for your datum. + * + * @params + * * old_mob - the old mob + * * new_mob - the new mob + * * ui - the tgui instance + * * embedded - this was an embedded transfer + */ +/datum/proc/on_ui_transfer(mob/old_mob, mob/new_mob, datum/tgui/ui, embedded) + return diff --git a/code/modules/tgui/external.dm b/code/modules/tgui/external.dm deleted file mode 100644 index 72429d4a7731..000000000000 --- a/code/modules/tgui/external.dm +++ /dev/null @@ -1,300 +0,0 @@ -/** - * External tgui definitions, such as src_object APIs. - * - *! Copyright (c) 2020 Aleksej Komarov - *! SPDX-License-Identifier: MIT - */ - -/** - * public - * - * Used to open and update UIs. - * If this proc is not implemented properly, the UI will not update correctly. - * - * required user mob The mob who opened/is using the UI. - * optional ui datum/tgui The UI to be updated, if it exists. - * - *! ## To-Be-Deprecated. - * optional parent_ui datum/tgui A parent UI that, when closed, closes this UI as well. - */ -/datum/proc/ui_interact(mob/user, datum/tgui/ui, datum/tgui/parent_ui) - return FALSE // Not implemented. - -/** - * public - * - * Data to be sent to the UI. - * This must be implemented for a UI to work. - * - * required user mob The mob interacting with the UI. - * - * return list Data to be sent to the UI. - */ -/datum/proc/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) - return list() // Not implemented. - -/** - * public - * - * Static Data to be sent to the UI. - * - * Static data differs from normal data in that it's large data that should be - * sent infrequently. This is implemented optionally for heavy uis that would - * be sending a lot of redundant data frequently. Gets squished into one - * object on the frontend side, but the static part is cached. - * - * required user mob The mob interacting with the UI. - * - * return list Statuic Data to be sent to the UI. - */ -/datum/proc/ui_static_data(mob/user, datum/tgui/ui, datum/ui_state/state) - return list() - -/** - * public - * - * Forces an update to regular UI data. - * - * If no user is provided, every user will be updated. - * - * @params - * * user - (optional) the mob to update - * * ui - (optional) the /datum/tgui to update - */ -/datum/proc/update_ui_data(mob/user, datum/tgui/ui) - if(isnull(user)) - SStgui.update_uis(src) - else - SStgui.try_update_ui(user, src, ui) - - -/** - * public - * - * Forces an update on static data. Should be done manually whenever something - * happens to change static data. - * - * If no user is provided, every user will be updated. - * - * optional user the mob currently interacting with the ui - * optional ui tgui to be updated - * optional hard_refreshion use if you need to block the ui from showing if the refresh queues - */ -/datum/proc/update_static_data(mob/user, datum/tgui/ui, hard_refresh) - if(!user) - for (var/datum/tgui/window as anything in SStgui.open_uis_by_src[REF(src)]) - window.send_full_update(hard_refresh = hard_refresh) - return - if(!ui) - ui = SStgui.get_open_ui(user, src) - if(ui) - ui.send_full_update(hard_refresh = hard_refresh) - -/** - * immediately shunts this data to either an user, an ui, or all users. - * - * @params - * * user - when specified, only pushes this user. else, pushes to all windows. - * * ui - when specified, only pushes this ui for a given user. - * * updates - list(id = list(data...), ...) for modules. the reducer on tgui-side will only overwrite provided data keys. - */ -/datum/proc/push_ui_data(mob/user, datum/tgui/ui, list/data) - if(!user) - for (var/datum/tgui/window as anything in SStgui.open_uis_by_src[REF(src)]) - window.push_data(data) - return - if(!ui) - ui = SStgui.get_open_ui(user, src) - if(ui) - ui.push_data(data) - -/** - * immediately pushes module updates to user, an ui, or all users - * - * @params - * * user - when specified, only pushes this user. else, pushes to all windows. - * * ui - when specified, only pushes this ui for a given user. - * * updates - list(id = list(data...), ...) for modules. the reducer on tgui-side will only overwrite provided data keys. - */ -/datum/proc/push_ui_modules(mob/user, datum/tgui/ui, list/updates) - if(!user) - for (var/datum/tgui/window as anything in SStgui.open_uis_by_src[REF(src)]) - window.push_modules(updates) - return - if(!ui) - ui = SStgui.get_open_ui(user, src) - if(ui) - ui.push_modules(updates) - -/** - * public - * - * Called on a UI when the UI receieves a href. - * Think of this as Topic(). - * - * required action string The action/button that has been invoked by the user. - * required params list A list of parameters attached to the button. - * - * return bool If the user's input has been handled and the UI should update. - */ -/datum/proc/ui_act(action, list/params, datum/tgui/ui) - SHOULD_CALL_PARENT(TRUE) - SEND_SIGNAL(src, COMSIG_UI_ACT, usr, action, params, ui) - // If UI is not interactive or usr calling Topic is not the UI user, bail. - if(!ui || ui.status != UI_INTERACTIVE) - return TRUE - -/** - * public - * - * Called on an object when a tgui object is being created, allowing you to - * push various assets to tgui, for examples spritesheets. - * - * return list List of asset datums or file paths. - */ -/datum/proc/ui_assets(mob/user) - return list() - -/** - * private - * - * The UI's host object (usually src_object). - * This allows modules/datums to have the UI attached to them, - * and be a part of another object. - */ -/datum/proc/ui_host(mob/user, datum/tgui_module/module) - return src // Default src. - -/** - * private - * - * The UI's state controller to be used for created uis - * This is a proc over a var for memory reasons - */ -/datum/proc/ui_state(mob/user, datum/tgui_module/module) - return GLOB.default_state - -/** - * public - * - * checks if UIs are open - */ -/datum/proc/has_open_ui() - return length(SStgui.open_uis_by_src[REF(src)]) - -/** - * global - * - * Associative list of JSON-encoded shared states that were set by - * tgui clients. - */ -/datum/var/list/tgui_shared_states - -/** - * global - * - * Tracks open UIs for a user. - */ -/mob/var/list/tgui_open_uis = list() - -/** - * global - * - * Tracks open windows for a user. - */ -/client/var/list/tgui_windows = list() - -/** - * global - * - * TRUE if cache was reloaded by tgui dev server at least once. - */ -/client/var/tgui_cache_reloaded = FALSE - -/** - * public - * - * Called on a UI's object when the UI is closed, not to be confused with - * client/verb/uiclose(), which closes the ui window - * - * @params - * * user - closing mob - * * module - (optional) the module it came from, if any - */ -/datum/proc/ui_close(mob/user, datum/tgui_module/module) - SIGNAL_HANDLER - -/** - * public - * - * Called on a UI's object when the UI is transferred from one mob to another. - */ -/datum/proc/on_ui_transfer(mob/old_mob, mob/new_mob, datum/tgui/ui) - return - -/** - * verb - * - * Called by UIs when they are closed. - * Must be a verb so winset() can call it. - * - * required uiref ref The UI that was closed. - */ -/client/verb/uiclose(window_id as text) - // Name the verb, and hide it from the user panel. - set name = "uiclose" - set hidden = TRUE - var/mob/user = src?.mob - if(!user) - return - // Close all tgui datums based on window_id. - SStgui.force_close_window(user, window_id) - -/** - * Middleware for /client/Topic. - * - * return bool If TRUE, prevents propagation of the topic call. - */ -/proc/tgui_Topic(href_list) - // Skip non-tgui topics - if(!href_list["tgui"]) - return FALSE - var/type = href_list["type"] - // Unconditionally collect tgui logs - if(type == "log") - var/context = href_list["window_id"] - if (href_list["ns"]) - context += " ([href_list["ns"]])" - log_tgui(usr, href_list["message"], - context = context) - // Reload all tgui windows - if(type == "cacheReloaded") - log_tgui(usr, context = "debug/reload") - // Mark as reloaded - usr.client.tgui_cache_reloaded = TRUE - // Notify windows - var/list/windows = usr.client.tgui_windows - for(var/window_id in windows) - var/datum/tgui_window/window = windows[window_id] - if (window.status == TGUI_WINDOW_READY) - window.on_message(type, null, href_list) - return TRUE - // Locate window - var/window_id = href_list["window_id"] - var/datum/tgui_window/window - if(window_id) - window = usr.client.tgui_windows[window_id] - if(!window) - log_tgui(usr, - "Error: Couldn't find the window datum, force closing.", - context = window_id) - SStgui.force_close_window(usr, window_id) - return TRUE - // Decode payload - var/payload - if(href_list["payload"]) - payload = json_decode(href_list["payload"]) - // Pass message to window - if(window) - window.on_message(type, payload, href_list) - return TRUE diff --git a/code/modules/tgui/modal_vr_legacy.dm b/code/modules/tgui/legacy/modal_vr_legacy.dm similarity index 100% rename from code/modules/tgui/modal_vr_legacy.dm rename to code/modules/tgui/legacy/modal_vr_legacy.dm diff --git a/code/modules/tgui/mob.dm b/code/modules/tgui/mob.dm new file mode 100644 index 000000000000..9e4113f2b2f5 --- /dev/null +++ b/code/modules/tgui/mob.dm @@ -0,0 +1,15 @@ +/** + * External tgui definitions, such as src_object APIs. + * + *! Copyright (c) 2020 Aleksej Komarov + *! SPDX-License-Identifier: MIT + */ + +/** + * global + * + * Tracks open UIs for a user. + */ +/mob/var/list/tgui_open_uis = list() + + diff --git a/code/modules/tgui/modals/tgui_alert.dm b/code/modules/tgui/modals/tgui_alert.dm index 449f6780457e..c39ed6c8a430 100644 --- a/code/modules/tgui/modals/tgui_alert.dm +++ b/code/modules/tgui/modals/tgui_alert.dm @@ -116,14 +116,14 @@ ui = new(user, src, "AlertModal") ui.open() -/datum/tgui_modal/ui_close(mob/user, datum/tgui_module/module) +/datum/tgui_modal/on_ui_close(mob/user, datum/tgui/ui, embedded) . = ..() closed = TRUE -/datum/tgui_modal/ui_state(mob/user, datum/tgui_module/module) +/datum/tgui_modal/ui_state() return GLOB.always_state -/datum/tgui_modal/ui_static_data(mob/user) +/datum/tgui_modal/ui_static_data(mob/user, datum/tgui/ui) . = list() .["autofocus"] = autofocus .["buttons"] = buttons @@ -132,12 +132,12 @@ .["swapped_buttons"] = FALSE//user.client.prefs.read_preference(/datum/preference/toggle/tgui_input_swapped) .["title"] = title -/datum/tgui_modal/ui_data(mob/user) +/datum/tgui_modal/ui_data(mob/user, datum/tgui/ui) . = list() if(timeout) .["timeout"] = CLAMP01((timeout - (world.time - start_time) - 1 SECONDS) / (timeout - 1 SECONDS)) -/datum/tgui_modal/ui_act(action, list/params) +/datum/tgui_modal/ui_act(action, list/params, datum/tgui/ui) . = ..() if (.) return diff --git a/code/modules/tgui/modals/tgui_dynamic_input.dm b/code/modules/tgui/modals/tgui_dynamic_input.dm index 8fc7338ccc83..e58b1b0e7bc8 100644 --- a/code/modules/tgui/modals/tgui_dynamic_input.dm +++ b/code/modules/tgui/modals/tgui_dynamic_input.dm @@ -173,7 +173,7 @@ closed = TRUE return ..() -/datum/tgui_dynamic_input/ui_static_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/datum/tgui_dynamic_input/ui_static_data(mob/user, datum/tgui/ui) . = ..() .["query"] = query.get_query() .["title"] = title @@ -202,7 +202,7 @@ finish(null) return TRUE -/datum/tgui_dynamic_input/ui_state(mob/user, datum/tgui_module/module) +/datum/tgui_dynamic_input/ui_state() return GLOB.always_state /datum/tgui_dynamic_input/proc/block_on_finished() diff --git a/code/modules/tgui/modals/tgui_input_list.dm b/code/modules/tgui/modals/tgui_input_list.dm index 55c10203bde3..388359e22c15 100644 --- a/code/modules/tgui/modals/tgui_input_list.dm +++ b/code/modules/tgui/modals/tgui_input_list.dm @@ -134,14 +134,14 @@ ui = new(user, src, "ListInputModal") ui.open() -/datum/tgui_list_input/ui_close(mob/user, datum/tgui_module/module) +/datum/tgui_list_input/on_ui_close(mob/user, datum/tgui/ui, embedded) . = ..() closed = TRUE -/datum/tgui_list_input/ui_state(mob/user, datum/tgui_module/module) +/datum/tgui_list_input/ui_state() return GLOB.always_state -/datum/tgui_list_input/ui_static_data(mob/user) +/datum/tgui_list_input/ui_static_data(mob/user, datum/tgui/ui) . = list() .["init_value"] = default || items[1] .["items"] = items @@ -150,12 +150,12 @@ .["swapped_buttons"] = FALSE//user.client.prefs.read_preference(/datum/preference/toggle/tgui_input_swapped) .["title"] = title -/datum/tgui_list_input/ui_data(mob/user) +/datum/tgui_list_input/ui_data(mob/user, datum/tgui/ui) . = list() if(timeout) .["timeout"] = clamp((timeout - (world.time - start_time) - 1 SECONDS) / (timeout - 1 SECONDS), 0, 1) -/datum/tgui_list_input/ui_act(action, list/params) +/datum/tgui_list_input/ui_act(action, list/params, datum/tgui/ui) . = ..() if (.) return diff --git a/code/modules/tgui/modals/tgui_input_number.dm b/code/modules/tgui/modals/tgui_input_number.dm index 7e0f1a308bc8..6e1a05241150 100644 --- a/code/modules/tgui/modals/tgui_input_number.dm +++ b/code/modules/tgui/modals/tgui_input_number.dm @@ -136,14 +136,14 @@ ui = new(user, src, "NumberInputModal") ui.open() -/datum/tgui_input_number/ui_close(mob/user, datum/tgui_module/module) +/datum/tgui_input_number/on_ui_close(mob/user, datum/tgui/ui, embedded) . = ..() closed = TRUE -/datum/tgui_input_number/ui_state(mob/user, datum/tgui_module/module) +/datum/tgui_input_number/ui_state() return GLOB.always_state -/datum/tgui_input_number/ui_static_data(mob/user) +/datum/tgui_input_number/ui_static_data(mob/user, datum/tgui/ui) . = list() .["init_value"] = default // Default is a reserved keyword .["large_buttons"] = FALSE//user.client.prefs.read_preference(/datum/preference/toggle/tgui_input_large) @@ -153,12 +153,12 @@ .["swapped_buttons"] = FALSE//user.client.prefs.read_preference(/datum/preference/toggle/tgui_input_swapped) .["title"] = title -/datum/tgui_input_number/ui_data(mob/user) +/datum/tgui_input_number/ui_data(mob/user, datum/tgui/ui) . = list() if(timeout) .["timeout"] = CLAMP01((timeout - (world.time - start_time) - 1 SECONDS) / (timeout - 1 SECONDS)) -/datum/tgui_input_number/ui_act(action, list/params) +/datum/tgui_input_number/ui_act(action, list/params, datum/tgui/ui) . = ..() if (.) return diff --git a/code/modules/tgui/modals/tgui_input_text.dm b/code/modules/tgui/modals/tgui_input_text.dm index acadc7124b35..6e5dc3ef69d8 100644 --- a/code/modules/tgui/modals/tgui_input_text.dm +++ b/code/modules/tgui/modals/tgui_input_text.dm @@ -158,14 +158,14 @@ ui = new(user, src, "TextInputModal") ui.open() -/datum/tgui_input_text/ui_close(mob/user, datum/tgui_module/module) +/datum/tgui_input_text/on_ui_close(mob/user, datum/tgui/ui, embedded) . = ..() closed = TRUE -/datum/tgui_input_text/ui_state(mob/user, datum/tgui_module/module) +/datum/tgui_input_text/ui_state() return GLOB.always_state -/datum/tgui_input_text/ui_static_data(mob/user) +/datum/tgui_input_text/ui_static_data(mob/user, datum/tgui/ui) . = list() .["large_buttons"] = FALSE//user.client.prefs.read_preference(/datum/preference/toggle/tgui_input_large) .["max_length"] = max_length @@ -175,12 +175,12 @@ .["swapped_buttons"] = FALSE//user.client.prefs.read_preference(/datum/preference/toggle/tgui_input_swapped) .["title"] = title -/datum/tgui_input_text/ui_data(mob/user) +/datum/tgui_input_text/ui_data(mob/user, datum/tgui/ui) . = list() if(timeout) .["timeout"] = CLAMP01((timeout - (world.time - start_time) - 1 SECONDS) / (timeout - 1 SECONDS)) -/datum/tgui_input_text/ui_act(action, list/params) +/datum/tgui_input_text/ui_act(action, list/params, datum/tgui/ui) . = ..() if (.) return diff --git a/code/modules/tgui/module.dm b/code/modules/tgui/module.dm index 309c79ee2bc3..6aebc2669ea7 100644 --- a/code/modules/tgui/module.dm +++ b/code/modules/tgui/module.dm @@ -54,19 +54,18 @@ SIGNAL_HANDLER qdel(src) -/datum/tgui_module/ui_host(mob/user, datum/tgui_module/module) - return isnull(host)? src : host.ui_host(user, src) +/datum/tgui_module/ui_host() + return isnull(host)? src : host.ui_host() -/datum/tgui_module/ui_close(mob/user, datum/tgui_module/module) +/datum/tgui_module/on_ui_close(mob/user, datum/tgui/ui, embedded) . = ..() - host?.ui_close(user, src) if(ephemeral) qdel(src) -/datum/tgui_module/ui_state(mob/user, datum/tgui_module/module) - return isnull(host)? ..() : host.ui_state(user, src) +/datum/tgui_module/ui_state() + return isnull(host)? ..() : host.ui_state() -/datum/tgui_module/ui_status(mob/user, datum/ui_state/state, datum/tgui_module/module) +/datum/tgui_module/ui_status(mob/user, datum/ui_state/state) return isnull(host)? ..() : host.ui_status(user, state, src) /datum/tgui_module/ui_interact(mob/user, datum/tgui/ui, datum/tgui/parent_ui) @@ -78,21 +77,19 @@ /** * called directly, if operating standalone. routes to static_data(user), with all other args skipped. */ -/datum/tgui_module/ui_static_data(mob/user) +/datum/tgui_module/ui_static_data(mob/user, datum/tgui/ui) return static_data(user) /** * called directly, if operating standalone. routes to data(user), with all other args skipped. */ -/datum/tgui_module/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/datum/tgui_module/ui_data(mob/user, datum/tgui/ui) return data(user) /** * called directly, if operating standalone. */ /datum/tgui_module/ui_act(action, list/params, datum/tgui/ui) - // we only override this to provide comment - // yes yes proc overhead sue me it's called like 10k times a round, tops. return ..() /** @@ -109,87 +106,3 @@ */ /datum/tgui_module/proc/data(mob/user, ...) return list() - -/** - * route a received ui_act for module handling - * remember that $id, $ref in params corrosponds to module id, module ref. - * - * we use id instead of module to prevent potential security issues down the line. - */ -/datum/proc/ui_module_route(action, list/params, datum/tgui/ui, id) - if(!id) - // no id? - // i know that guy! - // it's me! - return ui_act(action, params, ui) - // it's not us, respect overrides that wish to hook module behavior - if(ui_module_act(action, params, ui, id)) - return TRUE - -/** - * called as a hook for intercepting ui acts from a module - * remember that $id, $ref in params corrosponds to module id, module ref. - * we don't provide $ref directly for security reasons. - * you can use it if you know what you're doing. - * - * this is an advanced proc. - * the module's ui_status() is *not* checked for you in ..()! - * - * return TRUE for ui update + prevent propagation to the module - */ -/datum/proc/ui_module_act(action, list/params, datum/tgui/ui, id) - SHOULD_CALL_PARENT(TRUE) - SEND_SIGNAL(src, COMSIG_UI_MODULE_ACT, usr, id, action, params, ui) - -/** - * called to inject ui module data. - * they will be handled by a separate reducer to make static data work. - * you can technically use this for things other than tgui_module's - * for example, for RIG/other "modular items-in-items" to hold data. - * - * this will be sent into data.modules.* instead of just data.* - * - * @params - * * user - user - * * ui - root tgui module is in - * * state - ui state - */ -/datum/proc/ui_module_data(mob/user, datum/tgui/ui, datum/ui_state/state) - return list() - -/** - * called to inject ui module static data. - * they will be handled by a separate reducer to make static data work. - * you can technically use this for things other than tgui_module's - * for example, for RIG/other "modular items-in-items" to hold data. - * - * this will be sent into data.modules[id].* instead of just data.* - * - * @params - * * user - user - * * ui - root tgui module is in - * * state - ui state - */ -/datum/proc/ui_module_static(mob/user, datum/tgui/ui, datum/ui_state/state) - return list() - -/** - * public - * - * Send an update to module data. - * As with normal data, this will be combined by a reducer - * to overwrite only where necessary, so partial pushes - * can work fine. - * - * WARNING: Do not use this unless you know what you are doing. - * - * @params - * * updates - list(id = list(data...), ...) of modules to update. - * * force - (optional) send update even if UI is not interactive - */ -/datum/tgui/proc/push_modules(list/updates, force) - if(isnull(user.client) || !initialized || closing) - return - if(!force && status < UI_UPDATE) - return - window.send_message("modules", updates) diff --git a/code/modules/tgui/modules/_base.dm b/code/modules/tgui/modules/_base.dm index b00a53707b54..b428b233b93f 100644 --- a/code/modules/tgui/modules/_base.dm +++ b/code/modules/tgui/modules/_base.dm @@ -23,9 +23,9 @@ Code is pretty much ripped verbatim from nano modules, but with un-needed stuff /datum/tgui_module_old/ui_host() return host ? host.ui_host() : src -/datum/tgui_module_old/ui_close(mob/user, datum/tgui_module/module) +/datum/tgui_module_old/on_ui_close(mob/user, datum/tgui/ui, embedded) if(host) - host.ui_close(user) + host.on_ui_close(user, ui, TRUE) /datum/tgui_module_old/proc/check_eye(mob/user) return -1 @@ -55,14 +55,14 @@ Code is pretty much ripped verbatim from nano modules, but with un-needed stuff return 0 -/datum/tgui_module_old/ui_static_data() +/datum/tgui_module_old/ui_static_data(mob/user, datum/tgui/ui) . = ..() var/obj/item/modular_computer/host = ui_host() if(istype(host)) . += host.get_header_data() -/datum/tgui_module_old/ui_act(action, params) +/datum/tgui_module_old/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/modules/tgui/modules/admin_shuttle_controller.dm b/code/modules/tgui/modules/admin_shuttle_controller.dm index aaf1c73ec506..1f542ffe80f3 100644 --- a/code/modules/tgui/modules/admin_shuttle_controller.dm +++ b/code/modules/tgui/modules/admin_shuttle_controller.dm @@ -4,7 +4,7 @@ name = "Admin Shuttle Controller" tgui_id = "AdminShuttleController" -/datum/tgui_module_old/admin_shuttle_controller/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/datum/tgui_module_old/admin_shuttle_controller/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() var/list/shuttles = list() @@ -29,7 +29,7 @@ return data -/datum/tgui_module_old/admin_shuttle_controller/ui_state(mob/user, datum/tgui_module/module) +/datum/tgui_module_old/admin_shuttle_controller/ui_state() return GLOB.tgui_admin_state /datum/tgui_module_old/admin_shuttle_controller/ui_act(action, list/params, datum/tgui/ui) diff --git a/code/modules/tgui/modules/agentcard.dm b/code/modules/tgui/modules/agentcard.dm index 7610d9c87cd8..ca4cf6eb8b57 100644 --- a/code/modules/tgui/modules/agentcard.dm +++ b/code/modules/tgui/modules/agentcard.dm @@ -2,7 +2,7 @@ name = "Agent Card" tgui_id = "AgentCard" -/datum/tgui_module_old/agentcard/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/datum/tgui_module_old/agentcard/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() var/obj/item/card/id/syndicate/S = ui_host() @@ -26,7 +26,7 @@ return data -/datum/tgui_module_old/agentcard/ui_status(mob/user, datum/ui_state/state, datum/tgui_module/module) +/datum/tgui_module_old/agentcard/ui_status(mob/user, datum/ui_state/state) var/obj/item/card/id/syndicate/S = ui_host() if(!istype(S)) return UI_CLOSE @@ -46,7 +46,7 @@ . = TRUE if("age") var/new_age = input(usr,"What age would you like to put on this card?","Agent Card Age", S.age) as null|num - if(!isnull(new_age) && ui_status(usr, state) == UI_INTERACTIVE) + if(!isnull(new_age) && ui?.still_interactive()) if(new_age < 0) S.age = initial(S.age) else @@ -55,14 +55,14 @@ . = TRUE if("appearance") var/datum/card_state/choice = input(usr, "Select the appearance for this card.", "Agent Card Appearance") as null|anything in id_card_states() - if(choice && ui_status(usr, state) == UI_INTERACTIVE) + if(choice && ui?.still_interactive()) S.icon_state = choice.icon_state S.item_state = choice.item_state to_chat(usr, "Appearance changed to [choice].") . = TRUE if("assignment") var/new_job = sanitize(input(usr,"What assignment would you like to put on this card?\nChanging assignment will not grant or remove any access levels.","Agent Card Assignment", S.assignment) as null|text) - if(!isnull(new_job) && ui_status(usr, state) == UI_INTERACTIVE) + if(!isnull(new_job) && ui?.still_interactive()) S.assignment = new_job to_chat(usr, "Occupation changed to '[new_job]'.") S.update_name() @@ -74,7 +74,7 @@ if(H.dna) default = H.dna.b_type var/new_blood_type = sanitize(input(usr,"What blood type would you like to be written on this card?","Agent Card Blood Type",default) as null|text) - if(!isnull(new_blood_type) && ui_status(usr, state) == UI_INTERACTIVE) + if(!isnull(new_blood_type) && ui?.still_interactive()) S.blood_type = new_blood_type to_chat(usr, "Blood type changed to '[new_blood_type]'.") . = TRUE @@ -85,7 +85,7 @@ if(H.dna) default = H.dna.unique_enzymes var/new_dna_hash = sanitize(input(usr,"What DNA hash would you like to be written on this card?","Agent Card DNA Hash",default) as null|text) - if(!isnull(new_dna_hash) && ui_status(usr, state) == UI_INTERACTIVE) + if(!isnull(new_dna_hash) && ui?.still_interactive()) S.dna_hash = new_dna_hash to_chat(usr, "DNA hash changed to '[new_dna_hash]'.") . = TRUE @@ -96,13 +96,13 @@ if(H.dna) default = md5(H.dna.uni_identity) var/new_fingerprint_hash = sanitize(input(usr,"What fingerprint hash would you like to be written on this card?","Agent Card Fingerprint Hash",default) as null|text) - if(!isnull(new_fingerprint_hash) && ui_status(usr, state) == UI_INTERACTIVE) + if(!isnull(new_fingerprint_hash) && ui?.still_interactive()) S.fingerprint_hash = new_fingerprint_hash to_chat(usr, "Fingerprint hash changed to '[new_fingerprint_hash]'.") . = TRUE if("name") var/new_name = sanitizeName(input(usr,"What name would you like to put on this card?","Agent Card Name", S.registered_name) as null|text) - if(!isnull(new_name) && ui_status(usr, state) == UI_INTERACTIVE) + if(!isnull(new_name) && ui?.still_interactive()) S.registered_name = new_name S.update_name() to_chat(usr, "Name changed to '[new_name]'.") @@ -113,12 +113,12 @@ . = TRUE if("sex") var/new_sex = sanitize(input(usr,"What sex would you like to put on this card?","Agent Card Sex", S.sex) as null|text) - if(!isnull(new_sex) && ui_status(usr, state) == UI_INTERACTIVE) + if(!isnull(new_sex) && ui?.still_interactive()) S.sex = new_sex to_chat(usr, "Sex changed to '[new_sex]'.") . = TRUE if("factoryreset") - if(alert("This will factory reset the card, including access and owner. Continue?", "Factory Reset", "No", "Yes") == "Yes" && ui_status(usr, state) == UI_INTERACTIVE) + if(alert("This will factory reset the card, including access and owner. Continue?", "Factory Reset", "No", "Yes") == "Yes" && ui?.still_interactive()) S.age = initial(S.age) S.access = syndicate_access.Copy() S.assignment = initial(S.assignment) diff --git a/code/modules/tgui/modules/alarm.dm b/code/modules/tgui/modules/alarm.dm index f2d98da5b781..b3f389eb79d8 100644 --- a/code/modules/tgui/modules/alarm.dm +++ b/code/modules/tgui/modules/alarm.dm @@ -17,11 +17,11 @@ // Subtype for glasses_state /datum/tgui_module_old/alarm_monitor/all/glasses -/datum/tgui_module_old/alarm_monitor/all/glasses/ui_state(mob/user, datum/tgui_module/module) +/datum/tgui_module_old/alarm_monitor/all/glasses/ui_state() return GLOB.glasses_state /datum/tgui_module_old/alarm_monitor/all/robot -/datum/tgui_module_old/alarm_monitor/all/robot/ui_state(mob/user, datum/tgui_module/module) +/datum/tgui_module_old/alarm_monitor/all/robot/ui_state() return GLOB.self_state /datum/tgui_module_old/alarm_monitor/engineering @@ -31,12 +31,12 @@ // Subtype for glasses_state /datum/tgui_module_old/alarm_monitor/engineering/glasses -/datum/tgui_module_old/alarm_monitor/engineering/glasses/ui_state(mob/user, datum/tgui_module/module) +/datum/tgui_module_old/alarm_monitor/engineering/glasses/ui_state() return GLOB.glasses_state // Subtype for nif_state /datum/tgui_module_old/alarm_monitor/engineering/nif -/datum/tgui_module_old/alarm_monitor/engineering/nif/ui_state(mob/user, datum/tgui_module/module) +/datum/tgui_module_old/alarm_monitor/engineering/nif/ui_state() return GLOB.nif_state // Subtype for NTOS @@ -50,7 +50,7 @@ // Subtype for glasses_state /datum/tgui_module_old/alarm_monitor/security/glasses -/datum/tgui_module_old/alarm_monitor/security/glasses/ui_state(mob/user, datum/tgui_module/module) +/datum/tgui_module_old/alarm_monitor/security/glasses/ui_state() return GLOB.glasses_state // Subtype for NTOS @@ -97,7 +97,7 @@ return all_alarms -/datum/tgui_module_old/alarm_monitor/ui_act(action, params) +/datum/tgui_module_old/alarm_monitor/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE @@ -115,7 +115,7 @@ usr.switch_to_camera(C) return 1 -/datum/tgui_module_old/alarm_monitor/ui_data(mob/user) +/datum/tgui_module_old/alarm_monitor/ui_data(mob/user, datum/tgui/ui) var/list/data = list() var/categories[0] diff --git a/code/modules/tgui/modules/appearance_changer.dm b/code/modules/tgui/modules/appearance_changer.dm index d0e1ee1aaf69..3fe3b57b09bc 100644 --- a/code/modules/tgui/modules/appearance_changer.dm +++ b/code/modules/tgui/modules/appearance_changer.dm @@ -299,7 +299,7 @@ if(custom_state) ui.set_state(custom_state) -/datum/tgui_module_old/appearance_changer/ui_static_data(mob/user) +/datum/tgui_module_old/appearance_changer/ui_static_data(mob/user, datum/tgui/ui) var/list/data = ..() generate_data(usr) @@ -327,7 +327,7 @@ return data -/datum/tgui_module_old/appearance_changer/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/datum/tgui_module_old/appearance_changer/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() generate_data(user) @@ -390,7 +390,7 @@ data["facial_hair_color"] = rgb(target.r_facial, target.g_facial, target.b_facial) return data -/datum/tgui_module_old/appearance_changer/ui_static_data(mob/user) +/datum/tgui_module_old/appearance_changer/ui_static_data(mob/user, datum/tgui/ui) var/list/data = ..() data["mapRef"] = map_name return data diff --git a/code/modules/tgui/modules/appearance_changer_vr.dm b/code/modules/tgui/modules/appearance_changer_vr.dm index dcfe37cdc94c..e6e78817b839 100644 --- a/code/modules/tgui/modules/appearance_changer_vr.dm +++ b/code/modules/tgui/modules/appearance_changer_vr.dm @@ -2,10 +2,10 @@ name = "Appearance Editor (Vore)" flags = APPEARANCE_ALL -/datum/tgui_module_old/appearance_changer/vore/ui_state(mob/user, datum/tgui_module/module) +/datum/tgui_module_old/appearance_changer/vore/ui_state() return GLOB.tgui_conscious_state -/datum/tgui_module_old/appearance_changer/vore/ui_status(mob/user, datum/ui_state/state, datum/tgui_module/module) +/datum/tgui_module_old/appearance_changer/vore/ui_status(mob/user, datum/ui_state/state) if(!isbelly(owner.loc)) return UI_CLOSE return ..() @@ -16,7 +16,7 @@ cam_background.fill_rect(1, 1, 1, 1) local_skybox.cut_overlays() -/datum/tgui_module_old/appearance_changer/vore/ui_close(mob/user, datum/tgui_module/module) +/datum/tgui_module_old/appearance_changer/vore/on_ui_close(mob/user, datum/tgui/ui, embedded) . = ..() QDEL_IN(src, 1) diff --git a/code/modules/tgui/modules/atmos_control.dm b/code/modules/tgui/modules/atmos_control.dm index 8ad661055a30..cb3685a6eaff 100644 --- a/code/modules/tgui/modules/atmos_control.dm +++ b/code/modules/tgui/modules/atmos_control.dm @@ -18,7 +18,7 @@ // machines may not yet be ordered at this point monitored_alarms = dd_sortedObjectList(monitored_alarms) -/datum/tgui_module_old/atmos_control/ui_act(action, params, datum/tgui/ui) +/datum/tgui_module_old/atmos_control/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE @@ -45,7 +45,7 @@ ui.open() ui_ref = ui -/datum/tgui_module_old/atmos_control/ui_static_data(mob/user) +/datum/tgui_module_old/atmos_control/ui_static_data(mob/user, datum/tgui/ui) . = ..() var/z = get_z(user) @@ -67,7 +67,7 @@ "z" = alarm.z) .["alarms"] = alarms -/datum/tgui_module_old/atmos_control/ui_data(mob/user) +/datum/tgui_module_old/atmos_control/ui_data(mob/user, datum/tgui/ui) var/list/data = list() var/z = get_z(user) @@ -76,7 +76,7 @@ return data -/datum/tgui_module_old/atmos_control/ui_close() +/datum/tgui_module_old/atmos_control/on_ui_close(mob/user, datum/tgui/ui, embedded) . = ..() ui_ref = null @@ -110,5 +110,5 @@ ntos = TRUE /datum/tgui_module_old/atmos_control/robot -/datum/tgui_module_old/atmos_control/robot/ui_state(mob/user, datum/tgui_module/module) +/datum/tgui_module_old/atmos_control/robot/ui_state() return GLOB.self_state diff --git a/code/modules/tgui/modules/camera.dm b/code/modules/tgui/modules/camera.dm index 7ea016037afa..0c17cfd2a7f5 100644 --- a/code/modules/tgui/modules/camera.dm +++ b/code/modules/tgui/modules/camera.dm @@ -102,7 +102,7 @@ ui = new(user, src, tgui_id, name) ui.open() -/datum/tgui_module_old/camera/ui_data() +/datum/tgui_module_old/camera/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["activeCamera"] = null if(active_camera) @@ -112,7 +112,7 @@ ) return data -/datum/tgui_module_old/camera/ui_static_data(mob/user) +/datum/tgui_module_old/camera/ui_static_data(mob/user, datum/tgui/ui) var/list/data = ..() data["mapRef"] = map_name var/list/cameras = get_available_cameras(user) @@ -127,7 +127,7 @@ data["allNetworks"] |= C.network return data -/datum/tgui_module_old/camera/ui_act(action, params) +/datum/tgui_module_old/camera/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE @@ -260,7 +260,7 @@ cam_background.icon_state = "scanline2" cam_background.fill_rect(1, 1, default_map_size, default_map_size) -/datum/tgui_module_old/camera/ui_close(mob/user, datum/tgui_module/module) +/datum/tgui_module_old/camera/on_ui_close(mob/user, datum/tgui/ui, embedded) . = ..() var/user_ref = REF(user) var/is_living = isliving(user) diff --git a/code/modules/tgui/modules/communications.dm b/code/modules/tgui/modules/communications.dm index 475a72c57929..4ccf0ff79fec 100644 --- a/code/modules/tgui/modules/communications.dm +++ b/code/modules/tgui/modules/communications.dm @@ -84,7 +84,7 @@ feedback_inc("alert_comms_blue",1) tmp_alertlevel = 0 -/datum/tgui_module_old/communications/ui_data(mob/user) +/datum/tgui_module_old/communications/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["is_ai"] = isAI(user) || isrobot(user) data["menu_state"] = data["is_ai"] ? ai_menu_state : menu_state @@ -194,7 +194,7 @@ frequency.post_signal(null, status_signal) -/datum/tgui_module_old/communications/ui_act(action, params) +/datum/tgui_module_old/communications/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE if((LEGACY_MAP_DATUM) && !(get_z(usr) in (LEGACY_MAP_DATUM).contact_levels)) diff --git a/code/modules/tgui/modules/crew_manifest.dm b/code/modules/tgui/modules/crew_manifest.dm index 93c60f980e94..311036a3d032 100644 --- a/code/modules/tgui/modules/crew_manifest.dm +++ b/code/modules/tgui/modules/crew_manifest.dm @@ -2,7 +2,7 @@ name = "Crew Manifest" tgui_id = "CrewManifest" -/datum/tgui_module_old/crew_manifest/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/datum/tgui_module_old/crew_manifest/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() if(data_core) data_core.get_manifest_list() @@ -10,5 +10,5 @@ return data /datum/tgui_module_old/crew_manifest/robot -/datum/tgui_module_old/crew_manifest/robot/ui_state(mob/user, datum/tgui_module/module) +/datum/tgui_module_old/crew_manifest/robot/ui_state() return GLOB.self_state diff --git a/code/modules/tgui/modules/crew_monitor.dm b/code/modules/tgui/modules/crew_monitor.dm index 7bdde5185b66..c7877af28a64 100644 --- a/code/modules/tgui/modules/crew_monitor.dm +++ b/code/modules/tgui/modules/crew_monitor.dm @@ -7,7 +7,7 @@ get_asset_datum(/datum/asset/simple/nanomaps), ) -/datum/tgui_module_old/crew_monitor/ui_act(action, params, datum/tgui/ui) +/datum/tgui_module_old/crew_monitor/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE @@ -45,7 +45,7 @@ ui.open() -/datum/tgui_module_old/crew_monitor/ui_data(mob/user) +/datum/tgui_module_old/crew_monitor/ui_data(mob/user, datum/tgui/ui) var/data[0] data["isAI"] = isAI(user) @@ -71,15 +71,15 @@ // Subtype for glasses_state /datum/tgui_module_old/crew_monitor/glasses -/datum/tgui_module_old/crew_monitor/glasses/ui_state(mob/user, datum/tgui_module/module) +/datum/tgui_module_old/crew_monitor/glasses/ui_state() return GLOB.glasses_state // Subtype for self_state /datum/tgui_module_old/crew_monitor/robot -/datum/tgui_module_old/crew_monitor/robot/ui_state(mob/user, datum/tgui_module/module) +/datum/tgui_module_old/crew_monitor/robot/ui_state() return GLOB.self_state // Subtype for nif_state /datum/tgui_module_old/crew_monitor/nif -/datum/tgui_module_old/crew_monitor/nif/ui_state(mob/user, datum/tgui_module/module) +/datum/tgui_module_old/crew_monitor/nif/ui_state() return GLOB.nif_state diff --git a/code/modules/tgui/modules/general/cardmod.dm b/code/modules/tgui/modules/general/cardmod.dm index 8159736558c7..579cc6a645a3 100644 --- a/code/modules/tgui/modules/general/cardmod.dm +++ b/code/modules/tgui/modules/general/cardmod.dm @@ -432,7 +432,7 @@ */ /datum/tgui_module/card_mod/admin -/datum/tgui_module/card_mod/admin/ui_state(mob/user, datum/tgui_module/module) +/datum/tgui_module/card_mod/admin/ui_state() return GLOB.admin_state diff --git a/code/modules/tgui/modules/gyrotron_control.dm b/code/modules/tgui/modules/gyrotron_control.dm index ed6134e02b10..8b5fdf5af11a 100644 --- a/code/modules/tgui/modules/gyrotron_control.dm +++ b/code/modules/tgui/modules/gyrotron_control.dm @@ -5,7 +5,7 @@ var/gyro_tag = "" var/scan_range = 25 -/datum/tgui_module_old/gyrotron_control/ui_act(action, params) +/datum/tgui_module_old/gyrotron_control/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE @@ -43,7 +43,7 @@ G.rate = new_delay return TRUE -/datum/tgui_module_old/gyrotron_control/ui_data(mob/user) +/datum/tgui_module_old/gyrotron_control/ui_data(mob/user, datum/tgui/ui) var/list/data = list() var/list/gyros = list() diff --git a/code/modules/tgui/modules/law_manager.dm b/code/modules/tgui/modules/law_manager.dm index f191650502a3..6185b8fb798a 100644 --- a/code/modules/tgui/modules/law_manager.dm +++ b/code/modules/tgui/modules/law_manager.dm @@ -145,7 +145,7 @@ owner.lawsync() return ..() // 800, is_malf(user) ? 600 : 400 -/datum/tgui_module_old/law_manager/ui_data(mob/user) +/datum/tgui_module_old/law_manager/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["ion_law_nr"] = ionnum() @@ -216,9 +216,9 @@ log_and_message_admins("has syncronized [AI]'s laws with its borgs.") /datum/tgui_module_old/law_manager/robot -/datum/tgui_module_old/law_manager/robot/ui_state(mob/user, datum/tgui_module/module) +/datum/tgui_module_old/law_manager/robot/ui_state() return GLOB.tgui_self_state /datum/tgui_module_old/law_manager/admin -/datum/tgui_module_old/law_manager/admin/ui_state(mob/user, datum/tgui_module/module) +/datum/tgui_module_old/law_manager/admin/ui_state() return GLOB.tgui_admin_state diff --git a/code/modules/tgui/modules/ntos-only/configurator.dm b/code/modules/tgui/modules/ntos-only/configurator.dm index fe977f4cc427..8397c3bde8d9 100644 --- a/code/modules/tgui/modules/ntos-only/configurator.dm +++ b/code/modules/tgui/modules/ntos-only/configurator.dm @@ -4,7 +4,7 @@ tgui_id = "Configuration" var/obj/item/modular_computer/movable = null -/datum/tgui_module_old/computer_configurator/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/datum/tgui_module_old/computer_configurator/ui_data(mob/user, datum/tgui/ui) movable = ui_host() // No computer connection, we can't get data from that. if(!istype(movable)) @@ -37,7 +37,7 @@ data["hardware"] = all_entries return data -/datum/tgui_module_old/computer_configurator/ui_act(action, params) +/datum/tgui_module_old/computer_configurator/ui_act(action, list/params, datum/tgui/ui) if(..()) return switch(action) diff --git a/code/modules/tgui/modules/ntos-only/email.dm b/code/modules/tgui/modules/ntos-only/email.dm index 9ebabf6e783b..ad1f1e14d2ed 100644 --- a/code/modules/tgui/modules/ntos-only/email.dm +++ b/code/modules/tgui/modules/ntos-only/email.dm @@ -67,7 +67,7 @@ last_message_count = 0 read_message_count = 0 -/datum/tgui_module_old/email_client/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/datum/tgui_module_old/email_client/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() // Password has been changed by other client connected to this email account @@ -228,7 +228,7 @@ return 1 -/datum/tgui_module_old/email_client/ui_act(action, params) +/datum/tgui_module_old/email_client/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/modules/tgui/modules/ntos-only/uav.dm b/code/modules/tgui/modules/ntos-only/uav.dm index 469a95e7e43e..e216f4cece56 100644 --- a/code/modules/tgui/modules/ntos-only/uav.dm +++ b/code/modules/tgui/modules/ntos-only/uav.dm @@ -8,7 +8,7 @@ var/list/viewers //Who's viewing a UAV through us var/adhoc_range = 30 //How far we can operate on a UAV without NTnet -/datum/tgui_module_old/uav/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/datum/tgui_module_old/uav/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() if(current_uav) @@ -180,7 +180,7 @@ unlook(M) . = ..() -/datum/tgui_module_old/uav/ui_status(mob/user) +/datum/tgui_module_old/uav/ui_status(mob/user, datum/ui_state/state) . = ..() if(. > UI_DISABLED) if(viewing_uav(user)) @@ -188,7 +188,7 @@ return unlook(user) -/datum/tgui_module_old/uav/ui_close(mob/user, datum/tgui_module/module) +/datum/tgui_module_old/uav/on_ui_close(mob/user, datum/tgui/ui, embedded) . = ..() unlook(user) diff --git a/code/modules/tgui/modules/overmap.dm b/code/modules/tgui/modules/overmap.dm index 6b103836152f..0797e416d5c7 100644 --- a/code/modules/tgui/modules/overmap.dm +++ b/code/modules/tgui/modules/overmap.dm @@ -17,7 +17,7 @@ unlook(M) . = ..() -/datum/tgui_module_old/ship/ui_status(mob/user) +/datum/tgui_module_old/ship/ui_status(mob/user, datum/ui_state/state) . = ..() if(. > UI_DISABLED) if(viewing_overmap(user)) @@ -25,7 +25,7 @@ return unlook(user) -/datum/tgui_module_old/ship/ui_close(mob/user, datum/tgui_module/module) +/datum/tgui_module_old/ship/on_ui_close(mob/user, datum/tgui/ui, embedded) . = ..() user.unset_machine() unlook(user) @@ -102,7 +102,7 @@ . = ..() -/datum/tgui_module_old/ship/nav/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/datum/tgui_module_old/ship/nav/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() var/turf/T = get_turf(linked) @@ -124,7 +124,7 @@ return data -/datum/tgui_module_old/ship/nav/ui_act(action, params) +/datum/tgui_module_old/ship/nav/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE @@ -153,7 +153,7 @@ // SENSORS var/obj/machinery/shipsensors/sensors -/datum/tgui_module_old/ship/fullmonty/ui_state(mob/user, datum/tgui_module/module) +/datum/tgui_module_old/ship/fullmonty/ui_state() return GLOB.admin_state /datum/tgui_module_old/ship/fullmonty/New(host, obj/overmap/entity/visitable/ship/new_linked) @@ -178,7 +178,7 @@ break // Beware ye eyes. This holds all of the data from helm, engine, and sensor control all at once. -/datum/tgui_module_old/ship/fullmonty/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/datum/tgui_module_old/ship/fullmonty/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() // HELM @@ -294,7 +294,7 @@ return data // Beware ye eyes. This holds all of the ACTIONS from helm, engine, and sensor control all at once. -/datum/tgui_module_old/ship/fullmonty/ui_act(action, params) +/datum/tgui_module_old/ship/fullmonty/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/modules/tgui/modules/power_monitor.dm b/code/modules/tgui/modules/power_monitor.dm index 4873addbd516..88f1be5ae002 100644 --- a/code/modules/tgui/modules/power_monitor.dm +++ b/code/modules/tgui/modules/power_monitor.dm @@ -8,7 +8,7 @@ . = ..() refresh_sensors() -/datum/tgui_module_old/power_monitor/ui_data(mob/user) +/datum/tgui_module_old/power_monitor/ui_data(mob/user, datum/tgui/ui) var/list/data = list() var/list/sensors = list() @@ -37,7 +37,7 @@ return data -/datum/tgui_module_old/power_monitor/ui_act(action, params) +/datum/tgui_module_old/power_monitor/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE @@ -81,5 +81,5 @@ // Subtype for self_state /datum/tgui_module_old/power_monitor/robot -/datum/tgui_module_old/power_monitor/robot/ui_state(mob/user, datum/tgui_module/module) +/datum/tgui_module_old/power_monitor/robot/ui_state() return GLOB.self_state diff --git a/code/modules/tgui/modules/rcon.dm b/code/modules/tgui/modules/rcon.dm index 5e59aec524f7..319d440a38f9 100644 --- a/code/modules/tgui/modules/rcon.dm +++ b/code/modules/tgui/modules/rcon.dm @@ -16,7 +16,7 @@ GLOBAL_LIST_EMPTY(tgui_old_rcon_modules) GLOB.tgui_old_rcon_modules -= src -/datum/tgui_module_old/rcon/ui_data(mob/user) +/datum/tgui_module_old/rcon/ui_data(mob/user, datum/tgui/ui) FindDevices() // Update our devices list var/list/data = ..() @@ -40,7 +40,7 @@ GLOBAL_LIST_EMPTY(tgui_old_rcon_modules) return data -/datum/tgui_module_old/rcon/ui_act(action, params) +/datum/tgui_module_old/rcon/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE @@ -119,5 +119,5 @@ GLOBAL_LIST_EMPTY(tgui_old_rcon_modules) ntos = TRUE /datum/tgui_module_old/rcon/robot -/datum/tgui_module_old/rcon/robot/ui_state(mob/user, datum/tgui_module/module) +/datum/tgui_module_old/rcon/robot/ui_state() return GLOB.self_state diff --git a/code/modules/tgui/modules/rustcore_monitor.dm b/code/modules/tgui/modules/rustcore_monitor.dm index 0b8ddee4e95d..c693b3b5673f 100644 --- a/code/modules/tgui/modules/rustcore_monitor.dm +++ b/code/modules/tgui/modules/rustcore_monitor.dm @@ -4,7 +4,7 @@ var/core_tag = "" -/datum/tgui_module_old/rustcore_monitor/ui_act(action, params) +/datum/tgui_module_old/rustcore_monitor/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE @@ -35,7 +35,7 @@ C.target_field_strength = new_strength return TRUE -/datum/tgui_module_old/rustcore_monitor/ui_data(mob/user) +/datum/tgui_module_old/rustcore_monitor/ui_data(mob/user, datum/tgui/ui) var/list/data = list() var/list/cores = list() diff --git a/code/modules/tgui/modules/rustfuel_control.dm b/code/modules/tgui/modules/rustfuel_control.dm index 43eb928c4704..6caed63dda22 100644 --- a/code/modules/tgui/modules/rustfuel_control.dm +++ b/code/modules/tgui/modules/rustfuel_control.dm @@ -4,7 +4,7 @@ var/fuel_tag = "" -/datum/tgui_module_old/rustfuel_control/ui_act(action, params) +/datum/tgui_module_old/rustfuel_control/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE @@ -26,7 +26,7 @@ if(new_ident) fuel_tag = new_ident -/datum/tgui_module_old/rustfuel_control/ui_data(mob/user) +/datum/tgui_module_old/rustfuel_control/ui_data(mob/user, datum/tgui/ui) var/list/data = list() var/list/fuels = list() diff --git a/code/modules/tgui/modules/shutoff_monitor.dm b/code/modules/tgui/modules/shutoff_monitor.dm index 78db2be14dc8..ca557c0cd3b5 100644 --- a/code/modules/tgui/modules/shutoff_monitor.dm +++ b/code/modules/tgui/modules/shutoff_monitor.dm @@ -2,7 +2,7 @@ name = "Shutoff Valve Monitoring" tgui_id = "ShutoffMonitor" -/datum/tgui_module_old/shutoff_monitor/ui_act(action, params) +/datum/tgui_module_old/shutoff_monitor/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE @@ -24,7 +24,7 @@ S.open() return TRUE -/datum/tgui_module_old/shutoff_monitor/ui_data(mob/user) +/datum/tgui_module_old/shutoff_monitor/ui_data(mob/user, datum/tgui/ui) var/list/data = list() var/list/valves = list() diff --git a/code/modules/tgui/modules/supermatter_monitor.dm b/code/modules/tgui/modules/supermatter_monitor.dm index 43df17079fa1..bc7d11c67657 100644 --- a/code/modules/tgui/modules/supermatter_monitor.dm +++ b/code/modules/tgui/modules/supermatter_monitor.dm @@ -35,7 +35,7 @@ for(var/obj/machinery/power/supermatter/S in supermatters) . = max(., S.get_status()) -/datum/tgui_module_old/supermatter_monitor/ui_data(mob/user) +/datum/tgui_module_old/supermatter_monitor/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() if(istype(active)) @@ -88,7 +88,7 @@ return data -/datum/tgui_module_old/supermatter_monitor/ui_act(action, params) +/datum/tgui_module_old/supermatter_monitor/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/modules/tgui/modules/teleporter.dm b/code/modules/tgui/modules/teleporter.dm index 67e8574dc810..fb2593986820 100644 --- a/code/modules/tgui/modules/teleporter.dm +++ b/code/modules/tgui/modules/teleporter.dm @@ -6,7 +6,7 @@ var/obj/machinery/tele_projector/station = null var/obj/machinery/tele_pad/hub = null -/datum/tgui_module_old/teleport_control/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/datum/tgui_module_old/teleport_control/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["locked_name"] = locked_name || "No Target" @@ -17,7 +17,7 @@ return data -/datum/tgui_module_old/teleport_control/ui_act(action, params, datum/tgui/ui, datum/ui_state/state) +/datum/tgui_module_old/teleport_control/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/modules/tgui/states.dm b/code/modules/tgui/states.dm index 7d927e799fcb..4bd764aed527 100644 --- a/code/modules/tgui/states.dm +++ b/code/modules/tgui/states.dm @@ -6,37 +6,6 @@ *! SPDX-License-Identifier: MIT */ -/** - * public - * - * Checks the UI state for a mob. - * - * required user mob The mob who opened/is using the UI. - * required state datum/ui_state The state to check. - * - * return UI_state The state of the UI. - */ -/datum/proc/ui_status(mob/user, datum/ui_state/state, datum/tgui_module/module) - var/src_object = ui_host(user) - . = UI_CLOSE - if(!state) - return - - if(isobserver(user)) - // If they turn on ghost AI control, admins can always interact. - if(IsAdminGhost(user)) - . = max(., UI_INTERACTIVE) - - // Regular ghosts can always at least view if in range. - if(user.client) - // todo: in view range for zooming - if(get_dist(src_object, user) < max(CEILING(user.client.current_viewport_width / 2, 1), CEILING(user.client.current_viewport_height / 2, 1))) - . = max(., UI_UPDATE) - - // Check if the state allows interaction - var/result = state.can_use_topic(src_object, user) - . = max(., result) - /** * private * diff --git a/code/modules/tgui/tgui.dm b/code/modules/tgui/tgui.dm index 19c6f57db738..8e806bb64c9b 100644 --- a/code/modules/tgui/tgui.dm +++ b/code/modules/tgui/tgui.dm @@ -38,10 +38,18 @@ /// Are byond mouse events beyond the window passed in to the ui var/mouse_hooked = FALSE /// The Parent UI + //? STOP USING THIS. USE MODULES. ~SILICONS var/datum/tgui/parent_ui /// Children of this UI + //? STOP USING THIS. USE MODULES. ~SILICONS var/list/children = list() + //* Modules *// + /// datums to IDs + var/list/datum/modules_registered + /// processed modules + var/list/datum/modules_processed + /** * public * @@ -73,6 +81,8 @@ /datum/tgui/Destroy() user = null src_object = null + for(var/datum/module in modules_registered) + unregister_module(module) return ..() /** @@ -125,6 +135,10 @@ if(mouse_hooked) window.set_mouse_macro() SStgui.on_open(src) + // todo: should these hooks be here? + src_object.on_ui_open(user, src) + for(var/datum/module as anything in modules_registered) + module.on_ui_open(user, src, TRUE) return TRUE /** @@ -146,12 +160,15 @@ // the error message properly. window.release_lock() window.close(can_be_suspended) - src_object.ui_close(user) SStgui.on_close(src) state = null if(parent_ui) parent_ui.children -= src parent_ui = null + // todo: should these hooks be here? + src_object.on_ui_close(user, src) + for(var/datum/module as anything in modules_registered) + module.on_ui_close(user, src, TRUE) qdel(src) /** @@ -169,6 +186,8 @@ * * Enable/disable passing through byond mouse events to the window * + * todo: this is like the least documented proc in history wtf + * * required value bool Enable/disable hooking. */ /datum/tgui/proc/set_mouse_hook(value) @@ -240,24 +259,6 @@ with_data = should_update_data, )) -/** - * public - * - * Send a partial update to the client of only the provided data lists - * Does not update config at all - * - * WARNING: Do not use this unless you know what you are doing - * - * required data The data to send - * optional force bool Send an update even if UI is not interactive. - */ -/datum/tgui/proc/push_data(data, force) - if(!user.client || !initialized || closing) - return - if(!force && status < UI_UPDATE) - return - window.send_message("data", data) - /** * private * @@ -287,14 +288,18 @@ "observer" = isobserver(user), ), ) - var/list/modules + var/list/modules = list() // static first if(with_static_data) json_data["static"] = src_object.ui_static_data(user, src, state) - modules = src_object.ui_module_static(user, src, state) + for(var/datum/module as anything in modules_registered) + var/id = modules_registered[module] + modules[id] = module.ui_static_data(user, src, TRUE) if(with_data) json_data["data"] = src_object.ui_data(user, src, state) - modules = (modules || list()) | src_object.ui_module_data(user, src, state) + for(var/datum/module as anything in (with_static_data? modules_registered : modules_processed)) + var/id = modules_registered[module] + modules[id] = modules[id] | module.ui_data(user, src, TRUE) if(modules) json_data["modules"] = modules if(src_object.tgui_shared_states) @@ -383,7 +388,7 @@ // we're kind of stuck doing this // maybe in the future we'll just have ui modules list but for now // eh. - if(src_object.ui_module_route(action, payload, src, id)) + if(src_object.ui_route(action, payload, src, id)) SStgui.update_uis(src_object) return FALSE switch(type) @@ -407,3 +412,100 @@ LAZYINITLIST(src_object.tgui_shared_states) src_object.tgui_shared_states[href_list["key"]] = href_list["value"] SStgui.update_uis(src_object) + +//* Advanced API - Updates *// + +/** + * public + * + * Send a partial update to the client of only the provided data lists + * Does not update config at all + * + * WARNING: Do not use this unless you know what you are doing + * + * required data The data to send + * optional force bool Send an update even if UI is not interactive. + */ +/datum/tgui/proc/push_data(data, force) + if(!user.client || !initialized || closing) + return + if(!force && status < UI_UPDATE) + return + window.send_message("data", data) + +/** + * public + * + * Send an update to module data. + * As with normal data, this will be combined by a reducer + * to overwrite only where necessary, so partial pushes + * can work fine. + * + * WARNING: Do not use this unless you know what you are doing. + * + * @params + * * updates - list(id = list(data...), ...) of modules to update. + * * force - (optional) send update even if UI is not interactive + */ +/datum/tgui/proc/push_modules(list/updates, force) + if(isnull(user.client) || !initialized || closing) + return + if(!force && status < UI_UPDATE) + return + window.send_message("modules", updates) + +//* Module System *// + +/** + * Registers a datum as a module into this UI. + * + * @params + * * module - the module in question + * * id - the id to use for the module + * * interface - the interface identifier (e.g. TGUILatheContrrol) + * * process - should this be a processed / auto updated module? + */ +/datum/tgui/proc/register_module(datum/module, id, interface, process = TRUE) + if(isnull(interface) && istype(module, /datum/tgui_module)) + var/datum/tgui_module/actual_module = module + interface = actual_module.tgui_id + LAZYINITLIST(modules_registered) + modules_registered[module] = id + if(process) + LAZYINITLIST(modules_processed) + modules_processed += module + RegisterSignal(module, COMSIG_PARENT_QDELETING, PROC_REF(module_deleted)) + RegisterSignal(module, COMSIG_DATUM_PUSH_UI_DATA, PROC_REF(module_send_data)) + +/datum/tgui/proc/unregister_module(datum/module) + modules_processed -= module + modules_registered -= module + UnregisterSignal(module, list( + COMSIG_PARENT_QDELETING, + COMSIG_DATUM_PUSH_UI_DATA, + )) + +/datum/tgui/proc/module_deleted(datum/source) + SIGNAL_HANDLER + unregister_module(source) + +/datum/tgui/proc/module_send_data(datum/source, mob/user, datum/tgui/ui, list/data) + if(!isnull(user) && user != user) + return + if(!isnull(ui) && ui != src) + return + // todo: this is force because otherwise static data can be desynced. should static data be on another proc instead? + push_modules( + updates = list( + (modules_registered[source]) = data, + ), + force = TRUE, + ) + +//* Helpers - Invoked from ui_act() *// + +/** + * Lazy check to see if the host window is still interactive. + */ +/datum/tgui/proc/still_interactive() + return status == UI_INTERACTIVE diff --git a/code/modules/virus2/centrifuge.dm b/code/modules/virus2/centrifuge.dm index a5b13f61c395..ffe41f72a5b9 100644 --- a/code/modules/virus2/centrifuge.dm +++ b/code/modules/virus2/centrifuge.dm @@ -42,7 +42,7 @@ ui = new(user, src, "IsolationCentrifuge", name) ui.open() -/obj/machinery/computer/centrifuge/ui_data(mob/user) +/obj/machinery/computer/centrifuge/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["antibodies"] = null data["pathogens"] = list() @@ -90,7 +90,7 @@ if(isolating == 0) isolate() -/obj/machinery/computer/centrifuge/ui_act(action, params) +/obj/machinery/computer/centrifuge/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/modules/virus2/diseasesplicer.dm b/code/modules/virus2/diseasesplicer.dm index 4541157455be..b2a1e2ef5d2b 100644 --- a/code/modules/virus2/diseasesplicer.dm +++ b/code/modules/virus2/diseasesplicer.dm @@ -49,7 +49,7 @@ ui = new(user, src, "DiseaseSplicer", name) ui.open() -/obj/machinery/computer/diseasesplicer/ui_data(mob/user) +/obj/machinery/computer/diseasesplicer/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["dish_inserted"] = !!dish diff --git a/code/modules/virus2/isolator.dm b/code/modules/virus2/isolator.dm index c4b98f30f337..ea48c01a5ede 100644 --- a/code/modules/virus2/isolator.dm +++ b/code/modules/virus2/isolator.dm @@ -52,7 +52,7 @@ ui = new(user, src, "PathogenicIsolator", name) ui.open() -/obj/machinery/disease2/isolator/ui_data(mob/user) +/obj/machinery/disease2/isolator/ui_data(mob/user, datum/tgui/ui) var/list/data = list() data["syringe_inserted"] = !!sample data["isolating"] = isolating @@ -100,7 +100,7 @@ SStgui.update_uis(src) update_icon() -/obj/machinery/disease2/isolator/ui_act(action, list/params) +/obj/machinery/disease2/isolator/ui_act(action, list/params, datum/tgui/ui) if(..()) return TRUE diff --git a/code/modules/xenoarcheaology/artifacts/replicator.dm b/code/modules/xenoarcheaology/artifacts/replicator.dm index 057630e05b21..3e95e22d74fe 100644 --- a/code/modules/xenoarcheaology/artifacts/replicator.dm +++ b/code/modules/xenoarcheaology/artifacts/replicator.dm @@ -147,7 +147,7 @@ ui = new(user, src, "XenoarchReplicator", name) ui.open() -/obj/machinery/replicator/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/replicator/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["tgui_construction"] = tgui_construction return data diff --git a/code/modules/xenoarcheaology/tools/ano_device_battery.dm b/code/modules/xenoarcheaology/tools/ano_device_battery.dm index 86908954ae22..1458663748aa 100644 --- a/code/modules/xenoarcheaology/tools/ano_device_battery.dm +++ b/code/modules/xenoarcheaology/tools/ano_device_battery.dm @@ -54,7 +54,7 @@ return return ui_interact(user) -/obj/item/anodevice/ui_state(mob/user, datum/tgui_module/module) +/obj/item/anodevice/ui_state() return GLOB.inventory_state /obj/item/anodevice/ui_interact(mob/user, datum/tgui/ui) @@ -63,7 +63,7 @@ ui = new(user, src, "XenoarchHandheldPowerUtilizer", name) ui.open() -/obj/item/anodevice/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/item/anodevice/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["inserted_battery"] = inserted_battery diff --git a/code/modules/xenoarcheaology/tools/artifact_analyser.dm b/code/modules/xenoarcheaology/tools/artifact_analyser.dm index 0c1a9bdd7621..b10e28b38bf5 100644 --- a/code/modules/xenoarcheaology/tools/artifact_analyser.dm +++ b/code/modules/xenoarcheaology/tools/artifact_analyser.dm @@ -38,7 +38,7 @@ ui = new(user, src, "XenoarchArtifactAnalyzer", name) ui.open() -/obj/machinery/artifact_analyser/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/artifact_analyser/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["owned_scanner"] = owned_scanner diff --git a/code/modules/xenoarcheaology/tools/artifact_harvester.dm b/code/modules/xenoarcheaology/tools/artifact_harvester.dm index ce198e5d8455..b036b06a210d 100644 --- a/code/modules/xenoarcheaology/tools/artifact_harvester.dm +++ b/code/modules/xenoarcheaology/tools/artifact_harvester.dm @@ -47,7 +47,7 @@ ui = new(user, src, "XenoarchArtifactHarvester", name) ui.open() -/obj/machinery/artifact_harvester/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/artifact_harvester/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["info"] = list( diff --git a/code/modules/xenoarcheaology/tools/geosample_scanner.dm b/code/modules/xenoarcheaology/tools/geosample_scanner.dm index e97e6c8398f5..8fa28dece263 100644 --- a/code/modules/xenoarcheaology/tools/geosample_scanner.dm +++ b/code/modules/xenoarcheaology/tools/geosample_scanner.dm @@ -124,7 +124,7 @@ ui = new(user, src, "XenoarchSpectrometer", name) ui.open() -/obj/machinery/radiocarbon_spectrometer/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/radiocarbon_spectrometer/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() diff --git a/code/modules/xenoarcheaology/tools/suspension_generator.dm b/code/modules/xenoarcheaology/tools/suspension_generator.dm index 489349dc9c61..d4b03f665773 100644 --- a/code/modules/xenoarcheaology/tools/suspension_generator.dm +++ b/code/modules/xenoarcheaology/tools/suspension_generator.dm @@ -55,7 +55,7 @@ ui = new(user, src, "XenoarchSuspension", name) ui.open() -/obj/machinery/suspension_gen/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/machinery/suspension_gen/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["cell"] = cell diff --git a/code/modules/xenoarcheaology/tools/tools.dm b/code/modules/xenoarcheaology/tools/tools.dm index 0913e1bd8715..ee7b66a7bc70 100644 --- a/code/modules/xenoarcheaology/tools/tools.dm +++ b/code/modules/xenoarcheaology/tools/tools.dm @@ -162,7 +162,7 @@ return ui_interact(user) -/obj/item/depth_scanner/ui_state(mob/user, datum/tgui_module/module) +/obj/item/depth_scanner/ui_state() return GLOB.deep_inventory_state /obj/item/depth_scanner/ui_interact(mob/user, datum/tgui/ui) @@ -171,7 +171,7 @@ ui = new(user, src, "XenoarchDepthScanner", name) ui.open() -/obj/item/depth_scanner/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/item/depth_scanner/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["current"] = list() @@ -289,7 +289,7 @@ return return ui_interact(user) -/obj/item/beacon_locator/ui_state(mob/user, datum/tgui_module/module) +/obj/item/beacon_locator/ui_state() return GLOB.inventory_state /obj/item/beacon_locator/ui_interact(mob/user, datum/tgui/ui) @@ -298,7 +298,7 @@ ui = new(user, src, "BeaconLocator", name) ui.open() -/obj/item/beacon_locator/ui_data(mob/user, datum/tgui/ui, datum/ui_state/state) +/obj/item/beacon_locator/ui_data(mob/user, datum/tgui/ui) var/list/data = ..() data["scan_ticks"] = scan_ticks