Skip to content

Commit

Permalink
tgui embedding hooks (#6212)
Browse files Browse the repository at this point in the history
Co-authored-by: silicons <[email protected]>
  • Loading branch information
silicons and silicons authored Dec 26, 2023
1 parent 70313ff commit 20f4c5c
Show file tree
Hide file tree
Showing 221 changed files with 1,115 additions and 999 deletions.
10 changes: 6 additions & 4 deletions citadel.dme
Original file line number Diff line number Diff line change
Expand Up @@ -2347,20 +2347,20 @@
#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"
#include "code\modules\client\throttling.dm"
#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"
Expand Down Expand Up @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions code/__DEFINES/dcs/signals/signals_datum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion code/__DEFINES/dcs/signals/signals_painting.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion code/controllers/subsystem/nanoui.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions code/controllers/subsystem/tgui.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions code/controllers/subsystem/vote.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion code/datums/ability.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion code/datums/changelog.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion code/datums/character_profile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
8 changes: 4 additions & 4 deletions code/datums/components/crafting/crafting.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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()
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions code/datums/wires/wires.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion code/game/click/other_mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 7 additions & 7 deletions code/game/machinery/atmo_control.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down
8 changes: 4 additions & 4 deletions code/game/machinery/biogenerator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..()
Expand All @@ -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
Expand All @@ -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.
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/bomb_tester.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/colormate.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/computer/Operating.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)))
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/computer/aifixer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/computer/arcade/claw_machine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
6 changes: 3 additions & 3 deletions code/game/machinery/computer/arcade/orion.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -178,15 +178,15 @@ 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
static_data["settlers"] = settlers
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
Expand Down
Loading

0 comments on commit 20f4c5c

Please sign in to comment.