diff --git a/code/__DEFINES/tgui.dm b/code/__DEFINES/tgui.dm index 1b3925f43a7..df5e187df17 100644 --- a/code/__DEFINES/tgui.dm +++ b/code/__DEFINES/tgui.dm @@ -1,4 +1,30 @@ -#define UI_INTERACTIVE 2 // Green/Interactive -#define UI_UPDATE 1 // Orange/Updates Only -#define UI_DISABLED 0 // Red/Disabled -#define UI_CLOSE -1 // Closed +/// Green eye; fully interactive +#define UI_INTERACTIVE 2 +/// Orange eye; updates but is not interactive +#define UI_UPDATE 1 +/// Red eye; disabled, does not update +#define UI_DISABLED 0 +/// UI Should close +#define UI_CLOSE -1 + +/// Maximum number of windows that can be suspended/reused +#define TGUI_WINDOW_SOFT_LIMIT 5 +/// Maximum number of open windows +#define TGUI_WINDOW_HARD_LIMIT 9 + +/// Maximum ping timeout allowed to detect zombie windows +#define TGUI_PING_TIMEOUT 5 SECONDS + +/// Window does not exist +#define TGUI_WINDOW_CLOSED 0 +/// Window was just opened, but is still not ready to be sent data +#define TGUI_WINDOW_LOADING 1 +/// Window is free and ready to receive data +#define TGUI_WINDOW_READY 2 +/// Window is in use by a tgui datum +#define TGUI_WINDOW_ACTIVE 3 + +/// Get a window id based on the provided pool index +#define TGUI_WINDOW_ID(index) "tgui-window-[index]" +/// Get a pool index of the provided window id +#define TGUI_WINDOW_INDEX(window_id) text2num(copytext(window_id, 13)) diff --git a/code/__HELPERS/_logging.dm b/code/__HELPERS/_logging.dm index a7d5f43ff08..d68b1524751 100644 --- a/code/__HELPERS/_logging.dm +++ b/code/__HELPERS/_logging.dm @@ -201,9 +201,18 @@ WRITE_LOG(GLOB.world_map_error_log, text) /* ui logging */ - -/proc/log_tgui(text) - WRITE_LOG(GLOB.tgui_log, text) +/proc/log_tgui(user_or_client, text) + var/entry = "" + if(!user_or_client) + entry += "no user" + else if(istype(user_or_client, /mob)) + var/mob/user = user_or_client + entry += "[user.ckey] (as [user])" + else if(istype(user_or_client, /client)) + var/client/client = user_or_client + entry += "[client.ckey]" + entry += ":\n[text]" + WRITE_LOG(GLOB.tgui_log, entry) /* For logging round startup. */ /proc/start_log(log) diff --git a/code/controllers/subsystem/shuttle.dm b/code/controllers/subsystem/shuttle.dm index 5024a1803c5..ed0b177a4ef 100644 --- a/code/controllers/subsystem/shuttle.dm +++ b/code/controllers/subsystem/shuttle.dm @@ -752,14 +752,15 @@ SUBSYSTEM_DEF(shuttle) preview_shuttle.jumpToNullSpace() preview_shuttle = null +/datum/controller/subsystem/shuttle/ui_state(mob/user) + return GLOB.admin_state -/datum/controller/subsystem/shuttle/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.admin_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/datum/controller/subsystem/shuttle/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "ShuttleManipulator", name, 800, 600, master_ui, state) + ui = new(user, src, "ShuttleManipulator") ui.open() - /datum/controller/subsystem/shuttle/ui_data(mob/user) var/list/data = list() data["tabs"] = list("Status", "Templates", "Modification") diff --git a/code/controllers/subsystem/tgui.dm b/code/controllers/subsystem/tgui.dm index e6a33c09dcc..7e382ffae54 100644 --- a/code/controllers/subsystem/tgui.dm +++ b/code/controllers/subsystem/tgui.dm @@ -1,4 +1,8 @@ /** + * tgui subsystem + * + * Contains all tgui state and subsystem code. + * * Copyright (c) 2020 Aleksej Komarov * SPDX-License-Identifier: MIT */ @@ -10,10 +14,14 @@ SUBSYSTEM_DEF(tgui) priority = FIRE_PRIORITY_TGUI runlevels = RUNLEVEL_LOBBY | RUNLEVELS_DEFAULT - var/list/currentrun = list() - var/list/open_uis = list() // A list of open UIs, grouped by src_object and ui_key. - var/list/processing_uis = list() // A list of processing UIs, ungrouped. - var/basehtml // The HTML base used for all UIs. + /// A list of UIs scheduled to process + var/list/current_run = list() + /// A list of open UIs + var/list/open_uis = list() + /// A list of open UIs, grouped by src_object. + var/list/open_uis_by_src = list() + /// The HTML base used for all UIs. + var/basehtml /datum/controller/subsystem/tgui/PreInit() basehtml = file2text('tgui/packages/tgui/public/tgui.html') @@ -22,20 +30,324 @@ SUBSYSTEM_DEF(tgui) close_all_uis() /datum/controller/subsystem/tgui/stat_entry() - ..("P:[processing_uis.len]") + ..("P:[open_uis.len]") /datum/controller/subsystem/tgui/fire(resumed = 0) - if (!resumed) - src.currentrun = processing_uis.Copy() - //cache for sanic speed (lists are references anyways) - var/list/currentrun = src.currentrun - - while(currentrun.len) - var/datum/tgui/ui = currentrun[currentrun.len] - currentrun.len-- + if(!resumed) + src.current_run = open_uis.Copy() + // Cache for sanic speed (lists are references anyways) + var/list/current_run = src.current_run + while(current_run.len) + var/datum/tgui/ui = current_run[current_run.len] + current_run.len-- + // TODO: Move user/src_object check to process() if(ui && ui.user && ui.src_object) ui.process() else - processing_uis.Remove(ui) - if (MC_TICK_CHECK) + open_uis.Remove(ui) + if(MC_TICK_CHECK) return + +/** + * public + * + * Requests a usable tgui window from the pool. + * Returns null if pool was exhausted. + * + * required user mob + * return datum/tgui + */ +/datum/controller/subsystem/tgui/proc/request_pooled_window(mob/user) + log_tgui(user, "request_pooled_window()") + if(!user.client) + return null + var/list/windows = user.client.tgui_windows + var/window_id + var/datum/tgui_window/window + var/window_found = FALSE + // Find a usable window + for(var/i in 1 to TGUI_WINDOW_HARD_LIMIT) + window_id = TGUI_WINDOW_ID(i) + window = windows[window_id] + // As we are looping, create missing window datums + if(!window) + window = new(user.client, window_id, pooled = TRUE) + // Skip windows with acquired locks + if(window.locked) + continue + if(window.status == TGUI_WINDOW_READY) + log_tgui(user, "found ready [window_id]") + return window + if(window.status == TGUI_WINDOW_CLOSED) + window.status = TGUI_WINDOW_LOADING + window_found = TRUE + break + if(!window_found) + log_tgui(user, "Error: Pool exhausted") + return null + return window + +/** + * public + * + * Force closes all tgui windows. + * + * required user mob + */ +/datum/controller/subsystem/tgui/proc/force_close_all_windows(mob/user) + log_tgui(user, "force_close_all_windows") + if(user.client) + user.client.tgui_windows = list() + for(var/i in 1 to TGUI_WINDOW_HARD_LIMIT) + var/window_id = TGUI_WINDOW_ID(i) + user << browse(null, "window=[window_id]") + +/** + * public + * + * Force closes the tgui window by window_id. + * + * required user mob + * required window_id string + */ +/datum/controller/subsystem/tgui/proc/force_close_window(mob/user, window_id) + log_tgui(user, "force_close_window") + // Close all tgui datums based on window_id. + for(var/datum/tgui/ui in user.tgui_open_uis) + if(ui.window && ui.window.id == window_id) + ui.close(can_be_suspended = FALSE) + // Unset machine just to be sure. + user.unset_machine() + // Close window directly just to be sure. + user << browse(null, "window=[window_id]") + +/** + * public + * + * Try to find an instance of a UI, and push an update to it. + * + * required user mob The mob who opened/is using the UI. + * required src_object datum The object/datum which owns the UI. + * optional ui datum/tgui The UI to be updated, if it exists. + * optional force_open bool If the UI should be re-opened instead of updated. + * + * return datum/tgui The found UI. + */ +/datum/controller/subsystem/tgui/proc/try_update_ui( + mob/user, + datum/src_object, + datum/tgui/ui) + // Look up a UI if it wasn't passed + if(isnull(ui)) + ui = get_open_ui(user, src_object) + // Couldn't find a UI. + if(isnull(ui)) + return null + ui.process_status() + // UI ended up with the closed status + // or is actively trying to close itself. + // FIXME: Doesn't actually fix the paper bug. + if(ui.status <= UI_CLOSE) + ui.close() + return null + ui.send_update() + return ui + +/** + * public + * + * Get a open UI given a user and src_object. + * + * required user mob The mob who opened/is using the UI. + * required src_object datum The object/datum which owns the UI. + * + * return datum/tgui The found UI. + */ +/datum/controller/subsystem/tgui/proc/get_open_ui(mob/user, datum/src_object) + var/key = "[REF(src_object)]" + // No UIs opened for this src_object + if(isnull(open_uis_by_src[key]) || !istype(open_uis_by_src[key], /list)) + return null + for(var/datum/tgui/ui in open_uis_by_src[key]) + // Make sure we have the right user + if(ui.user == user) + return ui + return null + +/** + * public + * + * Update all UIs attached to src_object. + * + * required src_object datum The object/datum which owns the UIs. + * + * return int The number of UIs updated. + */ +/datum/controller/subsystem/tgui/proc/update_uis(datum/src_object) + var/count = 0 + var/key = "[REF(src_object)]" + // No UIs opened for this src_object + if(isnull(open_uis_by_src[key]) || !istype(open_uis_by_src[key], /list)) + return count + for(var/datum/tgui/ui in open_uis_by_src[key]) + // Check if UI is valid. + if(ui && ui.src_object && ui.user && ui.src_object.ui_host(ui.user)) + ui.process(force = 1) + count++ + return count + +/** + * public + * + * Close all UIs attached to src_object. + * + * required src_object datum The object/datum which owns the UIs. + * + * return int The number of UIs closed. + */ +/datum/controller/subsystem/tgui/proc/close_uis(datum/src_object) + var/count = 0 + var/key = "[REF(src_object)]" + // No UIs opened for this src_object + if(isnull(open_uis_by_src[key]) || !istype(open_uis_by_src[key], /list)) + return count + for(var/datum/tgui/ui in open_uis_by_src[key]) + // Check if UI is valid. + if(ui && ui.src_object && ui.user && ui.src_object.ui_host(ui.user)) + ui.close() + count++ + return count + +/** + * public + * + * Close all UIs regardless of their attachment to src_object. + * + * return int The number of UIs closed. + */ +/datum/controller/subsystem/tgui/proc/close_all_uis() + var/count = 0 + for(var/key in open_uis_by_src) + for(var/datum/tgui/ui in open_uis_by_src[key]) + // Check if UI is valid. + if(ui && ui.src_object && ui.user && ui.src_object.ui_host(ui.user)) + ui.close() + count++ + return count + +/** + * public + * + * Update all UIs belonging to a user. + * + * required user mob The mob who opened/is using the UI. + * optional src_object datum If provided, only update UIs belonging this src_object. + * + * return int The number of UIs updated. + */ +/datum/controller/subsystem/tgui/proc/update_user_uis(mob/user, datum/src_object) + var/count = 0 + if(length(user?.tgui_open_uis) == 0) + return count + for(var/datum/tgui/ui in user.tgui_open_uis) + if(isnull(src_object) || ui.src_object == src_object) + ui.process(force = 1) + count++ + return count + +/** + * public + * + * Close all UIs belonging to a user. + * + * required user mob The mob who opened/is using the UI. + * optional src_object datum If provided, only close UIs belonging this src_object. + * + * return int The number of UIs closed. + */ +/datum/controller/subsystem/tgui/proc/close_user_uis(mob/user, datum/src_object) + var/count = 0 + if(length(user?.tgui_open_uis) == 0) + return count + for(var/datum/tgui/ui in user.tgui_open_uis) + if(isnull(src_object) || ui.src_object == src_object) + ui.close() + count++ + return count + +/** + * private + * + * Add a UI to the list of open UIs. + * + * required ui datum/tgui The UI to be added. + */ +/datum/controller/subsystem/tgui/proc/on_open(datum/tgui/ui) + var/key = "[REF(ui.src_object)]" + if(isnull(open_uis_by_src[key]) || !istype(open_uis_by_src[key], /list)) + open_uis_by_src[key] = list() + ui.user.tgui_open_uis |= ui + var/list/uis = open_uis_by_src[key] + uis |= ui + open_uis |= ui + +/** + * private + * + * Remove a UI from the list of open UIs. + * + * required ui datum/tgui The UI to be removed. + * + * return bool If the UI was removed or not. + */ +/datum/controller/subsystem/tgui/proc/on_close(datum/tgui/ui) + var/key = "[REF(ui.src_object)]" + if(isnull(open_uis_by_src[key]) || !istype(open_uis_by_src[key], /list)) + return FALSE + // Remove it from the list of processing UIs. + open_uis.Remove(ui) + // If the user exists, remove it from them too. + if(ui.user) + ui.user.tgui_open_uis.Remove(ui) + var/list/uis = open_uis_by_src[key] + uis.Remove(ui) + if(length(uis) == 0) + open_uis_by_src.Remove(key) + return TRUE + +/** + * private + * + * Handle client logout, by closing all their UIs. + * + * required user mob The mob which logged out. + * + * return int The number of UIs closed. + */ +/datum/controller/subsystem/tgui/proc/on_logout(mob/user) + close_user_uis(user) + +/** + * private + * + * Handle clients switching mobs, by transferring their UIs. + * + * required user source The client's original mob. + * required user target The client's new mob. + * + * return bool If the UIs were transferred. + */ +/datum/controller/subsystem/tgui/proc/on_transfer(mob/source, mob/target) + // The old mob had no open UIs. + if(length(source?.tgui_open_uis) == 0) + return FALSE + if(isnull(target.tgui_open_uis) || !istype(target.tgui_open_uis, /list)) + target.tgui_open_uis = list() + // Transfer all the UIs. + for(var/datum/tgui/ui in source.tgui_open_uis) + // Inform the UIs of their new owner. + ui.user = target + target.tgui_open_uis.Add(ui) + // Clear the old list. + source.tgui_open_uis.Cut() + return TRUE diff --git a/code/datums/achievements/_achievement_data.dm b/code/datums/achievements/_achievement_data.dm index 14f4510f4e0..cfa1ab6ed01 100644 --- a/code/datums/achievements/_achievement_data.dm +++ b/code/datums/achievements/_achievement_data.dm @@ -91,16 +91,18 @@ else if(istype(A, /datum/award/score)) data[achievement_type] = 0 -/datum/achievement_data/ui_base_html(html) - var/datum/asset/spritesheet/simple/assets = get_asset_datum(/datum/asset/spritesheet/simple/achievements) - . = replacetext(html, "", assets.css_tag()) +/datum/achievement_data/ui_assets(mob/user) + return list( + get_asset_datum(/datum/asset/spritesheet/simple/achievements), + ) -/datum/achievement_data/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.always_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/datum/achievement_data/ui_state(mob/user) + return GLOB.always_state + +/datum/achievement_data/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - var/datum/asset/spritesheet/simple/assets = get_asset_datum(/datum/asset/spritesheet/simple/achievements) - assets.send(user) - ui = new(user, src, ui_key, "Achievements", "Achievements Menu", 540, 680, master_ui, state) + ui = new(user, src, "Achievements") ui.open() /datum/achievement_data/ui_data(mob/user) diff --git a/code/datums/components/crafting/crafting.dm b/code/datums/components/crafting/crafting.dm index 7e0619fe9c5..c59d4b82113 100644 --- a/code/datums/components/crafting/crafting.dm +++ b/code/datums/components/crafting/crafting.dm @@ -316,9 +316,12 @@ if(user == parent) ui_interact(user) +/datum/component/personal_crafting/ui_state(mob/user) + 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 -/datum/component/personal_crafting/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.not_incapacitated_turf_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/datum/component/personal_crafting/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) cur_category = categories[1] if(islist(categories[cur_category])) @@ -326,7 +329,7 @@ cur_subcategory = subcats[1] else cur_subcategory = CAT_NONE - ui = new(user, src, ui_key, "PersonalCrafting", "Crafting Menu", 700, 800, master_ui, state) + ui = new(user, src, "PersonalCrafting") ui.open() /datum/component/personal_crafting/ui_data(mob/user) @@ -406,13 +409,8 @@ display_compact = !display_compact . = TRUE if("set_category") - if(!isnull(params["category"])) - cur_category = params["category"] - if(!isnull(params["subcategory"])) - if(params["subcategory"] == "0") - cur_subcategory = "" - else - cur_subcategory = params["subcategory"] + cur_category = params["category"] + cur_subcategory = params["subcategory"] || "" . = TRUE /datum/component/personal_crafting/proc/build_recipe_data(datum/crafting_recipe/R) diff --git a/code/datums/components/gps.dm b/code/datums/components/gps.dm index 200ec2b956b..c2b3ad1f30c 100644 --- a/code/datums/components/gps.dm +++ b/code/datums/components/gps.dm @@ -80,19 +80,15 @@ GLOBAL_LIST_EMPTY(GPS_list) to_chat(user, "[parent] is now tracking, and visible to other GPS devices.") tracking = TRUE -/datum/component/gps/item/ui_interact(mob/user, ui_key = "gps", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) // Remember to use the appropriate state. +/datum/component/gps/item/ui_interact(mob/user, datum/tgui/ui) if(emped) to_chat(user, "[parent] fizzles weakly.") return - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - // Variable window height, depending on how many GPS units there are - // to show, clamped to relatively safe range. - var/gps_window_height = clamp(325 + GLOB.GPS_list.len * 14, 325, 700) - ui = new(user, src, ui_key, "Gps", "Global Positioning System", 470, gps_window_height, master_ui, state) //width, height + ui = new(user, src, "Gps") ui.open() - - ui.set_autoupdate(state = updating) + ui.set_autoupdate(updating) /datum/component/gps/item/ui_data(mob/user) var/list/data = list() diff --git a/code/datums/components/uplink.dm b/code/datums/components/uplink.dm index 499f2db7fbe..4136237505d 100644 --- a/code/datums/components/uplink.dm +++ b/code/datums/components/uplink.dm @@ -120,12 +120,14 @@ // an unlocked uplink blocks also opening the PDA or headset menu return COMPONENT_NO_INTERACT -/datum/component/uplink/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.inventory_state) +/datum/component/uplink/ui_state(mob/user) + return GLOB.inventory_state + +/datum/component/uplink/ui_interact(mob/user, datum/tgui/ui) active = TRUE - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "Uplink", name, 620, 580, master_ui, state) + ui = new(user, src, "Uplink", name) // This UI is only ever opened by one person, // and never is updated outside of user input. ui.set_autoupdate(FALSE) diff --git a/code/datums/spawners_menu.dm b/code/datums/spawners_menu.dm index 88ac3ef1382..95a7d8e6339 100644 --- a/code/datums/spawners_menu.dm +++ b/code/datums/spawners_menu.dm @@ -6,10 +6,13 @@ qdel(src) owner = new_owner -/datum/spawners_menu/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.observer_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/datum/spawners_menu/ui_state(mob/user) + return GLOB.observer_state + +/datum/spawners_menu/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "SpawnersMenu", "Spawners Menu", 700, 600, master_ui, state) + ui = new(user, src, "SpawnersMenu") ui.open() /datum/spawners_menu/ui_data(mob/user) diff --git a/code/datums/wires/_wires.dm b/code/datums/wires/_wires.dm index 942c2ca4035..dcac1b70df7 100644 --- a/code/datums/wires/_wires.dm +++ b/code/datums/wires/_wires.dm @@ -215,11 +215,13 @@ return ..() return UI_CLOSE -/datum/wires/ui_interact(mob/user, ui_key = "wires", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.physical_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/datum/wires/ui_state(mob/user) + return GLOB.physical_state + +/datum/wires/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if (!ui) - ui = new(user, src, ui_key, "Wires", "[holder.name] Wires", 350, 150 + wires.len * 30, master_ui, state) + ui = new(user, src, "Wires", "[holder.name] Wires") ui.open() /datum/wires/ui_data(mob/user) diff --git a/code/game/machinery/Sleeper.dm b/code/game/machinery/Sleeper.dm index 9bdc44bea4e..709677b5fd7 100644 --- a/code/game/machinery/Sleeper.dm +++ b/code/game/machinery/Sleeper.dm @@ -12,8 +12,6 @@ density = FALSE state_open = TRUE circuit = /obj/item/circuitboard/machine/sleeper - ui_x = 310 - ui_y = 465 var/efficiency = 1 var/min_health = -25 @@ -136,15 +134,15 @@ visible_message("[usr] pries open [src].", "You pry open [src].") open_machine() -/obj/machinery/sleeper/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.notcontained_state) +/obj/machinery/sleeper/ui_state(mob/user) + if(controls_inside) + return GLOB.notcontained_state + return GLOB.default_state - if(controls_inside && state == GLOB.notcontained_state) - state = GLOB.default_state // If it has a set of controls on the inside, make it actually controllable by the mob in it. - - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/sleeper/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "Sleeper", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "Sleeper", name) ui.open() /obj/machinery/sleeper/AltClick(mob/user) @@ -287,8 +285,6 @@ idle_power_usage = 3000 circuit = /obj/item/circuitboard/machine/sleeper/party var/leddit = FALSE //Get it like reddit and lead alright fine - ui_x = 310 - ui_y = 400 controls_inside = TRUE possible_chems = list( diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm index 50995a6a995..892cc4051e0 100644 --- a/code/game/machinery/_machinery.dm +++ b/code/game/machinery/_machinery.dm @@ -126,11 +126,8 @@ Class Procs: var/market_verb = "Customer" var/payment_department = ACCOUNT_ENG - // For storing and overriding ui id and dimensions + // For storing and overriding ui id var/tgui_id // ID of TGUI interface - var/ui_style // ID of custom TGUI style (optional) - var/ui_x // Default size of TGUI window, in pixels - var/ui_y /obj/machinery/Initialize() if(!armor) diff --git a/code/game/machinery/announcement_system.dm b/code/game/machinery/announcement_system.dm index 054e75b348f..84f82b165b2 100644 --- a/code/game/machinery/announcement_system.dm +++ b/code/game/machinery/announcement_system.dm @@ -93,13 +93,10 @@ GLOBAL_LIST_EMPTY(announcement_systems) for(var/channel in channels) radio.talk_into(src, message, channel) -//config stuff - -/obj/machinery/announcement_system/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - . = ..() - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/announcement_system/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "AutomatedAnnouncement", "Automated Announcement System", 500, 225, master_ui, state) + ui = new(user, src, "AutomatedAnnouncement") ui.open() /obj/machinery/announcement_system/ui_data() diff --git a/code/game/machinery/bank_machine.dm b/code/game/machinery/bank_machine.dm index 1f3c57abcf0..9633ede69bb 100644 --- a/code/game/machinery/bank_machine.dm +++ b/code/game/machinery/bank_machine.dm @@ -3,8 +3,7 @@ desc = "A machine used to deposit and withdraw station funds." icon = 'goon/icons/obj/goon_terminals.dmi' idle_power_usage = 100 - ui_x = 335 - ui_y = 160 + var/siphoning = FALSE var/next_warning = 0 var/obj/item/radio/radio @@ -61,11 +60,10 @@ radio.talk_into(src, message, radio_channel) next_warning = world.time + minimum_time_between_warnings -/obj/machinery/computer/bank_machine/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/computer/bank_machine/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "BankMachine", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "BankMachine", name) ui.open() /obj/machinery/computer/bank_machine/ui_data(mob/user) diff --git a/code/game/machinery/bounty_board.dm b/code/game/machinery/bounty_board.dm index 393bbf35c49..fdae8f94aa9 100644 --- a/code/game/machinery/bounty_board.dm +++ b/code/game/machinery/bounty_board.dm @@ -9,8 +9,6 @@ GLOBAL_LIST_EMPTY(request_list) desc = "Alows you to place requests for goods and services across the station, as well as pay those who actually did it." icon = 'icons/obj/terminals.dmi' icon_state = "request_kiosk" - ui_x = 550 - ui_y = 600 light_color = LIGHT_COLOR_GREEN ///Reference to the currently logged in user. var/datum/bank_account/current_user @@ -56,10 +54,10 @@ GLOBAL_LIST_EMPTY(request_list) new /obj/item/wallframe/bounty_board(loc) qdel(src) -/obj/machinery/bounty_board/ui_interact(mob/user, ui_key, datum/tgui/ui, force_open, datum/tgui/master_ui, datum/ui_state/state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/bounty_board/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "RequestKiosk", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "RequestKiosk", name) ui.open() /obj/machinery/bounty_board/ui_data(mob/user) diff --git a/code/game/machinery/computer/Operating.dm b/code/game/machinery/computer/Operating.dm index ddd91794a8a..8942f83e535 100644 --- a/code/game/machinery/computer/Operating.dm +++ b/code/game/machinery/computer/Operating.dm @@ -7,8 +7,6 @@ icon_screen = "crew" icon_keyboard = "med_key" circuit = /obj/item/circuitboard/computer/operating - ui_x = 350 - ui_y = 470 var/mob/living/carbon/human/patient var/obj/structure/table/optable/table @@ -63,10 +61,13 @@ sbed.op_computer = src break -/obj/machinery/computer/operating/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.not_incapacitated_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/computer/operating/ui_state(mob/user) + return GLOB.not_incapacitated_state + +/obj/machinery/computer/operating/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "OperatingComputer", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "OperatingComputer", name) ui.open() /obj/machinery/computer/operating/ui_data(mob/user) diff --git a/code/game/machinery/computer/aifixer.dm b/code/game/machinery/computer/aifixer.dm index 03f5138b9c8..5de7edc5410 100644 --- a/code/game/machinery/computer/aifixer.dm +++ b/code/game/machinery/computer/aifixer.dm @@ -6,8 +6,7 @@ icon_keyboard = "tech_key" icon_screen = "ai-fixer" light_color = LIGHT_COLOR_PINK - ui_x = 370 - ui_y = 360 + /// Variable containing transferred AI var/mob/living/silicon/ai/occupier /// Variable dictating if we are in the process of restoring the occupier AI @@ -22,11 +21,10 @@ else return ..() -/obj/machinery/computer/aifixer/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/computer/aifixer/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "AiRestorer", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "AiRestorer", name) ui.open() /obj/machinery/computer/aifixer/ui_data(mob/user) diff --git a/code/game/machinery/computer/apc_control.dm b/code/game/machinery/computer/apc_control.dm index b3b2c02a9ea..15c947f8c73 100644 --- a/code/game/machinery/computer/apc_control.dm +++ b/code/game/machinery/computer/apc_control.dm @@ -12,8 +12,6 @@ var/restoring = FALSE var/list/logs var/auth_id = "\[NULL\]:" - ui_x = 550 - ui_y = 500 /obj/machinery/computer/apc_control/Initialize(mapload, obj/item/circuitboard/C) . = ..() @@ -41,14 +39,13 @@ /obj/machinery/computer/apc_control/proc/check_apc(obj/machinery/power/apc/APC) return APC.z == z && !APC.malfhack && !APC.aidisabled && !(APC.obj_flags & EMAGGED) && !APC.machine_stat && !istype(APC.area, /area/ai_monitored) && !APC.area.outdoors -/obj/machinery/computer/apc_control/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) // Remember to use the appropriate state. +/obj/machinery/computer/apc_control/ui_interact(mob/user, datum/tgui/ui) operator = user - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "ApcControl", "APC Controller", ui_x, ui_y, master_ui, state) + ui = new(user, src, "ApcControl") ui.open() - /obj/machinery/computer/apc_control/ui_data(mob/user) var/list/data = list() data["auth_id"] = auth_id diff --git a/code/game/machinery/computer/arena.dm b/code/game/machinery/computer/arena.dm index ed0ce112ad1..fd0236eb519 100644 --- a/code/game/machinery/computer/arena.dm +++ b/code/game/machinery/computer/arena.dm @@ -323,7 +323,7 @@ var/obj/item/reagent_containers/food/drinks/trophy/gold_cup/G = new(get_turf(L)) G.name = "[L.real_name]'s Trophy" -/obj/machinery/computer/arena/ui_interact(mob/user, ui_key, datum/tgui/ui, force_open, datum/tgui/master_ui, datum/ui_state/state) +/obj/machinery/computer/arena/ui_interact(mob/user) . = ..() var/list/dat = list() dat += "
" diff --git a/code/game/machinery/computer/atmos_alert.dm b/code/game/machinery/computer/atmos_alert.dm index cb574e36c09..65cc6fc7f44 100644 --- a/code/game/machinery/computer/atmos_alert.dm +++ b/code/game/machinery/computer/atmos_alert.dm @@ -2,8 +2,6 @@ name = "atmospheric alert console" desc = "Used to monitor the station's air alarms." circuit = /obj/item/circuitboard/computer/atmos_alert - ui_x = 350 - ui_y = 300 icon_screen = "alert:0" icon_keyboard = "atmos_key" var/list/priority_alarms = list() @@ -21,11 +19,10 @@ SSradio.remove_object(src, receive_frequency) return ..() -/obj/machinery/computer/atmos_alert/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/computer/atmos_alert/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "AtmosAlertConsole", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "AtmosAlertConsole", name) ui.open() /obj/machinery/computer/atmos_alert/ui_data(mob/user) diff --git a/code/game/machinery/computer/atmos_control.dm b/code/game/machinery/computer/atmos_control.dm index 420e7e64ab7..cf1f2b89be1 100644 --- a/code/game/machinery/computer/atmos_control.dm +++ b/code/game/machinery/computer/atmos_control.dm @@ -92,8 +92,6 @@ GLOBAL_LIST_EMPTY(atmos_air_controllers) icon_screen = "tank" icon_keyboard = "atmos_key" circuit = /obj/item/circuitboard/computer/atmos_control - ui_x = 400 - ui_y = 925 var/frequency = FREQ_ATMOS_STORAGE var/list/sensors = list( @@ -124,11 +122,10 @@ GLOBAL_LIST_EMPTY(atmos_air_controllers) SSradio.remove_object(src, frequency) return ..() -/obj/machinery/computer/atmos_control/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/computer/atmos_control/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "AtmosControlConsole", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "AtmosControlConsole", name) ui.open() /obj/machinery/computer/atmos_control/ui_data(mob/user) @@ -169,16 +166,12 @@ GLOBAL_LIST_EMPTY(atmos_air_controllers) name = "Incinerator Air Control" sensors = list(ATMOS_GAS_MONITOR_SENSOR_INCINERATOR = "Incinerator Chamber") circuit = /obj/item/circuitboard/computer/atmos_control/incinerator - ui_x = 400 - ui_y = 300 //Toxins mix sensor only /obj/machinery/computer/atmos_control/toxinsmix name = "Toxins Mixing Air Control" sensors = list(ATMOS_GAS_MONITOR_SENSOR_TOXINS_LAB = "Toxins Mixing Chamber") circuit = /obj/item/circuitboard/computer/atmos_control/toxinsmix - ui_x = 400 - ui_y = 300 ///////////////////////////////////////////////////////////// // LARGE TANK CONTROL @@ -189,13 +182,9 @@ GLOBAL_LIST_EMPTY(atmos_air_controllers) var/output_tag frequency = FREQ_ATMOS_STORAGE circuit = /obj/item/circuitboard/computer/atmos_control/tank - var/list/input_info var/list/output_info - ui_x = 500 - ui_y = 315 - /obj/machinery/computer/atmos_control/tank/oxygen_tank name = "Oxygen Supply Control" input_tag = ATMOS_GAS_MONITOR_INPUT_O2 @@ -276,13 +265,6 @@ GLOBAL_LIST_EMPTY(atmos_air_controllers) for(var/obj/machinery/atmospherics/components/unary/vent_pump/U in devices) U.broadcast_status() -/obj/machinery/computer/atmos_control/tank/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) - if(!ui) - ui = new(user, src, ui_key, "AtmosControlConsole", name, ui_x, ui_y, master_ui, state) - ui.open() - /obj/machinery/computer/atmos_control/tank/ui_data(mob/user) var/list/data = ..() data["tank"] = TRUE @@ -290,7 +272,6 @@ GLOBAL_LIST_EMPTY(atmos_air_controllers) data["inputRate"] = input_info ? input_info["volume_rate"] : 0 data["outputting"] = output_info ? output_info["power"] : FALSE data["outputPressure"] = output_info ? output_info["internal"] : 0 - return data /obj/machinery/computer/atmos_control/tank/ui_act(action, params) diff --git a/code/game/machinery/computer/camera.dm b/code/game/machinery/computer/camera.dm index 07f97e6b780..b8d3bb607b1 100644 --- a/code/game/machinery/computer/camera.dm +++ b/code/game/machinery/computer/camera.dm @@ -7,8 +7,6 @@ icon_keyboard = "security_key" circuit = /obj/item/circuitboard/computer/security light_color = LIGHT_COLOR_RED - ui_x = 870 - ui_y = 708 var/list/network = list("ss13") var/obj/machinery/camera/active_camera @@ -59,11 +57,9 @@ network -= i network += "[idnum][i]" -/obj/machinery/computer/security/ui_interact(\ - mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) +/obj/machinery/computer/security/ui_interact(mob/user, datum/tgui/ui) // Update UI - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) + ui = SStgui.try_update_ui(user, src, ui) // Show static if can't use the camera if(!active_camera?.can_use()) show_camera_static() @@ -84,7 +80,7 @@ user.client.register_map_obj(plane) user.client.register_map_obj(cam_background) // Open UI - ui = new(user, src, ui_key, "CameraConsole", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "CameraConsole", name) ui.open() /obj/machinery/computer/security/ui_data() diff --git a/code/game/machinery/computer/crew.dm b/code/game/machinery/computer/crew.dm index 199049ba6df..4033e425163 100644 --- a/code/game/machinery/computer/crew.dm +++ b/code/game/machinery/computer/crew.dm @@ -77,11 +77,10 @@ GLOBAL_DATUM_INIT(crewmonitor, /datum/crewmonitor, new) /datum/crewmonitor/Destroy() return ..() -/datum/crewmonitor/ui_interact(mob/user, ui_key = "crew", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/datum/crewmonitor/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if (!ui) - ui = new(user, src, ui_key, "CrewConsole", "crew monitor", 800, 600 , master_ui, state) + ui = new(user, src, "CrewConsole") ui.open() /datum/crewmonitor/proc/show(mob/M, source) diff --git a/code/game/machinery/computer/dna_console.dm b/code/game/machinery/computer/dna_console.dm index 8b436b96380..384b37f9045 100644 --- a/code/game/machinery/computer/dna_console.dm +++ b/code/game/machinery/computer/dna_console.dm @@ -205,12 +205,7 @@ // already discovered mutations stored_research = SSresearch.science_tech -/obj/machinery/computer/scan_consolenew/examine(mob/user) - . = ..() - -/obj/machinery/computer/scan_consolenew/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - . = ..() - +/obj/machinery/computer/scan_consolenew/ui_interact(mob/user, datum/tgui/ui) // Most of ui_interact is spent setting variables for passing to the tgui // interface. // We can also do some general state processing here too as it's a good @@ -252,10 +247,9 @@ time_to_pulse = round((rad_pulse_timer - world.time)/10) // Attempt to update tgui ui, open and update if needed. - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) - + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "DnaConsole", name, 539, 710, master_ui, state) + ui = new(user, src, "DnaConsole") ui.open() /obj/machinery/computer/scan_consolenew/ui_data(mob/user) diff --git a/code/game/machinery/computer/launchpad_control.dm b/code/game/machinery/computer/launchpad_control.dm index ed5a031dba2..e7961c18ecd 100644 --- a/code/game/machinery/computer/launchpad_control.dm +++ b/code/game/machinery/computer/launchpad_control.dm @@ -4,8 +4,6 @@ icon_screen = "teleport" icon_keyboard = "teleport_key" circuit = /obj/item/circuitboard/computer/launchpad_console - ui_x = 475 - ui_y = 260 var/selected_id var/list/obj/machinery/launchpad/launchpads @@ -53,10 +51,10 @@ var/obj/machinery/launchpad/pad = launchpads[number] return pad -/obj/machinery/computer/launchpad/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/computer/launchpad/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "LaunchpadConsole", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "LaunchpadConsole", name) ui.open() /obj/machinery/computer/launchpad/ui_data(mob/user) diff --git a/code/game/machinery/computer/prisoner/gulag_teleporter.dm b/code/game/machinery/computer/prisoner/gulag_teleporter.dm index 6cb6a1d34ed..0a8d0dbb2b0 100644 --- a/code/game/machinery/computer/prisoner/gulag_teleporter.dm +++ b/code/game/machinery/computer/prisoner/gulag_teleporter.dm @@ -6,8 +6,6 @@ icon_keyboard = "security_key" req_access = list(ACCESS_ARMORY) circuit = /obj/item/circuitboard/computer/gulag_teleporter_console - ui_x = 350 - ui_y = 295 var/default_goal = 200 var/obj/machinery/gulag_teleporter/teleporter = null @@ -21,11 +19,10 @@ . = ..() scan_machinery() -/obj/machinery/computer/prisoner/gulag_teleporter_computer/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/computer/prisoner/gulag_teleporter_computer/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "GulagTeleporterConsole", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "GulagTeleporterConsole", name) ui.open() /obj/machinery/computer/prisoner/gulag_teleporter_computer/ui_data(mob/user) diff --git a/code/game/machinery/computer/robot.dm b/code/game/machinery/computer/robot.dm index 7ebc5044402..83128b840af 100644 --- a/code/game/machinery/computer/robot.dm +++ b/code/game/machinery/computer/robot.dm @@ -6,8 +6,6 @@ req_access = list(ACCESS_ROBOTICS) circuit = /obj/item/circuitboard/computer/robotics light_color = LIGHT_COLOR_PINK - ui_x = 500 - ui_y = 460 /obj/machinery/computer/robotics/proc/can_control(mob/user, mob/living/silicon/robot/R) . = FALSE @@ -23,11 +21,10 @@ return return TRUE -/obj/machinery/computer/robotics/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/computer/robotics/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "RoboticsControlConsole", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "RoboticsControlConsole", name) ui.open() /obj/machinery/computer/robotics/ui_data(mob/user) diff --git a/code/game/machinery/computer/station_alert.dm b/code/game/machinery/computer/station_alert.dm index 1258463348d..839d339e5a7 100644 --- a/code/game/machinery/computer/station_alert.dm +++ b/code/game/machinery/computer/station_alert.dm @@ -4,8 +4,6 @@ icon_screen = "alert:0" icon_keyboard = "atmos_key" circuit = /obj/item/circuitboard/computer/stationalert - ui_x = 325 - ui_y = 500 var/alarms = list("Fire" = list(), "Atmosphere" = list(), "Power" = list()) light_color = LIGHT_COLOR_CYAN @@ -18,11 +16,10 @@ GLOB.alert_consoles -= src return ..() -/obj/machinery/computer/station_alert/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/computer/station_alert/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "StationAlertConsole", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "StationAlertConsole", name) ui.open() /obj/machinery/computer/station_alert/ui_data(mob/user) diff --git a/code/game/machinery/computer/teleporter.dm b/code/game/machinery/computer/teleporter.dm index 6be511f7851..9307a0781d5 100644 --- a/code/game/machinery/computer/teleporter.dm +++ b/code/game/machinery/computer/teleporter.dm @@ -5,8 +5,7 @@ icon_keyboard = "teleport_key" light_color = LIGHT_COLOR_BLUE circuit = /obj/item/circuitboard/computer/teleporter - ui_x = 470 - ui_y = 140 + var/regime_set = "Teleporter" var/id var/obj/machinery/teleport/station/power_station @@ -33,11 +32,10 @@ break return power_station -/obj/machinery/computer/teleporter/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/computer/teleporter/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "Teleporter", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "Teleporter", name) ui.open() /obj/machinery/computer/teleporter/ui_data(mob/user) diff --git a/code/game/machinery/dance_machine.dm b/code/game/machinery/dance_machine.dm index 3d8f2e10fbb..4a1d449244a 100644 --- a/code/game/machinery/dance_machine.dm +++ b/code/game/machinery/dance_machine.dm @@ -6,8 +6,6 @@ verb_say = "states" density = TRUE req_access = list(ACCESS_BAR) - ui_x = 370 - ui_y = 313 var/active = FALSE var/list/rangers = list() var/stop = 0 @@ -100,11 +98,10 @@ return UI_CLOSE return ..() -/obj/machinery/jukebox/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/jukebox/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "Jukebox", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "Jukebox", name) ui.open() /obj/machinery/jukebox/ui_data(mob/user) diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 33329319cfa..fd25404a677 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -1321,11 +1321,10 @@ else if(istype(note, /obj/item/photo)) return "photo" -/obj/machinery/door/airlock/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/door/airlock/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "AiAirlock", name, 500, 390, master_ui, state) + ui = new(user, src, "AiAirlock", name) ui.open() return TRUE diff --git a/code/game/machinery/doors/airlock_electronics.dm b/code/game/machinery/doors/airlock_electronics.dm index ae8a069b332..c6e08b96c22 100644 --- a/code/game/machinery/doors/airlock_electronics.dm +++ b/code/game/machinery/doors/airlock_electronics.dm @@ -15,11 +15,13 @@ . = ..() . += "Has a neat selection menu for modifying airlock access levels." -/obj/item/electronics/airlock/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.hands_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/item/electronics/airlock/ui_state(mob/user) + return GLOB.hands_state + +/obj/item/electronics/airlock/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "AirlockElectronics", name, 420, 485, master_ui, state) + ui = new(user, src, "AirlockElectronics", name) ui.open() /obj/item/electronics/airlock/ui_static_data(mob/user) diff --git a/code/game/machinery/doors/brigdoors.dm b/code/game/machinery/doors/brigdoors.dm index 0729e909f9a..85d5f7803c8 100644 --- a/code/game/machinery/doors/brigdoors.dm +++ b/code/game/machinery/doors/brigdoors.dm @@ -37,8 +37,6 @@ maptext_height = 26 maptext_width = 32 maptext_y = -1 - ui_x = 300 - ui_y = 138 /obj/machinery/door_timer/Initialize() . = ..() @@ -142,11 +140,10 @@ . = new_time == timer_duration //return 1 on no change timer_duration = new_time -/obj/machinery/door_timer/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/door_timer/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "BrigTimer", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "BrigTimer", name) ui.open() //icon update function diff --git a/code/game/machinery/doppler_array.dm b/code/game/machinery/doppler_array.dm index 2494dd6faa6..680a87b0637 100644 --- a/code/game/machinery/doppler_array.dm +++ b/code/game/machinery/doppler_array.dm @@ -7,8 +7,6 @@ icon_state = "tdoppler" density = TRUE verb_say = "states coldly" - ui_x = 500 - ui_y = 225 var/cooldown = 10 var/next_announce = 0 var/max_dist = 150 @@ -36,11 +34,10 @@ var/factual_radius = list() var/theory_radius = list() -/obj/machinery/doppler_array/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/doppler_array/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "TachyonArray", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "TachyonArray", name) ui.open() /obj/machinery/doppler_array/ui_data(mob/user) diff --git a/code/game/machinery/electrolyzer.dm b/code/game/machinery/electrolyzer.dm index aae3b8fece9..98900cfb68c 100644 --- a/code/game/machinery/electrolyzer.dm +++ b/code/game/machinery/electrolyzer.dm @@ -12,9 +12,8 @@ max_integrity = 250 armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 100, "rad" = 100, "fire" = 80, "acid" = 10) circuit = /obj/item/circuitboard/machine/electrolyzer - ui_x = 400 - ui_y = 305 - use_power = NO_POWER_USE /// We don't use area power, we always use the cell + /// We don't use area power, we always use the cell + use_power = NO_POWER_USE ///used to check if there is a cell in the machine var/obj/item/stock_parts/cell/cell ///check if the machine is on or off @@ -143,11 +142,13 @@ return return ..() -/obj/machinery/electrolyzer/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.physical_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/electrolyzer/ui_state(mob/user) + return GLOB.physical_state + +/obj/machinery/electrolyzer/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "Electrolyzer", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "Electrolyzer", name) ui.open() /obj/machinery/electrolyzer/ui_data() diff --git a/code/game/machinery/gulag_item_reclaimer.dm b/code/game/machinery/gulag_item_reclaimer.dm index 98f9a304f72..eae7115e340 100644 --- a/code/game/machinery/gulag_item_reclaimer.dm +++ b/code/game/machinery/gulag_item_reclaimer.dm @@ -8,8 +8,7 @@ use_power = IDLE_POWER_USE idle_power_usage = 100 active_power_usage = 2500 - ui_x = 325 - ui_y = 400 + var/list/stored_items = list() var/obj/machinery/gulag_teleporter/linked_teleporter = null @@ -27,11 +26,10 @@ req_access = list() obj_flags |= EMAGGED -/obj/machinery/gulag_item_reclaimer/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/gulag_item_reclaimer/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "GulagItemReclaimer", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "GulagItemReclaimer", name) ui.open() /obj/machinery/gulag_item_reclaimer/ui_data(mob/user) diff --git a/code/game/machinery/hologram.dm b/code/game/machinery/hologram.dm index 50841416bf1..529b11b8f4a 100644 --- a/code/game/machinery/hologram.dm +++ b/code/game/machinery/hologram.dm @@ -41,8 +41,6 @@ Possible to do for anyone motivated enough: max_integrity = 300 armor = list("melee" = 50, "bullet" = 20, "laser" = 20, "energy" = 20, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 50, "acid" = 0) circuit = /obj/item/circuitboard/machine/holopad - ui_x = 440 - ui_y = 245 /// List of living mobs that use the holopad var/list/masters /// Holoray-mob link @@ -208,11 +206,10 @@ obj/machinery/holopad/secure/Initialize() return UI_CLOSE return ..() -/obj/machinery/holopad/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/holopad/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "Holopad", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "Holopad", name) ui.open() /obj/machinery/holopad/ui_data(mob/user) diff --git a/code/game/machinery/hypnochair.dm b/code/game/machinery/hypnochair.dm index 670d8f758c3..608ba529eb7 100644 --- a/code/game/machinery/hypnochair.dm +++ b/code/game/machinery/hypnochair.dm @@ -6,14 +6,12 @@ circuit = /obj/item/circuitboard/machine/hypnochair density = TRUE opacity = 0 - ui_x = 375 - ui_y = 480 + var/mob/living/carbon/victim = null ///Keeps track of the victim to apply effects if it teleports away var/interrogating = FALSE ///Is the device currently interrogating someone? var/start_time = 0 ///Time when the interrogation was started, to calculate effect in case of interruption var/trigger_phrase = "" ///Trigger phrase to implant var/timerid = 0 ///Timer ID for interrogations - var/message_cooldown = 0 ///Cooldown for breakout message /obj/machinery/hypnochair/Initialize() @@ -25,19 +23,19 @@ if(!occupant && default_deconstruction_screwdriver(user, icon_state, icon_state, I)) update_icon() return - if(default_pry_open(I)) return - if(default_deconstruction_crowbar(I)) return - return ..() -/obj/machinery/hypnochair/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.notcontained_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/hypnochair/ui_state(mob/user) + return GLOB.notcontained_state + +/obj/machinery/hypnochair/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "HypnoChair", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "HypnoChair", name) ui.open() /obj/machinery/hypnochair/ui_data() diff --git a/code/game/machinery/launch_pad.dm b/code/game/machinery/launch_pad.dm index 23e1b9dcc1c..5e3fc20ebc6 100644 --- a/code/game/machinery/launch_pad.dm +++ b/code/game/machinery/launch_pad.dm @@ -321,12 +321,15 @@ ui_interact(user) to_chat(user, "[src] projects a display onto your retina.") -/obj/item/launchpad_remote/ui_interact(mob/user, ui_key = "launchpad_remote", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) - if(!ui) - ui = new(user, src, ui_key, "LaunchpadRemote", "Briefcase Launchpad Remote", 300, 240, master_ui, state) //width, height - ui.open() +/obj/item/launchpad_remote/ui_state(mob/user) + return GLOB.inventory_state + +/obj/item/launchpad_remote/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) + if(!ui) + ui = new(user, src, "LaunchpadRemote") + ui.open() ui.set_autoupdate(TRUE) /obj/item/launchpad_remote/ui_data(mob/user) diff --git a/code/game/machinery/medical_kiosk.dm b/code/game/machinery/medical_kiosk.dm index c24ea35ba7b..b474a80d7fe 100644 --- a/code/game/machinery/medical_kiosk.dm +++ b/code/game/machinery/medical_kiosk.dm @@ -153,7 +153,7 @@ else . += "\The [src] has its scanner clipped to the side. Alt-Click to remove." -/obj/machinery/medical_kiosk/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) +/obj/machinery/medical_kiosk/ui_interact(mob/user, datum/tgui/ui) var/patient_distance = 0 if(!ishuman(user)) to_chat(user, "[src] is unable to interface with non-humanoids!") @@ -169,10 +169,9 @@ say("Patient out of range. Resetting biometrics.") clearScans() return - - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "MedicalKiosk", name, 575, 420, master_ui, state) + ui = new(user, src, "MedicalKiosk", name) ui.open() icon_state = "kiosk_off" RefreshParts() diff --git a/code/game/machinery/porta_turret/portable_turret.dm b/code/game/machinery/porta_turret/portable_turret.dm index 0cbde19a6df..068c851baef 100644 --- a/code/game/machinery/porta_turret/portable_turret.dm +++ b/code/game/machinery/porta_turret/portable_turret.dm @@ -29,8 +29,6 @@ max_integrity = 160 //the turret's health integrity_failure = 0.5 armor = list("melee" = 50, "bullet" = 30, "laser" = 30, "energy" = 30, "bomb" = 30, "bio" = 0, "rad" = 0, "fire" = 90, "acid" = 90) - ui_x = 305 - ui_y = 300 /// Base turret icon state var/base_icon_state = "standard" /// Scan range of the turret for locating targets @@ -192,11 +190,10 @@ remove_control() return ..() -/obj/machinery/porta_turret/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/porta_turret/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "PortableTurret", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "PortableTurret", name) ui.open() /obj/machinery/porta_turret/ui_data(mob/user) @@ -831,8 +828,6 @@ density = FALSE req_access = list(ACCESS_AI_UPLOAD) resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF - ui_x = 305 - ui_y = 172 /// Variable dictating if linked turrets are active and will shoot targets var/enabled = TRUE /// Variable dictating if linked turrets will shoot lethal projectiles @@ -924,11 +919,10 @@ else to_chat(user, "There seems to be a firewall preventing you from accessing this device!") -/obj/machinery/turretid/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/turretid/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "TurretControl", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "TurretControl", name) ui.open() /obj/machinery/turretid/ui_data(mob/user) @@ -1063,7 +1057,6 @@ /obj/machinery/porta_turret/lasertag req_access = list(ACCESS_MAINT_TUNNELS, ACCESS_THEATRE) turret_flags = TURRET_FLAG_AUTH_WEAPONS - ui_y = 115 var/team_color /obj/machinery/porta_turret/lasertag/assess_perp(mob/living/carbon/human/perp) diff --git a/code/game/machinery/roulette_machine.dm b/code/game/machinery/roulette_machine.dm index 181b92a9ed7..e217aea39de 100644 --- a/code/game/machinery/roulette_machine.dm +++ b/code/game/machinery/roulette_machine.dm @@ -29,8 +29,6 @@ idle_power_usage = 10 active_power_usage = 100 max_integrity = 500 - ui_x = 603 - ui_y = 475 armor = list("melee" = 45, "bullet" = 30, "laser" = 30, "energy" = 30, "bomb" = 10, "bio" = 30, "rad" = 30, "fire" = 30, "acid" = 30) var/static/list/numbers = list("0" = "green", "1" = "red", "3" = "red", "5" = "red", "7" = "red", "9" = "red", "12" = "red", "14" = "red", "16" = "red",\ "18" = "red", "19" = "red", "21" = "red", "23" = "red", "25" = "red", "27" = "red", "30" = "red", "32" = "red", "34" = "red", "36" = "red",\ @@ -60,12 +58,12 @@ prize_theft(0.05) . = ..() -/obj/machinery/roulette/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) +/obj/machinery/roulette/ui_interact(mob/user, datum/tgui/ui) if(machine_stat & MAINT) return - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "Roulette", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "Roulette", name) ui.open() /obj/machinery/roulette/ui_data(mob/user) diff --git a/code/game/machinery/scan_gate.dm b/code/game/machinery/scan_gate.dm index 334557a814a..d590d2967c8 100644 --- a/code/game/machinery/scan_gate.dm +++ b/code/game/machinery/scan_gate.dm @@ -26,8 +26,6 @@ use_power = IDLE_POWER_USE idle_power_usage = 50 circuit = /obj/item/circuitboard/machine/scanner_gate - ui_x = 400 - ui_y = 300 var/scanline_timer var/next_beep = 0 //avoids spam @@ -180,11 +178,10 @@ return FALSE return ..() -/obj/machinery/scanner_gate/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/scanner_gate/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "ScannerGate", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "ScannerGate", name) ui.open() /obj/machinery/scanner_gate/ui_data() diff --git a/code/game/machinery/spaceheater.dm b/code/game/machinery/spaceheater.dm index 7096ca25f8c..58c210d472d 100644 --- a/code/game/machinery/spaceheater.dm +++ b/code/game/machinery/spaceheater.dm @@ -13,9 +13,8 @@ max_integrity = 250 armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 100, "rad" = 100, "fire" = 80, "acid" = 10) circuit = /obj/item/circuitboard/machine/space_heater - ui_x = 400 - ui_y = 305 - use_power = NO_POWER_USE /// We don't use area power, we always use the cell + /// We don't use area power, we always use the cell + use_power = NO_POWER_USE var/obj/item/stock_parts/cell/cell var/on = FALSE var/mode = HEATER_MODE_STANDBY @@ -170,11 +169,10 @@ else return ..() -/obj/machinery/space_heater/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.physical_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/space_heater/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "SpaceHeater", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "SpaceHeater", name) ui.open() /obj/machinery/space_heater/ui_data() diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm index 79c2c4e04cc..f7bf7ec4f89 100644 --- a/code/game/machinery/suit_storage_unit.dm +++ b/code/game/machinery/suit_storage_unit.dm @@ -9,8 +9,6 @@ power_channel = AREA_USAGE_EQUIP density = TRUE max_integrity = 250 - ui_x = 400 - ui_y = 305 var/obj/item/clothing/suit/space/suit = null var/obj/item/clothing/head/helmet/space/helmet = null @@ -434,11 +432,13 @@ visible_message("[usr] pries open \the [src].", "You pry open \the [src].") open_machine() -/obj/machinery/suit_storage_unit/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.notcontained_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/suit_storage_unit/ui_state(mob/user) + return GLOB.notcontained_state + +/obj/machinery/suit_storage_unit/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "SuitStorageUnit", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "SuitStorageUnit", name) ui.open() /obj/machinery/suit_storage_unit/ui_data() diff --git a/code/game/mecha/mech_bay.dm b/code/game/mecha/mech_bay.dm index 36f17f281c1..8803d198077 100644 --- a/code/game/mecha/mech_bay.dm +++ b/code/game/mecha/mech_bay.dm @@ -86,15 +86,13 @@ icon_screen = "recharge_comp" icon_keyboard = "rd_key" circuit = /obj/item/circuitboard/computer/mech_bay_power_console - ui_x = 400 - ui_y = 200 var/obj/machinery/mech_bay_recharge_port/recharge_port light_color = LIGHT_COLOR_PINK -/obj/machinery/computer/mech_bay_power_console/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/computer/mech_bay_power_console/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "MechBayPowerConsole", "Mech Bay Power Control Console", ui_x, ui_y, master_ui, state) + ui = new(user, src, "MechBayPowerConsole", name) ui.open() /obj/machinery/computer/mech_bay_power_console/ui_act(action, params) diff --git a/code/game/mecha/mech_fabricator.dm b/code/game/mecha/mech_fabricator.dm index 231b649be2e..d45ee34a82c 100644 --- a/code/game/mecha/mech_fabricator.dm +++ b/code/game/mecha/mech_fabricator.dm @@ -258,7 +258,7 @@ /obj/machinery/mecha_part_fabricator/proc/get_construction_time_w_coeff(datum/design/D, roundto = 1) //aran return round(initial(D.construction_time)*time_coeff, roundto) -/obj/machinery/mecha_part_fabricator/ui_interact(mob/user as mob) +/obj/machinery/mecha_part_fabricator/ui_interact(mob/user) . = ..() var/dat, left_part user.set_machine(src) diff --git a/code/game/mecha/mecha_control_console.dm b/code/game/mecha/mecha_control_console.dm index c7db051331b..50d18c6fda7 100644 --- a/code/game/mecha/mecha_control_console.dm +++ b/code/game/mecha/mecha_control_console.dm @@ -5,14 +5,11 @@ icon_keyboard = "tech_key" req_access = list(ACCESS_ROBOTICS) circuit = /obj/item/circuitboard/computer/mecha_control - ui_x = 500 - ui_y = 500 -/obj/machinery/computer/mecha/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/computer/mecha/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "ExosuitControlConsole", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "ExosuitControlConsole", name) ui.open() /obj/machinery/computer/mecha/ui_data(mob/user) diff --git a/code/game/objects/items/RPD.dm b/code/game/objects/items/RPD.dm index 73e8b70aa1a..f1aec586129 100644 --- a/code/game/objects/items/RPD.dm +++ b/code/game/objects/items/RPD.dm @@ -237,18 +237,15 @@ GLOBAL_LIST_INIT(transit_tube_recipes, list( playsound(get_turf(user), 'sound/items/deconstruct.ogg', 50, TRUE) return(BRUTELOSS) -/obj/item/pipe_dispenser/ui_base_html(html) - var/datum/asset/spritesheet/assets = get_asset_datum(/datum/asset/spritesheet/pipes) - . = replacetext(html, "", assets.css_tag()) +/obj/item/pipe_dispenser/ui_assets(mob/user) + return list( + get_asset_datum(/datum/asset/spritesheet/pipes), + ) -/obj/item/pipe_dispenser/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/item/pipe_dispenser/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - var/datum/asset/assets = get_asset_datum(/datum/asset/spritesheet/pipes) - assets.send(user) - - ui = new(user, src, ui_key, "RapidPipeDispenser", name, 425, 515, master_ui, state) + ui = new(user, src, "RapidPipeDispenser", name) ui.open() /obj/item/pipe_dispenser/ui_data(mob/user) diff --git a/code/game/objects/items/airlock_painter.dm b/code/game/objects/items/airlock_painter.dm index 35d331e0207..1df97ee2ab9 100644 --- a/code/game/objects/items/airlock_painter.dm +++ b/code/game/objects/items/airlock_painter.dm @@ -191,10 +191,10 @@ stored_decal_total = "[stored_decal][yellow_fix][stored_color]" return -/obj/item/airlock_painter/decal/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/item/airlock_painter/decal/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "DecalPainter", name, 500, 400, master_ui, state) + ui = new(user, src, "DecalPainter", name) ui.open() /obj/item/airlock_painter/decal/ui_data(mob/user) diff --git a/code/game/objects/items/crayons.dm b/code/game/objects/items/crayons.dm index aa3c9c6a5e6..6e2d6dfe79a 100644 --- a/code/game/objects/items/crayons.dm +++ b/code/game/objects/items/crayons.dm @@ -144,13 +144,15 @@ to_chat(user, "There is not enough of [src] left!") . = TRUE -/obj/item/toy/crayon/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.hands_state) - // tgui is a plague upon this codebase +/obj/item/toy/crayon/ui_state(mob/user) + return GLOB.hands_state - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/item/toy/crayon/ui_interact(mob/user, datum/tgui/ui) + // tgui is a plague upon this codebase + // no u + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "Crayon", name, 600, 600, - master_ui, state) + ui = new(user, src, "Crayon", name) ui.open() /obj/item/toy/crayon/spraycan/AltClick(mob/user) diff --git a/code/game/objects/items/devices/aicard.dm b/code/game/objects/items/devices/aicard.dm index a01112e3deb..a938d618b1a 100644 --- a/code/game/objects/items/devices/aicard.dm +++ b/code/game/objects/items/devices/aicard.dm @@ -55,11 +55,13 @@ name = initial(name) icon_state = initial(icon_state) -/obj/item/aicard/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.hands_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/item/aicard/ui_state(mob/user) + return GLOB.hands_state + +/obj/item/aicard/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "Intellicard", name, 500, 500, master_ui, state) + ui = new(user, src, "Intellicard", name) ui.open() /obj/item/aicard/ui_data() diff --git a/code/game/objects/items/devices/portable_chem_mixer.dm b/code/game/objects/items/devices/portable_chem_mixer.dm index 01bbd3d47e3..5f600721216 100644 --- a/code/game/objects/items/devices/portable_chem_mixer.dm +++ b/code/game/objects/items/devices/portable_chem_mixer.dm @@ -9,14 +9,12 @@ equip_sound = 'sound/items/equip/toolbelt_equip.ogg' custom_price = 2000 custom_premium_price = 2000 - var/ui_x = 645 ///tgui window width - var/ui_y = 550 ///tgui window height var/obj/item/reagent_containers/beaker = null ///Creating an empty slot for a beaker that can be added to dispense into var/amount = 30 ///The amount of reagent that is to be dispensed currently var/anomaly_core_present = FALSE ///TRUE if an anomaly core has been added - + var/list/dispensable_reagents = list() ///List in which all currently dispensable reagents go /obj/item/storage/portable_chem_mixer/ComponentInitialize() @@ -146,7 +144,7 @@ to_chat(user, "The portable chemical mixer is currently open and its contents can be accessed.") return return - + /obj/item/storage/portable_chem_mixer/MouseDrop(obj/over_object) . = ..() if(ismob(loc)) @@ -155,13 +153,13 @@ var/obj/screen/inventory/hand/H = over_object M.putItemFromInventoryInHandIfPossible(src, H.held_index) -/obj/item/storage/portable_chem_mixer/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/item/storage/portable_chem_mixer/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "PortableChemMixer", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "PortableChemMixer", name) if(user.hallucinating()) - ui.set_autoupdate(FALSE) //to not ruin the immersion by constantly changing the fake chemicals + // to not ruin the immersion by constantly changing the fake chemicals + ui.set_autoupdate(FALSE) ui.open() /obj/item/storage/portable_chem_mixer/ui_data(mob/user) @@ -215,7 +213,7 @@ source.trans_to(beaker, to_transfer) actual -= to_transfer if (actual <= 0) - break + break . = TRUE if("remove") var/amount = text2num(params["amount"]) diff --git a/code/game/objects/items/devices/radio/electropack.dm b/code/game/objects/items/devices/radio/electropack.dm index 03de2c71cb6..79d54c7ac97 100644 --- a/code/game/objects/items/devices/radio/electropack.dm +++ b/code/game/objects/items/devices/radio/electropack.dm @@ -10,8 +10,7 @@ slot_flags = ITEM_SLOT_BACK w_class = WEIGHT_CLASS_HUGE custom_materials = list(/datum/material/iron=10000, /datum/material/glass=2500) - var/ui_x = 260 - var/ui_y = 137 + var/on = TRUE var/code = 2 var/frequency = FREQ_ELECTROPACK @@ -85,11 +84,13 @@ frequency = new_frequency SSradio.add_object(src, frequency, RADIO_SIGNALER) -/obj/item/electropack/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.hands_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/item/electropack/ui_state(mob/user) + return GLOB.hands_state + +/obj/item/electropack/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "Electropack", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "Electropack", name) ui.open() /obj/item/electropack/ui_data(mob/user) diff --git a/code/game/objects/items/devices/radio/intercom.dm b/code/game/objects/items/devices/radio/intercom.dm index 3b11e9dce53..15a899ba392 100644 --- a/code/game/objects/items/devices/radio/intercom.dm +++ b/code/game/objects/items/devices/radio/intercom.dm @@ -64,9 +64,8 @@ return interact(user) -/obj/item/radio/intercom/interact(mob/user) - ..() - ui_interact(user, state = GLOB.default_state) +/obj/item/radio/intercom/ui_state(mob/user) + return GLOB.default_state /obj/item/radio/intercom/can_receive(freq, level) if(!on) diff --git a/code/game/objects/items/devices/radio/radio.dm b/code/game/objects/items/devices/radio/radio.dm index eff3fae11f1..231b386ad1a 100644 --- a/code/game/objects/items/devices/radio/radio.dm +++ b/code/game/objects/items/devices/radio/radio.dm @@ -109,19 +109,15 @@ else ..() -/obj/item/radio/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.inventory_state) - . = ..() - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/item/radio/ui_state(mob/user) + return GLOB.inventory_state + +/obj/item/radio/ui_interact(mob/user, datum/tgui/ui, datum/ui_state/state) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - var/ui_width = 360 - var/ui_height = 106 - if(subspace_transmission) - if (channels.len > 0) - ui_height += 6 + channels.len * 21 - else - ui_height += 24 - ui = new(user, src, ui_key, "Radio", name, ui_width, ui_height, master_ui, state) + ui = new(user, src, "Radio", name) + if(state) + ui.set_state(state) ui.open() /obj/item/radio/ui_data(mob/user) diff --git a/code/game/objects/items/devices/traitordevices.dm b/code/game/objects/items/devices/traitordevices.dm index c85cd7ebde6..5916a196e74 100644 --- a/code/game/objects/items/devices/traitordevices.dm +++ b/code/game/objects/items/devices/traitordevices.dm @@ -70,8 +70,6 @@ effective or pretty fucking useless. /obj/item/healthanalyzer/rad_laser custom_materials = list(/datum/material/iron=400) - var/ui_x = 320 - var/ui_y = 335 var/irradiate = TRUE var/stealth = FALSE var/used = FALSE // is it cooling down? @@ -111,11 +109,13 @@ effective or pretty fucking useless. /obj/item/healthanalyzer/rad_laser/interact(mob/user) ui_interact(user) -/obj/item/healthanalyzer/rad_laser/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.hands_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/item/healthanalyzer/rad_laser/ui_state(mob/user) + return GLOB.hands_state + +/obj/item/healthanalyzer/rad_laser/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "RadioactiveMicrolaser", "Radioactive Microlaser", ui_x, ui_y, master_ui, state) + ui = new(user, src, "RadioactiveMicrolaser") ui.open() /obj/item/healthanalyzer/rad_laser/ui_data(mob/user) diff --git a/code/game/objects/items/devices/transfer_valve.dm b/code/game/objects/items/devices/transfer_valve.dm index b8e4455226c..cc26d390ee2 100644 --- a/code/game/objects/items/devices/transfer_valve.dm +++ b/code/game/objects/items/devices/transfer_valve.dm @@ -7,8 +7,7 @@ righthand_file = 'icons/mob/inhands/weapons/bombs_righthand.dmi' desc = "Regulates the transfer of air between two tanks." w_class = WEIGHT_CLASS_BULKY - var/ui_x = 310 - var/ui_y = 320 + var/obj/item/tank/tank_one var/obj/item/tank/tank_two var/obj/item/assembly/attached_device @@ -193,11 +192,13 @@ /obj/item/transfer_valve/proc/c_state() return -/obj/item/transfer_valve/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.hands_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/item/transfer_valve/ui_state(mob/user) + return GLOB.hands_state + +/obj/item/transfer_valve/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "TransferValve", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "TransferValve", name) ui.open() /obj/item/transfer_valve/ui_data(mob/user) diff --git a/code/game/objects/items/eightball.dm b/code/game/objects/items/eightball.dm index 775fdd04468..8c34d935294 100644 --- a/code/game/objects/items/eightball.dm +++ b/code/game/objects/items/eightball.dm @@ -192,11 +192,13 @@ return top_vote -/obj/item/toy/eightball/haunted/ui_interact(mob/user, ui_key="main", datum/tgui/ui=null, force_open=0, datum/tgui/master_ui=null, datum/ui_state/state = GLOB.always_state) +/obj/item/toy/eightball/haunted/ui_state(mob/user) + return GLOB.observer_state - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/item/toy/eightball/haunted/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "EightBallVote", name, 400, 600, master_ui, state) + ui = new(user, src, "EightBallVote", name) ui.open() /obj/item/toy/eightball/haunted/ui_data(mob/user) diff --git a/code/game/objects/items/implants/implant_misc.dm b/code/game/objects/items/implants/implant_misc.dm index baf6bb3966d..87c11c54507 100644 --- a/code/game/objects/items/implants/implant_misc.dm +++ b/code/game/objects/items/implants/implant_misc.dm @@ -93,7 +93,7 @@ /obj/item/implant/radio/activate() . = ..() // needs to be GLOB.deep_inventory_state otherwise it won't open - radio.ui_interact(usr, "main", null, FALSE, null, GLOB.deep_inventory_state) + radio.ui_interact(usr, state = GLOB.deep_inventory_state) /obj/item/implant/radio/Initialize(mapload) . = ..() diff --git a/code/game/objects/items/implants/implantchair.dm b/code/game/objects/items/implants/implantchair.dm index d42d345dfbb..50707e4e93d 100644 --- a/code/game/objects/items/implants/implantchair.dm +++ b/code/game/objects/items/implants/implantchair.dm @@ -5,8 +5,6 @@ icon_state = "implantchair" density = TRUE opacity = 0 - ui_x = 375 - ui_y = 280 var/ready = TRUE var/replenishing = FALSE @@ -28,14 +26,15 @@ open_machine() update_icon() +/obj/machinery/implantchair/ui_state(mob/user) + return GLOB.notcontained_state -/obj/machinery/implantchair/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.notcontained_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/implantchair/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "implantchair", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "ImplantChair", name) ui.open() - /obj/machinery/implantchair/ui_data() var/list/data = list() data["occupied"] = occupant ? 1 : 0 diff --git a/code/game/objects/items/tanks/tanks.dm b/code/game/objects/items/tanks/tanks.dm index daad6f7e2e2..ef7cb1e97c9 100644 --- a/code/game/objects/items/tanks/tanks.dm +++ b/code/game/objects/items/tanks/tanks.dm @@ -142,11 +142,13 @@ else . = ..() -/obj/item/tank/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.hands_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/item/tank/ui_state(mob/user) + return GLOB.hands_state + +/obj/item/tank/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "Tank", name, 400, 120, master_ui, state) + ui = new(user, src, "Tank", name) ui.open() /obj/item/tank/ui_data(mob/user) diff --git a/code/game/objects/items/teleportation.dm b/code/game/objects/items/teleportation.dm index 56f6f11e3d9..dab0204bf57 100644 --- a/code/game/objects/items/teleportation.dm +++ b/code/game/objects/items/teleportation.dm @@ -26,10 +26,10 @@ custom_materials = list(/datum/material/iron=400) var/tracking_range = 20 -/obj/item/locator/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/item/locator/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "BluespaceLocator", name, 300, 300, master_ui, state) + ui = new(user, src, "BluespaceLocator", name) ui.open() /obj/item/locator/ui_data(mob/user) diff --git a/code/game/objects/structures/artstuff.dm b/code/game/objects/structures/artstuff.dm index d72f5634f29..36fd5226951 100644 --- a/code/game/objects/structures/artstuff.dm +++ b/code/game/objects/structures/artstuff.dm @@ -45,8 +45,6 @@ var/height = 11 var/list/grid var/canvas_color = "#ffffff" //empty canvas color - var/ui_x = 400 - var/ui_y = 400 var/used = FALSE var/painting_name //Painting name, this is set after framing. var/finalized = FALSE //Blocks edits @@ -75,12 +73,16 @@ . = ..() ui_interact(user) -/obj/item/canvas/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) +/obj/item/canvas/ui_state(mob/user) + if(finalized) + return GLOB.physical_obscured_state + else + return GLOB.default_state - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/item/canvas/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "Canvas", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "Canvas", name) ui.set_autoupdate(FALSE) ui.open() @@ -190,8 +192,6 @@ icon_state = "19x19" width = 19 height = 19 - ui_x = 600 - ui_y = 600 pixel_x = 6 pixel_y = 9 framed_offset_x = 8 @@ -201,8 +201,6 @@ icon_state = "23x19" width = 23 height = 19 - ui_x = 800 - ui_y = 600 pixel_x = 4 pixel_y = 10 framed_offset_x = 6 @@ -212,8 +210,6 @@ icon_state = "23x23" width = 23 height = 23 - ui_x = 800 - ui_y = 800 pixel_x = 5 pixel_y = 9 framed_offset_x = 5 @@ -263,7 +259,7 @@ /obj/structure/sign/painting/examine(mob/user) . = ..() if(C) - C.ui_interact(user,state = GLOB.physical_obscured_state) + C.ui_interact(user) /obj/structure/sign/painting/wirecutter_act(mob/living/user, obj/item/I) . = ..() diff --git a/code/game/objects/structures/displaycase.dm b/code/game/objects/structures/displaycase.dm index 53319850cf8..fc9365abe5f 100644 --- a/code/game/objects/structures/displaycase.dm +++ b/code/game/objects/structures/displaycase.dm @@ -398,11 +398,10 @@ src.icon = I return -/obj/structure/displaycase/forsale/ui_interact(mob/user, ui_key, datum/tgui/ui, force_open, datum/tgui/master_ui, datum/ui_state/state) - . = ..() - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/structure/displaycase/forsale/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "Vendatray", name, 300, 270, master_ui, state) + ui = new(user, src, "Vendatray", name) ui.set_autoupdate(FALSE) viewing_ui[user] = ui ui.open() diff --git a/code/game/objects/structures/tank_dispenser.dm b/code/game/objects/structures/tank_dispenser.dm index 1245b0cbc2e..6b5e24089d4 100644 --- a/code/game/objects/structures/tank_dispenser.dm +++ b/code/game/objects/structures/tank_dispenser.dm @@ -67,11 +67,13 @@ to_chat(user, "You put [I] in [src].") update_icon() -/obj/structure/tank_dispenser/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.physical_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/structure/tank_dispenser/ui_state(mob/user) + return GLOB.physical_state + +/obj/structure/tank_dispenser/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "TankDispenser", name, 275, 103, master_ui, state) + ui = new(user, src, "TankDispenser", name) ui.open() /obj/structure/tank_dispenser/ui_data(mob/user) diff --git a/code/game/objects/structures/votingbox.dm b/code/game/objects/structures/votingbox.dm index 651ad34682b..4416a09e36a 100644 --- a/code/game/objects/structures/votingbox.dm +++ b/code/game/objects/structures/votingbox.dm @@ -35,7 +35,7 @@ ..() ui_interact(user) -/obj/structure/votebox/ui_interact(mob/user, ui_key, datum/tgui/ui, force_open, datum/tgui/master_ui, datum/ui_state/state) +/obj/structure/votebox/ui_interact(mob/user) . = ..() var/list/dat = list() diff --git a/code/modules/NTNet/relays.dm b/code/modules/NTNet/relays.dm index 6289158901e..0fbb9d0bc0b 100644 --- a/code/modules/NTNet/relays.dm +++ b/code/modules/NTNet/relays.dm @@ -9,8 +9,6 @@ icon_state = "bus" density = TRUE circuit = /obj/item/circuitboard/machine/ntnet_relay - ui_x = 400 - ui_y = 300 var/datum/ntnet/NTNet = null // This is mostly for backwards reference and to allow varedit modifications from ingame. var/enabled = 1 // Set to 0 if the relay was turned off @@ -64,15 +62,12 @@ SSnetworks.station_network.add_log("Quantum relay switched from overload recovery mode to normal operation mode.") ..() -/obj/machinery/ntnet_relay/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) - +/obj/machinery/ntnet_relay/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "NtnetRelay", "NTNet Quantum Relay", ui_x, ui_y, master_ui, state) + ui = new(user, src, "NtnetRelay") ui.open() - /obj/machinery/ntnet_relay/ui_data(mob/user) var/list/data = list() data["enabled"] = enabled @@ -81,7 +76,6 @@ data["dos_crashed"] = dos_failure return data - /obj/machinery/ntnet_relay/ui_act(action, params) if(..()) return diff --git a/code/modules/admin/skill_panel.dm b/code/modules/admin/skill_panel.dm index 7fc621ac213..5cffd773e9a 100644 --- a/code/modules/admin/skill_panel.dm +++ b/code/modules/admin/skill_panel.dm @@ -11,15 +11,17 @@ var/mob/userMob = user holder = userMob.client //if its a mob, assign the mob's client to holder -/datum/skill_panel/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, \ -force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.admin_state)//ui_interact is called when the client verb is called. - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/datum/skill_panel/ui_state(mob/user) + return GLOB.admin_state + +/datum/skill_panel/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "SkillPanel", "Manage Skills", 600, 500, master_ui, state) + ui = new(user, src, "SkillPanel") ui.open() /datum/skill_panel/ui_data(mob/user) //Sends info about the skills to UI - . = list() + . = list() for (var/type in GLOB.skill_types) var/datum/skill/S = GetSkillRef(type) var/lvl_num = targetmind.get_skill_level(type) diff --git a/code/modules/admin/verbs/borgpanel.dm b/code/modules/admin/verbs/borgpanel.dm index e9d1bc3d83f..03f5ad9a79e 100644 --- a/code/modules/admin/verbs/borgpanel.dm +++ b/code/modules/admin/verbs/borgpanel.dm @@ -25,18 +25,18 @@ if(!istype(to_borg)) qdel(src) CRASH("Borg panel is only available for borgs") - user = CLIENT_FROM_VAR(to_user) - if (!user) CRASH("Borg panel attempted to open to a mob without a client") - borg = to_borg -/datum/borgpanel/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.admin_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/datum/borgpanel/ui_state(mob/user) + return GLOB.admin_state + +/datum/borgpanel/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "BorgPanel", "Borg Panel", 700, 700, master_ui, state) + ui = new(user, src, "BorgPanel") ui.open() /datum/borgpanel/ui_data(mob/user) diff --git a/code/modules/antagonists/abductor/machinery/console.dm b/code/modules/antagonists/abductor/machinery/console.dm index 9573380f085..29d998e709b 100644 --- a/code/modules/antagonists/abductor/machinery/console.dm +++ b/code/modules/antagonists/abductor/machinery/console.dm @@ -17,8 +17,6 @@ icon = 'icons/obj/abductor.dmi' icon_state = "console" density = TRUE - ui_x = 600 - ui_y = 532 var/obj/item/abductor/gizmo/gizmo var/obj/item/clothing/suit/armor/abductor/vest/vest var/obj/machinery/abductor/experiment/experiment @@ -62,11 +60,13 @@ return UI_CLOSE return ..() -/obj/machinery/abductor/console/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.physical_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/abductor/console/ui_state(mob/user) + return GLOB.physical_state + +/obj/machinery/abductor/console/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "AbductorConsole", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "AbductorConsole", name) ui.open() /obj/machinery/abductor/console/ui_static_data(mob/user) diff --git a/code/modules/antagonists/abductor/machinery/dispenser.dm b/code/modules/antagonists/abductor/machinery/dispenser.dm index ea0cece97c4..f5bc0946e66 100644 --- a/code/modules/antagonists/abductor/machinery/dispenser.dm +++ b/code/modules/antagonists/abductor/machinery/dispenser.dm @@ -4,8 +4,6 @@ icon = 'icons/obj/abductor.dmi' icon_state = "dispenser" density = TRUE - ui_x = 300 - ui_y = 338 var/list/gland_types var/list/gland_colors var/list/amounts @@ -29,11 +27,13 @@ return UI_CLOSE return ..() -/obj/machinery/abductor/gland_dispenser/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.physical_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/abductor/gland_dispenser/ui_state(mob/user) + return GLOB.physical_state + +/obj/machinery/abductor/gland_dispenser/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "GlandDispenser", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "GlandDispenser", name) ui.open() /obj/machinery/abductor/gland_dispenser/ui_data(mob/user) diff --git a/code/modules/antagonists/abductor/machinery/experiment.dm b/code/modules/antagonists/abductor/machinery/experiment.dm index aeb14e1175d..889a4c36a53 100644 --- a/code/modules/antagonists/abductor/machinery/experiment.dm +++ b/code/modules/antagonists/abductor/machinery/experiment.dm @@ -5,8 +5,6 @@ icon_state = "experiment-open" density = FALSE state_open = TRUE - ui_x = 330 - ui_y = 207 var/points = 0 var/credits = 0 var/list/history @@ -61,11 +59,13 @@ return UI_CLOSE return ..() -/obj/machinery/abductor/experiment/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.physical_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/abductor/experiment/ui_state(mob/user) + return GLOB.physical_state + +/obj/machinery/abductor/experiment/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "ProbingConsole", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "ProbingConsole", name) ui.open() /obj/machinery/abductor/experiment/ui_data(mob/user) diff --git a/code/modules/antagonists/changeling/cellular_emporium.dm b/code/modules/antagonists/changeling/cellular_emporium.dm index bc433ef0cbb..aa73e6d8392 100644 --- a/code/modules/antagonists/changeling/cellular_emporium.dm +++ b/code/modules/antagonists/changeling/cellular_emporium.dm @@ -13,10 +13,13 @@ changeling = null . = ..() -/datum/cellular_emporium/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.always_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/datum/cellular_emporium/ui_state(mob/user) + return GLOB.always_state + +/datum/cellular_emporium/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "CellularEmporium", name, 900, 480, master_ui, state) + ui = new(user, src, "CellularEmporium", name) ui.open() /datum/cellular_emporium/ui_data(mob/user) diff --git a/code/modules/antagonists/eldritch_cult/eldritch_book.dm b/code/modules/antagonists/eldritch_cult/eldritch_book.dm index 833d33dde4e..575670d9ec7 100644 --- a/code/modules/antagonists/eldritch_cult/eldritch_book.dm +++ b/code/modules/antagonists/eldritch_cult/eldritch_book.dm @@ -65,16 +65,15 @@ if(do_after(user,2 SECONDS,user)) qdel(target) - -/obj/item/forbidden_book/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) // Remember to use the appropriate state. +/obj/item/forbidden_book/ui_interact(mob/user, datum/tgui/ui = null) if(!IS_HERETIC(user)) return FALSE last_user = user - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) icon_state = "book_open" - flick("book_opening",src) - ui = new(user, src, ui_key, "ForbiddenLore", name, 500, 900, master_ui, state) + flick("book_opening", src) + ui = new(user, src, "ForbiddenLore", name) ui.open() /obj/item/forbidden_book/ui_data(mob/user) diff --git a/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm b/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm index a76269eb5ae..afe1f40f062 100644 --- a/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm +++ b/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm @@ -7,9 +7,6 @@ density = TRUE resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF - ui_x = 350 - ui_y = 442 - var/timer_set = 90 var/minimum_timer_set = 90 var/maximum_timer_set = 3600 @@ -260,10 +257,10 @@ ui_mode = NUKEUI_AWAIT_TIMER -/obj/machinery/nuclearbomb/ui_interact(mob/user, ui_key="main", datum/tgui/ui=null, force_open=0, datum/tgui/master_ui=null, datum/ui_state/state=GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/nuclearbomb/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "NuclearBomb", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "NuclearBomb", name) ui.open() /obj/machinery/nuclearbomb/ui_data(mob/user) diff --git a/code/modules/antagonists/traitor/equipment/module_picker.dm b/code/modules/antagonists/traitor/equipment/module_picker.dm index 11d8d94352c..60024899d9e 100644 --- a/code/modules/antagonists/traitor/equipment/module_picker.dm +++ b/code/modules/antagonists/traitor/equipment/module_picker.dm @@ -1,8 +1,6 @@ /// The datum and interface for the malf unlock menu, which lets them choose actions to unlock. /datum/module_picker var/name = "Malfunction Modules Menu" - var/ui_x = 620 - var/ui_y = 525 var/selected_cat var/compact_mode = FALSE var/processing_time = 50 @@ -30,11 +28,13 @@ return filtered_modules -/datum/module_picker/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.always_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/datum/module_picker/ui_state(mob/user) + return GLOB.always_state + +/datum/module_picker/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "MalfunctionModulePicker", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "MalfunctionModulePicker", name) ui.open() /datum/module_picker/ui_data(mob/user) diff --git a/code/modules/assembly/assembly.dm b/code/modules/assembly/assembly.dm index 070584546bb..ed7f49c36a6 100644 --- a/code/modules/assembly/assembly.dm +++ b/code/modules/assembly/assembly.dm @@ -125,3 +125,6 @@ if(holder) return holder return src + +/obj/item/assembly/ui_state(mob/user) + return GLOB.hands_state diff --git a/code/modules/assembly/infrared.dm b/code/modules/assembly/infrared.dm index d9330775e85..92a292ffaa6 100644 --- a/code/modules/assembly/infrared.dm +++ b/code/modules/assembly/infrared.dm @@ -6,8 +6,6 @@ is_position_sensitive = TRUE drop_sound = 'sound/items/handling/component_drop.ogg' pickup_sound = 'sound/items/handling/component_pickup.ogg' - var/ui_x = 225 - var/ui_y = 110 var/on = FALSE var/visible = FALSE var/maxlength = 8 @@ -188,11 +186,10 @@ return ..() return UI_CLOSE -/obj/item/assembly/infra/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.hands_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/item/assembly/infra/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "InfraredEmitter", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "InfraredEmitter", name) ui.open() /obj/item/assembly/infra/ui_data(mob/user) diff --git a/code/modules/assembly/proximity.dm b/code/modules/assembly/proximity.dm index ef931279dea..1fe05770f55 100644 --- a/code/modules/assembly/proximity.dm +++ b/code/modules/assembly/proximity.dm @@ -6,8 +6,6 @@ attachable = TRUE drop_sound = 'sound/items/handling/component_drop.ogg' pickup_sound = 'sound/items/handling/component_pickup.ogg' - var/ui_x = 250 - var/ui_y = 185 var/scanning = FALSE var/timing = FALSE var/time = 10 @@ -115,11 +113,10 @@ return ..() return UI_CLOSE -/obj/item/assembly/prox_sensor/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.hands_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/item/assembly/prox_sensor/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "ProximitySensor", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "ProximitySensor", name) ui.open() /obj/item/assembly/prox_sensor/ui_data(mob/user) diff --git a/code/modules/assembly/signaler.dm b/code/modules/assembly/signaler.dm index c52689df336..82fe352d497 100644 --- a/code/modules/assembly/signaler.dm +++ b/code/modules/assembly/signaler.dm @@ -10,8 +10,7 @@ attachable = TRUE drop_sound = 'sound/items/handling/component_drop.ogg' pickup_sound = 'sound/items/handling/component_pickup.ogg' - var/ui_x = 280 - var/ui_y = 132 + var/code = DEFAULT_SIGNALER_CODE var/frequency = FREQ_SIGNALER var/datum/radio_frequency/radio_connection @@ -69,11 +68,10 @@ return ..() return UI_CLOSE -/obj/item/assembly/signaler/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.hands_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/item/assembly/signaler/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "Signaler", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "Signaler", name) ui.open() /obj/item/assembly/signaler/ui_data(mob/user) diff --git a/code/modules/assembly/timer.dm b/code/modules/assembly/timer.dm index 3224b2d3737..4f8bea6900d 100644 --- a/code/modules/assembly/timer.dm +++ b/code/modules/assembly/timer.dm @@ -6,8 +6,7 @@ attachable = TRUE drop_sound = 'sound/items/handling/component_drop.ogg' pickup_sound = 'sound/items/handling/component_pickup.ogg' - var/ui_x = 275 - var/ui_y = 115 + var/timing = FALSE var/time = 5 var/saved_time = 5 @@ -90,11 +89,10 @@ return ..() return UI_CLOSE -/obj/item/assembly/timer/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.hands_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/item/assembly/timer/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "Timer", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "Timer", name) ui.open() /obj/item/assembly/timer/ui_data(mob/user) diff --git a/code/modules/asset_cache/asset_list.dm b/code/modules/asset_cache/asset_list.dm index 2e5881c67f3..f4018dc4b25 100644 --- a/code/modules/asset_cache/asset_list.dm +++ b/code/modules/asset_cache/asset_list.dm @@ -162,7 +162,10 @@ GLOBAL_LIST_EMPTY(asset_datums) Insert("[prefix][prefix2][icon_state_name]", I, icon_state=icon_state_name, dir=direction) /datum/asset/spritesheet/proc/css_tag() - return {""} + return {""} + +/datum/asset/spritesheet/proc/css_filename() + return "spritesheet_[name].css" /datum/asset/spritesheet/proc/icon_tag(sprite_name) var/sprite = sprites[sprite_name] diff --git a/code/modules/asset_cache/asset_list_items.dm b/code/modules/asset_cache/asset_list_items.dm index 2eabc81a7a2..96cb2830838 100644 --- a/code/modules/asset_cache/asset_list_items.dm +++ b/code/modules/asset_cache/asset_list_items.dm @@ -209,7 +209,7 @@ "boss4.gif" = 'icons/UI_Icons/Arcade/boss4.gif', "boss5.gif" = 'icons/UI_Icons/Arcade/boss5.gif', "boss6.gif" = 'icons/UI_Icons/Arcade/boss6.gif', - ) + ) /datum/asset/spritesheet/simple/achievements name ="achievements" diff --git a/code/modules/atmospherics/machinery/airalarm.dm b/code/modules/atmospherics/machinery/airalarm.dm index bf407b8a108..2a65838dde2 100644 --- a/code/modules/atmospherics/machinery/airalarm.dm +++ b/code/modules/atmospherics/machinery/airalarm.dm @@ -71,8 +71,6 @@ integrity_failure = 0.33 armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 100, "bomb" = 0, "bio" = 100, "rad" = 100, "fire" = 90, "acid" = 30) resistance_flags = FIRE_PROOF - ui_x = 440 - ui_y = 650 var/danger_level = 0 var/mode = AALARM_MODE_SCRUBBING @@ -243,11 +241,11 @@ return ..() return UI_CLOSE -/obj/machinery/airalarm/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) + +/obj/machinery/airalarm/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "AirAlarm", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "AirAlarm", name) ui.open() /obj/machinery/airalarm/ui_data(mob/user) 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 4b032711409..940f2a00356 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm @@ -26,9 +26,6 @@ Passive gate is similar to the regular pump except: construction_type = /obj/item/pipe/directional pipe_state = "passivegate" - ui_x = 335 - ui_y = 115 - /obj/machinery/atmospherics/components/binary/passive_gate/CtrlClick(mob/user) if(can_interact(user)) on = !on @@ -85,11 +82,10 @@ Passive gate is similar to the regular pump except: )) radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA) -/obj/machinery/atmospherics/components/binary/passive_gate/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/atmospherics/components/binary/passive_gate/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "AtmosPump", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "AtmosPump", name) ui.open() /obj/machinery/atmospherics/components/binary/passive_gate/ui_data() diff --git a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm index b22dfb0cfce..d65eecbfca8 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm @@ -27,9 +27,6 @@ construction_type = /obj/item/pipe/directional pipe_state = "pump" - ui_x = 335 - ui_y = 115 - /obj/machinery/atmospherics/components/binary/pump/CtrlClick(mob/user) if(can_interact(user)) on = !on @@ -84,11 +81,10 @@ )) radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA) -/obj/machinery/atmospherics/components/binary/pump/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/atmospherics/components/binary/pump/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "AtmosPump", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "AtmosPump", name) ui.open() /obj/machinery/atmospherics/components/binary/pump/ui_data() diff --git a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm index 3fd93d37ba3..6ad675e123f 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm @@ -28,9 +28,6 @@ construction_type = /obj/item/pipe/directional pipe_state = "volumepump" - ui_x = 335 - ui_y = 115 - /obj/machinery/atmospherics/components/binary/volume_pump/CtrlClick(mob/user) if(can_interact(user)) on = !on @@ -111,11 +108,10 @@ )) radio_connection.post_signal(src, signal) -/obj/machinery/atmospherics/components/binary/volume_pump/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/atmospherics/components/binary/volume_pump/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "AtmosPump", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "AtmosPump", name) ui.open() /obj/machinery/atmospherics/components/binary/volume_pump/ui_data() diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm index c29422eddb4..f663f0fc9b8 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm @@ -14,9 +14,6 @@ construction_type = /obj/item/pipe/trinary/flippable pipe_state = "filter" - ui_x = 390 - ui_y = 187 - /obj/machinery/atmospherics/components/trinary/filter/CtrlClick(mob/user) if(can_interact(user)) on = !on @@ -121,11 +118,10 @@ set_frequency(frequency) return ..() -/obj/machinery/atmospherics/components/trinary/filter/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/atmospherics/components/trinary/filter/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "AtmosFilter", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "AtmosFilter", name) ui.open() /obj/machinery/atmospherics/components/trinary/filter/ui_data() diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm index 68f82177e42..1fb99a2b025 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm @@ -14,9 +14,6 @@ construction_type = /obj/item/pipe/trinary/flippable pipe_state = "mixer" - ui_x = 370 - ui_y = 165 - //node 3 is the outlet, nodes 1 & 2 are intakes /obj/machinery/atmospherics/components/trinary/mixer/CtrlClick(mob/user) @@ -127,11 +124,10 @@ var/datum/pipeline/parent3 = parents[3] parent3.update = TRUE -/obj/machinery/atmospherics/components/trinary/mixer/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/atmospherics/components/trinary/mixer/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "AtmosMixer", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "AtmosMixer", name) ui.open() /obj/machinery/atmospherics/components/trinary/mixer/ui_data() diff --git a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm index 81bebc8c6ff..a3baa7e0d7d 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm @@ -12,8 +12,6 @@ layer = ABOVE_WINDOW_LAYER state_open = FALSE circuit = /obj/item/circuitboard/machine/cryo_tube - ui_x = 400 - ui_y = 550 pipe_flags = PIPING_ONE_PER_TURF | PIPING_DEFAULT_LAYER_ONLY occupant_typecache = list(/mob/living/carbon, /mob/living/simple_animal) @@ -366,11 +364,14 @@ return return ..() -/obj/machinery/atmospherics/components/unary/cryo_cell/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.notcontained_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/atmospherics/components/unary/cryo_cell/ui_state(mob/user) + return GLOB.notcontained_state + + +/obj/machinery/atmospherics/components/unary/cryo_cell/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "Cryo", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "Cryo", name) ui.open() /obj/machinery/atmospherics/components/unary/cryo_cell/ui_data() diff --git a/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm b/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm index d8c9957f350..5c4886f1397 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm @@ -23,9 +23,6 @@ pipe_state = "injector" - ui_x = 310 - ui_y = 115 - /obj/machinery/atmospherics/components/unary/outlet_injector/CtrlClick(mob/user) if(can_interact(user)) on = !on @@ -144,11 +141,10 @@ update_icon() -/obj/machinery/atmospherics/components/unary/outlet_injector/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/atmospherics/components/unary/outlet_injector/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "AtmosPump", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "AtmosPump", name) ui.open() /obj/machinery/atmospherics/components/unary/outlet_injector/ui_data() diff --git a/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm b/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm index 6914ed51873..9713f189f59 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm @@ -10,8 +10,6 @@ armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 100, "bomb" = 0, "bio" = 100, "rad" = 100, "fire" = 80, "acid" = 30) layer = OBJ_LAYER circuit = /obj/item/circuitboard/machine/thermomachine - ui_x = 300 - ui_y = 230 pipe_flags = PIPING_ONE_PER_TURF @@ -123,11 +121,10 @@ return ..() return UI_CLOSE -/obj/machinery/atmospherics/components/unary/thermomachine/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/atmospherics/components/unary/thermomachine/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "ThermoMachine", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "ThermoMachine", name) ui.open() /obj/machinery/atmospherics/components/unary/thermomachine/ui_data(mob/user) diff --git a/code/modules/atmospherics/machinery/portable/canister.dm b/code/modules/atmospherics/machinery/portable/canister.dm index 7ce6378456f..2bb907410ab 100644 --- a/code/modules/atmospherics/machinery/portable/canister.dm +++ b/code/modules/atmospherics/machinery/portable/canister.dm @@ -10,8 +10,6 @@ desc = "A canister for the storage of gas." icon_state = "yellow" density = TRUE - ui_x = 300 - ui_y = 232 ///The base iconstate, used to make dealing with breaking the canister less hellish var/base_icon_state = "yellow" @@ -418,11 +416,13 @@ take_damage(clamp((our_temperature/heat_limit) * (our_pressure/pressure_limit), 5, 50), BURN, 0) update_icon() -/obj/machinery/portable_atmospherics/canister/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.physical_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/portable_atmospherics/canister/ui_state(mob/user) + return GLOB.physical_state + +/obj/machinery/portable_atmospherics/canister/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "Canister", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "Canister", name) ui.open() /obj/machinery/portable_atmospherics/canister/ui_data() diff --git a/code/modules/atmospherics/machinery/portable/pump.dm b/code/modules/atmospherics/machinery/portable/pump.dm index 04c40115185..286a373fb6f 100644 --- a/code/modules/atmospherics/machinery/portable/pump.dm +++ b/code/modules/atmospherics/machinery/portable/pump.dm @@ -8,8 +8,6 @@ name = "portable air pump" icon_state = "psiphon:0" density = TRUE - ui_x = 300 - ui_y = 315 max_integrity = 250 ///Max amount of heat allowed inside of the canister before it starts to melt (different tiers have different limits) @@ -88,12 +86,10 @@ else if(on && holding && direction == PUMP_OUT) investigate_log("[key_name(user)] started a transfer into [holding].", INVESTIGATE_ATMOS) - -/obj/machinery/portable_atmospherics/pump/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.physical_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/portable_atmospherics/pump/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "PortablePump", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "PortablePump", name) ui.open() /obj/machinery/portable_atmospherics/pump/ui_data() diff --git a/code/modules/atmospherics/machinery/portable/scrubber.dm b/code/modules/atmospherics/machinery/portable/scrubber.dm index a97ba1a8fe9..926d3898e5b 100644 --- a/code/modules/atmospherics/machinery/portable/scrubber.dm +++ b/code/modules/atmospherics/machinery/portable/scrubber.dm @@ -2,22 +2,29 @@ name = "portable air scrubber" icon_state = "pscrubber:0" density = TRUE - ui_x = 320 - ui_y = 350 - max_integrity = 250 + volume = 1000 + ///Max amount of heat allowed inside of the canister before it starts to melt (different tiers have different limits) var/heat_limit = 5000 ///Max amount of pressure allowed inside of the canister before it starts to break (different tiers have different limits) var/pressure_limit = 50000 - var/on = FALSE var/volume_rate = 1000 var/overpressure_m = 80 var/use_overlays = TRUE - volume = 1000 - - var/list/scrubbing = list(/datum/gas/plasma, /datum/gas/carbon_dioxide, /datum/gas/nitrous_oxide, /datum/gas/bz, /datum/gas/nitryl, /datum/gas/tritium, /datum/gas/hypernoblium, /datum/gas/water_vapor, /datum/gas/freon, /datum/gas/hydrogen) + var/list/scrubbing = list( + /datum/gas/plasma, + /datum/gas/carbon_dioxide, + /datum/gas/nitrous_oxide, + /datum/gas/bz, + /datum/gas/nitryl, + /datum/gas/tritium, + /datum/gas/hypernoblium, + /datum/gas/water_vapor, + /datum/gas/freon, + /datum/gas/hydrogen, + ) /obj/machinery/portable_atmospherics/scrubber/Destroy() var/turf/T = get_turf(src) @@ -88,11 +95,10 @@ on = !on update_icon() -/obj/machinery/portable_atmospherics/scrubber/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.physical_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/portable_atmospherics/scrubber/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "PortableScrubber", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "PortableScrubber", name) ui.open() /obj/machinery/portable_atmospherics/scrubber/ui_data() diff --git a/code/modules/awaymissions/gateway.dm b/code/modules/awaymissions/gateway.dm index 6fcb5695975..f2cf7c1b9bc 100644 --- a/code/modules/awaymissions/gateway.dm +++ b/code/modules/awaymissions/gateway.dm @@ -275,11 +275,10 @@ GLOBAL_LIST_EMPTY(gateway_destinations) . = ..() try_to_linkup() -/obj/machinery/computer/gateway_control/ui_interact(mob/user, ui_key = "main", datum/tgui/ui, force_open, datum/tgui/master_ui, datum/ui_state/state = GLOB.default_state) - . = ..() - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/computer/gateway_control/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "Gateway", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "Gateway", name) ui.open() /obj/machinery/computer/gateway_control/ui_data(mob/user) diff --git a/code/modules/cargo/blackmarket/blackmarket_uplink.dm b/code/modules/cargo/blackmarket/blackmarket_uplink.dm index 3833b0505a5..015848c8aca 100644 --- a/code/modules/cargo/blackmarket/blackmarket_uplink.dm +++ b/code/modules/cargo/blackmarket/blackmarket_uplink.dm @@ -4,8 +4,6 @@ icon_state = "uplink" // UI variables. - var/ui_x = 600 - var/ui_y = 480 var/viewing_category var/viewing_market var/selected_item @@ -55,10 +53,10 @@ user.put_in_hands(holochip) to_chat(user, "You withdraw [amount_to_remove] credits into a holochip.") -/obj/item/blackmarket_uplink/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/item/blackmarket_uplink/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "BlackMarketUplink", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "BlackMarketUplink", name) ui.open() /obj/item/blackmarket_uplink/ui_data(mob/user) diff --git a/code/modules/cargo/bounty_console.dm b/code/modules/cargo/bounty_console.dm index 88e5aba2223..8a297150160 100644 --- a/code/modules/cargo/bounty_console.dm +++ b/code/modules/cargo/bounty_console.dm @@ -32,12 +32,12 @@"
dat += "General Settings" dat += "UI Style: [UI_style]" - dat += "tgui Monitors: [(tgui_lock) ? "Primary" : "All"] " - dat += "tgui Style: [(tgui_fancy) ? "Fancy" : "No Frills"] " + dat += "tgui Window Mode: [(tgui_fancy) ? "Fancy (default)" : "Compatible (slower)"] " + dat += "tgui Window Placement: [(tgui_lock) ? "Primary monitor" : "Free (default)"] " dat += "Show Runechat Chat Bubbles: [chat_on_map ? "Enabled" : "Disabled"] " dat += "Runechat message char limit: [max_chat_length] " dat += "See Runechat for non-mobs: [see_chat_non_mob ? "Enabled" : "Disabled"] " diff --git a/code/modules/events/pirates.dm b/code/modules/events/pirates.dm index 0db4cde1d4a..f66f33a121c 100644 --- a/code/modules/events/pirates.dm +++ b/code/modules/events/pirates.dm @@ -255,8 +255,6 @@ /obj/machinery/computer/piratepad_control name = "cargo hold control terminal" - ui_x = 600 - ui_y = 230 var/status_report = "Ready for delivery." var/obj/machinery/piratepad/pad var/warmup_time = 100 @@ -287,11 +285,10 @@ else pad = locate() in range(4,src) -/obj/machinery/computer/piratepad_control/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/computer/piratepad_control/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "CargoHoldTerminal", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "CargoHoldTerminal", name) ui.open() /obj/machinery/computer/piratepad_control/ui_data(mob/user) diff --git a/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm b/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm index 1345599e4c2..de26fc0e65c 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm @@ -12,8 +12,6 @@ idle_power_usage = 5 active_power_usage = 100 circuit = /obj/item/circuitboard/machine/smartfridge - ui_x = 440 - ui_y = 550 var/max_n_of_items = 1500 var/allow_ai_retrieve = FALSE @@ -162,10 +160,10 @@ adjust_item_drop_location(O) -/obj/machinery/smartfridge/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/smartfridge/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "SmartVend", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "SmartVend", name) ui.set_autoupdate(FALSE) ui.open() diff --git a/code/modules/holodeck/computer.dm b/code/modules/holodeck/computer.dm index 4b3343a84ff..b45dadd74d3 100644 --- a/code/modules/holodeck/computer.dm +++ b/code/modules/holodeck/computer.dm @@ -24,8 +24,6 @@ icon_screen = "holocontrol" idle_power_usage = 10 active_power_usage = 50 - ui_x = 400 - ui_y = 500 var/area/holodeck/linked var/area/holodeck/program @@ -87,10 +85,10 @@ . = ..() toggle_power(!machine_stat) -/obj/machinery/computer/holodeck/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/computer/holodeck/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "Holodeck", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "Holodeck", name) ui.open() /obj/machinery/computer/holodeck/ui_data(mob/user) diff --git a/code/modules/hydroponics/biogenerator.dm b/code/modules/hydroponics/biogenerator.dm index 4a0e1864dd8..0b0fe364f2b 100644 --- a/code/modules/hydroponics/biogenerator.dm +++ b/code/modules/hydroponics/biogenerator.dm @@ -7,8 +7,6 @@ use_power = IDLE_POWER_USE idle_power_usage = 40 circuit = /obj/item/circuitboard/machine/biogenerator - ui_x = 550 - ui_y = 380 var/processing = FALSE var/obj/item/reagent_containers/glass/beaker = null var/points = 0 @@ -259,17 +257,15 @@ return UI_CLOSE return ..() -/obj/machinery/biogenerator/ui_base_html(html) - var/datum/asset/spritesheet/simple/assets = get_asset_datum(/datum/asset/spritesheet/research_designs) - . = replacetext(html, "", assets.css_tag()) +/obj/machinery/biogenerator/ui_assets(mob/user) + return list( + get_asset_datum(/datum/asset/spritesheet/research_designs), + ) -/obj/machinery/biogenerator/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/biogenerator/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - var/datum/asset/assets = get_asset_datum(/datum/asset/spritesheet/research_designs) - assets.send(user) - ui = new(user, src, ui_key, "Biogenerator", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "Biogenerator", name) ui.open() /obj/machinery/biogenerator/ui_data(mob/user) diff --git a/code/modules/hydroponics/seed_extractor.dm b/code/modules/hydroponics/seed_extractor.dm index 2320f95963b..00381069bf6 100644 --- a/code/modules/hydroponics/seed_extractor.dm +++ b/code/modules/hydroponics/seed_extractor.dm @@ -66,8 +66,6 @@ var/list/piles = list() var/max_seeds = 1000 var/seed_multiplier = 1 - ui_x = 1000 - ui_y = 400 /obj/machinery/seed_extractor/RefreshParts() for(var/obj/item/stock_parts/matter_bin/B in component_parts) @@ -163,11 +161,13 @@ . = TRUE -/obj/machinery/seed_extractor/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.notcontained_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/seed_extractor/ui_state(mob/user) + return GLOB.notcontained_state + +/obj/machinery/seed_extractor/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "SeedExtractor", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "SeedExtractor", name) ui.open() /obj/machinery/seed_extractor/ui_data() diff --git a/code/modules/language/language_menu.dm b/code/modules/language/language_menu.dm index 0df7c01fca8..bffd3d59af6 100644 --- a/code/modules/language/language_menu.dm +++ b/code/modules/language/language_menu.dm @@ -8,10 +8,13 @@ language_holder = null . = ..() -/datum/language_menu/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.language_menu_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/datum/language_menu/ui_state(mob/user) + return GLOB.language_menu_state + +/datum/language_menu/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "LanguageMenu", "Language Menu", 700, 600, master_ui, state) + ui = new(user, src, "LanguageMenu") ui.open() /datum/language_menu/ui_data(mob/user) diff --git a/code/modules/library/lib_codex_gigas.dm b/code/modules/library/lib_codex_gigas.dm index e7bb86ff799..be017a07ef6 100644 --- a/code/modules/library/lib_codex_gigas.dm +++ b/code/modules/library/lib_codex_gigas.dm @@ -91,11 +91,10 @@ currentSection = SUFFIX return currentSection != oldSection -/obj/item/book/codex_gigas/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/item/book/codex_gigas/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "CodexGigas", name, 450, 450, master_ui, state) + ui = new(user, src, "CodexGigas", name) ui.open() /obj/item/book/codex_gigas/ui_data(mob/user) diff --git a/code/modules/library/soapstone.dm b/code/modules/library/soapstone.dm index 3f1ea429e54..f17040a9384 100644 --- a/code/modules/library/soapstone.dm +++ b/code/modules/library/soapstone.dm @@ -204,10 +204,13 @@ /obj/structure/chisel_message/interact() return -/obj/structure/chisel_message/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.always_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/structure/chisel_message/ui_state(mob/user) + return GLOB.always_state + +/obj/structure/chisel_message/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "EngravedMessage", name, 600, 300, master_ui, state) + ui = new(user, src, "EngravedMessage", name) ui.open() /obj/structure/chisel_message/ui_data(mob/user) diff --git a/code/modules/mafia/controller.dm b/code/modules/mafia/controller.dm index f8781ca65cb..1e6ad963d35 100644 --- a/code/modules/mafia/controller.dm +++ b/code/modules/mafia/controller.dm @@ -651,10 +651,13 @@ judgement_guilty_votes -= user_role//no double voting judgement_guilty_votes += user_role -/datum/mafia_controller/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.always_state) - ui = SStgui.try_update_ui(user, src, ui_key, null, force_open) +/datum/mafia_controller/ui_state(mob/user) + return GLOB.always_state + +/datum/mafia_controller/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, null) if(!ui) - ui = new(user, src, ui_key, "MafiaPanel", "Mafia", 650, 550, master_ui, state) + ui = new(user, src, "MafiaPanel") ui.set_autoupdate(FALSE) ui.open() diff --git a/code/modules/mining/laborcamp/laborstacker.dm b/code/modules/mining/laborcamp/laborstacker.dm index 44aa3ebec7f..e091f0ff906 100644 --- a/code/modules/mining/laborcamp/laborstacker.dm +++ b/code/modules/mining/laborcamp/laborstacker.dm @@ -8,8 +8,6 @@ GLOBAL_LIST(labor_sheet_values) icon = 'icons/obj/machines/mining_machines.dmi' icon_state = "console" density = FALSE - ui_x = 315 - ui_y = 430 var/obj/machinery/mineral/stacking_machine/laborstacker/stacking_machine = null var/machinedir = SOUTH @@ -35,11 +33,10 @@ GLOBAL_LIST(labor_sheet_values) /proc/cmp_sheet_list(list/a, list/b) return a["value"] - b["value"] -/obj/machinery/mineral/labor_claim_console/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/mineral/labor_claim_console/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "LaborClaimConsole", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "LaborClaimConsole", name) ui.open() /obj/machinery/mineral/labor_claim_console/ui_data(mob/user) diff --git a/code/modules/mining/machine_redemption.dm b/code/modules/mining/machine_redemption.dm index eb860b747aa..16324d410cc 100644 --- a/code/modules/mining/machine_redemption.dm +++ b/code/modules/mining/machine_redemption.dm @@ -12,8 +12,6 @@ req_access = list(ACCESS_MINERAL_STOREROOM) layer = BELOW_OBJ_LAYER circuit = /obj/item/circuitboard/machine/ore_redemption - ui_x = 440 - ui_y = 550 needs_item_input = TRUE processing_flags = START_PROCESSING_MANUALLY @@ -208,10 +206,10 @@ register_input_turf() // register the new one return TRUE -/obj/machinery/mineral/ore_redemption/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/mineral/ore_redemption/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "OreRedemptionMachine", "Ore Redemption Machine", ui_x, ui_y, master_ui, state) + ui = new(user, src, "OreRedemptionMachine") ui.open() /obj/machinery/mineral/ore_redemption/ui_data(mob/user) diff --git a/code/modules/mining/machine_vending.dm b/code/modules/mining/machine_vending.dm index 6a123549559..09eb790e42f 100644 --- a/code/modules/mining/machine_vending.dm +++ b/code/modules/mining/machine_vending.dm @@ -7,8 +7,6 @@ icon_state = "mining" density = TRUE circuit = /obj/item/circuitboard/machine/mining_equipment_vendor - ui_x = 425 - ui_y = 600 var/icon_deny = "mining-deny" var/obj/item/card/id/inserted_id var/list/prize_list = list( //if you add something to this, please, for the love of god, sort it by price/type. use tabs and not spaces. @@ -63,7 +61,7 @@ new /datum/data/mining_equipment("KA Damage Increase", /obj/item/borg/upgrade/modkit/damage, 1000), new /datum/data/mining_equipment("KA Cooldown Decrease", /obj/item/borg/upgrade/modkit/cooldown, 1000), new /datum/data/mining_equipment("KA AoE Damage", /obj/item/borg/upgrade/modkit/aoe/mobs, 2000) - ) + ) /datum/data/mining_equipment var/equipment_name = "generic" @@ -90,17 +88,15 @@ else icon_state = "[initial(icon_state)]-off" -/obj/machinery/mineral/equipment_vendor/ui_base_html(html) - var/datum/asset/spritesheet/assets = get_asset_datum(/datum/asset/spritesheet/vending) - . = replacetext(html, "", assets.css_tag()) +/obj/machinery/mineral/equipment_vendor/ui_assets(mob/user) + return list( + get_asset_datum(/datum/asset/spritesheet/vending), + ) -/obj/machinery/mineral/equipment_vendor/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/mineral/equipment_vendor/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - var/datum/asset/assets = get_asset_datum(/datum/asset/spritesheet/vending) - assets.send(user) - ui = new(user, src, ui_key, "MiningVendor", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "MiningVendor", name) ui.open() /obj/machinery/mineral/equipment_vendor/ui_static_data(mob/user) diff --git a/code/modules/mining/mint.dm b/code/modules/mining/mint.dm index ce9f7f31a58..82b2dbca6fb 100644 --- a/code/modules/mining/mint.dm +++ b/code/modules/mining/mint.dm @@ -7,8 +7,6 @@ icon_state = "coinpress0" density = TRUE input_dir = EAST - ui_x = 300 - ui_y = 250 needs_item_input = TRUE var/obj/item/storage/bag/money/bag_to_use var/produced_coins = 0 // how many coins the machine has made in it's last cycle @@ -81,11 +79,10 @@ end_processing() icon_state = "coinpress0" -/obj/machinery/mineral/mint/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/mineral/mint/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "Mint", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "Mint", name) ui.open() /obj/machinery/mineral/mint/ui_data() diff --git a/code/modules/mining/satchel_ore_boxdm.dm b/code/modules/mining/satchel_ore_boxdm.dm index e689a37b250..4de34ecdba1 100644 --- a/code/modules/mining/satchel_ore_boxdm.dm +++ b/code/modules/mining/satchel_ore_boxdm.dm @@ -9,9 +9,6 @@ density = TRUE pressure_resistance = 5*ONE_ATMOSPHERE - var/ui_x = 335 - var/ui_y = 415 - /obj/structure/ore_box/attackby(obj/item/W, mob/user, params) if (istype(W, /obj/item/stack/ore)) user.transferItemToLoc(W, src) @@ -61,11 +58,10 @@ stoplag() drop = drop_location() -/obj/structure/ore_box/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/structure/ore_box/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "OreBox", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "OreBox", name) ui.open() /obj/structure/ore_box/ui_data() diff --git a/code/modules/mob/dead/observer/notificationprefs.dm b/code/modules/mob/dead/observer/notificationprefs.dm index 160abd57e1f..524ff80d5d8 100644 --- a/code/modules/mob/dead/observer/notificationprefs.dm +++ b/code/modules/mob/dead/observer/notificationprefs.dm @@ -3,12 +3,10 @@ set name = "Notification preferences" set desc = "Notification preferences" - var/datum/notificationpanel/panel = new(usr) + var/datum/notificationpanel/panel = new(usr) panel.ui_interact(usr) - - /datum/notificationpanel var/client/user @@ -21,10 +19,13 @@ else src.user = user -/datum/notificationpanel/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.observer_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/datum/notificationpanel/ui_state(mob/user) + return GLOB.observer_state + +/datum/notificationpanel/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "NotificationPreferences", "Notification Preferences", 270, 360, master_ui, state) + ui = new(user, src, "NotificationPreferences") ui.open() /datum/notificationpanel/ui_data(mob/user) @@ -35,8 +36,7 @@ "key" = key, "enabled" = (user.ckey in GLOB.poll_ignore[key]), "desc" = GLOB.poll_ignore_desc[key] - )) - + )) /datum/notificationpanel/ui_act(action, params) if(..()) diff --git a/code/modules/mob/dead/observer/orbit.dm b/code/modules/mob/dead/observer/orbit.dm index 845493dc93e..b81172afada 100644 --- a/code/modules/mob/dead/observer/orbit.dm +++ b/code/modules/mob/dead/observer/orbit.dm @@ -6,9 +6,12 @@ qdel(src) owner = new_owner -/datum/orbit_menu/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.observer_state) +/datum/orbit_menu/ui_state(mob/user) + return GLOB.observer_state + +/datum/orbit_menu/ui_interact(mob/user, datum/tgui/ui) if (!ui) - ui = new(user, src, ui_key, "Orbit", "Orbit", 350, 700, master_ui, state) + ui = new(user, src, "Orbit") ui.open() /datum/orbit_menu/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) diff --git a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm index 204fba94e5b..271245d0e26 100644 --- a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm +++ b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm @@ -264,11 +264,16 @@ else ui_interact(owner) -/datum/action/innate/swap_body/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.always_state) +/datum/action/innate/swap_body/ui_host(mob/user) + return owner - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/datum/action/innate/swap_body/ui_state(mob/user) + return GLOB.not_incapacitated_state + +/datum/action/innate/swap_body/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "SlimeBodySwapper", name, 400, 400, master_ui, state) + ui = new(user, src, "SlimeBodySwapper", name) ui.open() /datum/action/innate/swap_body/ui_data(mob/user) diff --git a/code/modules/mob/living/silicon/ai/life.dm b/code/modules/mob/living/silicon/ai/life.dm index b084ba0a851..8966f1f2b68 100644 --- a/code/modules/mob/living/silicon/ai/life.dm +++ b/code/modules/mob/living/silicon/ai/life.dm @@ -150,7 +150,7 @@ to_chat(src, "Receiving control information from APC.") sleep(2) apc_override = 1 - theAPC.ui_interact(src, state = GLOB.conscious_state) + theAPC.ui_interact(src) apc_override = 0 aiRestorePowerRoutine = POWER_RESTORATION_APC_FOUND sleep(50) diff --git a/code/modules/mob/living/silicon/ai/robot_control.dm b/code/modules/mob/living/silicon/ai/robot_control.dm index 0eaea103f2a..bbfb7604ba5 100644 --- a/code/modules/mob/living/silicon/ai/robot_control.dm +++ b/code/modules/mob/living/silicon/ai/robot_control.dm @@ -19,11 +19,13 @@ return ..() return UI_CLOSE -/datum/robot_control/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.always_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/datum/robot_control/ui_state(mob/user) + return GLOB.always_state + +/datum/robot_control/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "RemoteRobotControl", "Remote Robot Control", 500, 500, master_ui, state) + ui = new(user, src, "RemoteRobotControl") ui.open() /datum/robot_control/ui_data(mob/user) diff --git a/code/modules/mob/living/simple_animal/bot/mulebot.dm b/code/modules/mob/living/simple_animal/bot/mulebot.dm index a330366bcdf..d379fd58517 100644 --- a/code/modules/mob/living/simple_animal/bot/mulebot.dm +++ b/code/modules/mob/living/simple_animal/bot/mulebot.dm @@ -31,10 +31,8 @@ model = "MULE" bot_core_type = /obj/machinery/bot_core/mulebot - var/ui_x = 350 ///tgui window width - var/ui_y = 425 ///tgui window height - - var/id /// unique identifier in case there are multiple mulebots. + /// unique identifier in case there are multiple mulebots. + var/id path_image_color = "#7F5200" @@ -228,11 +226,10 @@ return ui_interact(user) -/mob/living/simple_animal/bot/mulebot/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/mob/living/simple_animal/bot/mulebot/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "Mule", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "Mule", name) ui.open() /mob/living/simple_animal/bot/mulebot/ui_data(mob/user) diff --git a/code/modules/modular_computers/computers/item/computer_ui.dm b/code/modules/modular_computers/computers/item/computer_ui.dm index fae9359f8dc..cdd00377b97 100644 --- a/code/modules/modular_computers/computers/item/computer_ui.dm +++ b/code/modules/modular_computers/computers/item/computer_ui.dm @@ -3,7 +3,7 @@ ui_interact(user) // Operates TGUI -/obj/item/modular_computer/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) +/obj/item/modular_computer/ui_interact(mob/user, datum/tgui/ui) if(!enabled) if(ui) ui.close() @@ -33,21 +33,12 @@ to_chat(user, "\The [src] beeps three times, it's screen displaying a \"DISK ERROR\" warning.") return // No HDD, No HDD files list or no stored files. Something is very broken. - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) + ui = SStgui.try_update_ui(user, src, ui) if (!ui) - var/datum/asset/assets = get_asset_datum(/datum/asset/simple/headers) - assets.send(user) - assets = get_asset_datum(/datum/asset/simple/arcade) - assets.send(user) - var/headername - switch(device_theme) - if("ntos") - headername = "NtOS Main Menu" - if("syndicate") - headername = "Syndix Main Menu" - ui = new(user, src, ui_key, "NtosMain", headername, 400, 500, master_ui, state) + ui = new(user, src, "NtosMain") + ui.send_asset(get_asset_datum(/datum/asset/simple/headers)) + ui.set_autoupdate(TRUE) ui.open() - ui.set_autoupdate(state = 1) /obj/item/modular_computer/ui_data(mob/user) diff --git a/code/modules/modular_computers/file_system/program.dm b/code/modules/modular_computers/file_system/program.dm index 2a01282e70d..c76940a18a3 100644 --- a/code/modules/modular_computers/file_system/program.dm +++ b/code/modules/modular_computers/file_system/program.dm @@ -31,15 +31,10 @@ var/available_on_ntnet = 1 /// Whether the program can be downloaded from SyndiNet (accessible via emagging the computer). Set to 1 to enable. var/available_on_syndinet = 0 - /// ID of TGUI interface + /// Name of the tgui interface var/tgui_id - /// Default size of TGUI window, in pixels - var/ui_x = 575 - var/ui_y = 700 /// Example: "something.gif" - a header image that will be rendered in computer's UI when this program is running at background. Images are taken from /icons/program_icons. Be careful not to use too large images! var/ui_header = null - ///Assets specific to programs - var/list/special_assets = list() /datum/computer_file/program/New(obj/item/modular_computer/comp = null) ..() @@ -171,17 +166,11 @@ generate_network_log("Connection to [network_destination] closed.") return 1 - -/datum/computer_file/program/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/datum/computer_file/program/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui && tgui_id) - var/datum/asset/assets = get_asset_datum(/datum/asset/simple/headers) - assets.send(user) - for(var/i in special_assets) - assets = get_asset_datum(i) - assets.send(user) - - ui = new(user, src, ui_key, tgui_id, filedesc, ui_x, ui_y, state = state) + ui = new(user, src, tgui_id, filedesc) + ui.send_asset(get_asset_datum(/datum/asset/simple/headers)) ui.open() // CONVENTIONS, READ THIS WHEN CREATING NEW PROGRAM AND OVERRIDING THIS PROC: diff --git a/code/modules/modular_computers/file_system/programs/airestorer.dm b/code/modules/modular_computers/file_system/programs/airestorer.dm index 1e4d0c951df..c2a1aa4ca75 100644 --- a/code/modules/modular_computers/file_system/programs/airestorer.dm +++ b/code/modules/modular_computers/file_system/programs/airestorer.dm @@ -9,8 +9,6 @@ transfer_access = ACCESS_HEADS available_on_ntnet = TRUE tgui_id = "NtosAiRestorer" - ui_x = 370 - ui_y = 400 /// Variable dictating if we are in the process of restoring the AI in the inserted intellicard var/restoring = FALSE diff --git a/code/modules/modular_computers/file_system/programs/alarm.dm b/code/modules/modular_computers/file_system/programs/alarm.dm index 34daeff6ca9..577fad83d04 100644 --- a/code/modules/modular_computers/file_system/programs/alarm.dm +++ b/code/modules/modular_computers/file_system/programs/alarm.dm @@ -8,9 +8,6 @@ network_destination = "alarm monitoring network" size = 5 tgui_id = "NtosStationAlertConsole" - ui_x = 315 - ui_y = 500 - var/has_alert = 0 var/alarms = list("Fire" = list(), "Atmosphere" = list(), "Power" = list()) diff --git a/code/modules/modular_computers/file_system/programs/antagonist/contract_uplink.dm b/code/modules/modular_computers/file_system/programs/antagonist/contract_uplink.dm index 9c5fb36a871..3accb8e02d7 100644 --- a/code/modules/modular_computers/file_system/programs/antagonist/contract_uplink.dm +++ b/code/modules/modular_computers/file_system/programs/antagonist/contract_uplink.dm @@ -9,8 +9,6 @@ unsendable = 1 undeletable = 1 tgui_id = "SyndContractor" - ui_x = 500 - ui_y = 600 var/error = "" var/info_screen = TRUE var/assigned = FALSE 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 9dedc3810f9..803dadc0a06 100644 --- a/code/modules/modular_computers/file_system/programs/antagonist/dos.dm +++ b/code/modules/modular_computers/file_system/programs/antagonist/dos.dm @@ -8,8 +8,6 @@ available_on_ntnet = FALSE available_on_syndinet = TRUE tgui_id = "NtosNetDos" - ui_x = 400 - ui_y = 250 var/obj/machinery/ntnet_relay/target = null var/dos_speed = 0 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 a3128150087..2ba3d69fe69 100644 --- a/code/modules/modular_computers/file_system/programs/antagonist/revelation.dm +++ b/code/modules/modular_computers/file_system/programs/antagonist/revelation.dm @@ -8,9 +8,6 @@ available_on_ntnet = FALSE available_on_syndinet = TRUE tgui_id = "NtosRevelation" - ui_x = 400 - ui_y = 250 - var/armed = 0 /datum/computer_file/program/revelation/run_program(var/mob/living/user) diff --git a/code/modules/modular_computers/file_system/programs/arcade.dm b/code/modules/modular_computers/file_system/programs/arcade.dm index 06b2375b3b8..dd1d21d6c53 100644 --- a/code/modules/modular_computers/file_system/programs/arcade.dm +++ b/code/modules/modular_computers/file_system/programs/arcade.dm @@ -7,8 +7,6 @@ network_destination = "arcade network" size = 6 tgui_id = "NtosArcade" - ui_x = 450 - ui_y = 350 ///Returns TRUE if the game is being played. var/game_active = TRUE @@ -76,10 +74,10 @@ pause_state = FALSE game_check() -/datum/computer_file/program/arcade/ui_interact(mob/user, ui_key, datum/tgui/ui, force_open, datum/tgui/master_ui, datum/ui_state/state) - . = ..() - var/datum/asset/assets = get_asset_datum(/datum/asset/simple/arcade) - assets.send(user) +/datum/computer_file/program/arcade/ui_assets(mob/user) + return list( + get_asset_datum(/datum/asset/simple/arcade), + ) /datum/computer_file/program/arcade/ui_data(mob/user) var/list/data = get_header_data() diff --git a/code/modules/modular_computers/file_system/programs/atmosscan.dm b/code/modules/modular_computers/file_system/programs/atmosscan.dm index fe3833facd0..5168e0bb79e 100644 --- a/code/modules/modular_computers/file_system/programs/atmosscan.dm +++ b/code/modules/modular_computers/file_system/programs/atmosscan.dm @@ -6,8 +6,6 @@ network_destination = "atmos scan" size = 4 tgui_id = "NtosAtmos" - ui_x = 300 - ui_y = 350 /datum/computer_file/program/atmosscan/ui_data(mob/user) var/list/data = get_header_data() diff --git a/code/modules/modular_computers/file_system/programs/borg_monitor.dm b/code/modules/modular_computers/file_system/programs/borg_monitor.dm index d3e7c3fb896..c2160a0e928 100644 --- a/code/modules/modular_computers/file_system/programs/borg_monitor.dm +++ b/code/modules/modular_computers/file_system/programs/borg_monitor.dm @@ -9,8 +9,6 @@ network_destination = "cyborg remote monitoring" size = 5 tgui_id = "NtosCyborgRemoteMonitor" - ui_x = 600 - ui_y = 800 /datum/computer_file/program/borg_monitor/ui_data(mob/user) var/list/data = get_header_data() diff --git a/code/modules/modular_computers/file_system/programs/bounty_board.dm b/code/modules/modular_computers/file_system/programs/bounty_board.dm index ebe7c48438c..46fde84f657 100644 --- a/code/modules/modular_computers/file_system/programs/bounty_board.dm +++ b/code/modules/modular_computers/file_system/programs/bounty_board.dm @@ -7,8 +7,6 @@ network_destination = "bounty board interface" size = 10 tgui_id = "NtosRequestKiosk" - ui_x = 550 - ui_y = 600 ///Reference to the currently logged in user. var/datum/bank_account/current_user ///The station request datum being affected by UI actions. diff --git a/code/modules/modular_computers/file_system/programs/card.dm b/code/modules/modular_computers/file_system/programs/card.dm index eb7b60b0706..5f1bbbba5cc 100644 --- a/code/modules/modular_computers/file_system/programs/card.dm +++ b/code/modules/modular_computers/file_system/programs/card.dm @@ -15,8 +15,6 @@ requires_ntnet = 0 size = 8 tgui_id = "NtosCard" - ui_x = 450 - ui_y = 520 var/is_centcom = FALSE var/minor = FALSE diff --git a/code/modules/modular_computers/file_system/programs/cargobounty.dm b/code/modules/modular_computers/file_system/programs/cargobounty.dm index e0604e263b6..d9bc65c98de 100644 --- a/code/modules/modular_computers/file_system/programs/cargobounty.dm +++ b/code/modules/modular_computers/file_system/programs/cargobounty.dm @@ -8,8 +8,6 @@ network_destination = "cargo claims interface" size = 10 tgui_id = "NtosBountyConsole" - ui_x = 750 - ui_y = 600 ///cooldown var for printing paper sheets. var/printer_ready = 0 ///The cargo account for grabbing the cargo account's credits. @@ -18,7 +16,7 @@ /datum/computer_file/program/bounty/proc/print_paper() new /obj/item/paper/bounty_printout(get_turf(computer)) -/datum/computer_file/program/bounty/ui_interact(mob/user, ui_key, datum/tgui/ui, force_open, datum/tgui/master_ui, datum/ui_state/state) +/datum/computer_file/program/bounty/ui_interact(mob/user, datum/tgui/ui) if(!GLOB.bounties_list.len) setup_bounties() printer_ready = world.time + PRINTER_TIMEOUT diff --git a/code/modules/modular_computers/file_system/programs/cargoship.dm b/code/modules/modular_computers/file_system/programs/cargoship.dm index c7319e1a2cd..3ba08a37199 100644 --- a/code/modules/modular_computers/file_system/programs/cargoship.dm +++ b/code/modules/modular_computers/file_system/programs/cargoship.dm @@ -6,8 +6,6 @@ network_destination = "ship scanner" size = 6 tgui_id = "NtosShipping" - ui_x = 450 - ui_y = 350 ///Account used for creating barcodes. var/datum/bank_account/payments_acc ///The amount which the tagger will receive for the sale. diff --git a/code/modules/modular_computers/file_system/programs/configurator.dm b/code/modules/modular_computers/file_system/programs/configurator.dm index 76da58ea11f..fae06544d5f 100644 --- a/code/modules/modular_computers/file_system/programs/configurator.dm +++ b/code/modules/modular_computers/file_system/programs/configurator.dm @@ -10,8 +10,6 @@ unsendable = 1 undeletable = 1 size = 4 - ui_x = 420 - ui_y = 630 available_on_ntnet = 0 requires_ntnet = 0 tgui_id = "NtosConfiguration" diff --git a/code/modules/modular_computers/file_system/programs/crewmanifest.dm b/code/modules/modular_computers/file_system/programs/crewmanifest.dm index 662c867a39a..c880de503bd 100644 --- a/code/modules/modular_computers/file_system/programs/crewmanifest.dm +++ b/code/modules/modular_computers/file_system/programs/crewmanifest.dm @@ -7,8 +7,6 @@ requires_ntnet = FALSE size = 4 tgui_id = "NtosCrewManifest" - ui_x = 400 - ui_y = 480 /datum/computer_file/program/crew_manifest/ui_static_data(mob/user) var/list/data = list() diff --git a/code/modules/modular_computers/file_system/programs/jobmanagement.dm b/code/modules/modular_computers/file_system/programs/jobmanagement.dm index 7b847c123e7..bccc6e4dbe2 100644 --- a/code/modules/modular_computers/file_system/programs/jobmanagement.dm +++ b/code/modules/modular_computers/file_system/programs/jobmanagement.dm @@ -7,8 +7,6 @@ requires_ntnet = 0 size = 4 tgui_id = "NtosJobManager" - ui_x = 400 - ui_y = 620 var/change_position_cooldown = 30 //Jobs you cannot open new positions for diff --git a/code/modules/modular_computers/file_system/programs/ntdownloader.dm b/code/modules/modular_computers/file_system/programs/ntdownloader.dm index 675ad579943..6401d6207f0 100644 --- a/code/modules/modular_computers/file_system/programs/ntdownloader.dm +++ b/code/modules/modular_computers/file_system/programs/ntdownloader.dm @@ -11,8 +11,6 @@ available_on_ntnet = 0 ui_header = "downloader_finished.gif" tgui_id = "NtosNetDownloader" - ui_x = 480 - ui_y = 735 var/datum/computer_file/program/downloaded_file = null var/hacked_download = 0 diff --git a/code/modules/modular_computers/file_system/programs/ntnrc_client.dm b/code/modules/modular_computers/file_system/programs/ntnrc_client.dm index 4ae5bd326b8..df9b02d8ec7 100644 --- a/code/modules/modular_computers/file_system/programs/ntnrc_client.dm +++ b/code/modules/modular_computers/file_system/programs/ntnrc_client.dm @@ -10,9 +10,6 @@ ui_header = "ntnrc_idle.gif" available_on_ntnet = 1 tgui_id = "NtosNetChat" - ui_x = 900 - ui_y = 675 - var/last_message // Used to generate the toolbar icon var/username var/active_channel diff --git a/code/modules/modular_computers/file_system/programs/powermonitor.dm b/code/modules/modular_computers/file_system/programs/powermonitor.dm index d2d57b14470..bd11474858b 100644 --- a/code/modules/modular_computers/file_system/programs/powermonitor.dm +++ b/code/modules/modular_computers/file_system/programs/powermonitor.dm @@ -12,8 +12,6 @@ network_destination = "power monitoring system" size = 9 tgui_id = "NtosPowerMonitor" - ui_x = 550 - ui_y = 700 var/has_alert = 0 var/obj/structure/cable/attached_wire diff --git a/code/modules/modular_computers/file_system/programs/radar.dm b/code/modules/modular_computers/file_system/programs/radar.dm index 20cf394715e..9b0e09ef999 100644 --- a/code/modules/modular_computers/file_system/programs/radar.dm +++ b/code/modules/modular_computers/file_system/programs/radar.dm @@ -10,11 +10,6 @@ network_destination = "tracking program" size = 5 tgui_id = "NtosRadar" - ui_x = 800 - ui_y = 600 - special_assets = list( - /datum/asset/simple/radar_assets, - ) ///List of trackable entities. Updated by the scan() proc. var/list/objects ///Ref of the last trackable object selected by the user in the tgui window. Updated in the ui_act() proc. @@ -45,6 +40,11 @@ STOP_PROCESSING(SSfastprocess, src) return ..() +/datum/computer_file/program/radar/ui_assets(mob/user) + return list( + get_asset_datum(/datum/asset/simple/radar_assets), + ) + /datum/computer_file/program/radar/ui_data(mob/user) var/list/data = get_header_data() data["selected"] = selected diff --git a/code/modules/modular_computers/file_system/programs/robocontrol.dm b/code/modules/modular_computers/file_system/programs/robocontrol.dm index 910f9233277..8644ce09b43 100644 --- a/code/modules/modular_computers/file_system/programs/robocontrol.dm +++ b/code/modules/modular_computers/file_system/programs/robocontrol.dm @@ -9,8 +9,6 @@ network_destination = "robotics control network" size = 12 tgui_id = "NtosRoboControl" - ui_x = 550 - ui_y = 550 ///Number of simple robots on-station. var/botcount = 0 ///Used to find the location of the user for the purposes of summoning robots. diff --git a/code/modules/modular_computers/file_system/programs/sm_monitor.dm b/code/modules/modular_computers/file_system/programs/sm_monitor.dm index d78ed9239e3..8b6db67d746 100644 --- a/code/modules/modular_computers/file_system/programs/sm_monitor.dm +++ b/code/modules/modular_computers/file_system/programs/sm_monitor.dm @@ -9,8 +9,6 @@ network_destination = "supermatter monitoring system" size = 5 tgui_id = "NtosSupermatterMonitor" - ui_x = 600 - ui_y = 350 var/last_status = SUPERMATTER_INACTIVE var/list/supermatters var/obj/machinery/power/supermatter_crystal/active // Currently selected supermatter crystal. diff --git a/code/modules/modular_computers/laptop_vendor.dm b/code/modules/modular_computers/laptop_vendor.dm index ab13cc0fbd9..6608630fb77 100644 --- a/code/modules/modular_computers/laptop_vendor.dm +++ b/code/modules/modular_computers/laptop_vendor.dm @@ -27,9 +27,6 @@ var/dev_printer = 0 // 0: None, 1: Standard var/dev_card = 0 // 0: None, 1: Standard - ui_x = 500 - ui_y = 400 - // Removes all traces of old order and allows you to begin configuration from scratch. /obj/machinery/lapvend/proc/reset_order() state = 0 @@ -224,15 +221,15 @@ return TRUE return FALSE -/obj/machinery/lapvend/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) +/obj/machinery/lapvend/ui_interact(mob/user, datum/tgui/ui) if(machine_stat & (BROKEN | NOPOWER | MAINT)) if(ui) ui.close() return FALSE - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) + ui = SStgui.try_update_ui(user, src, ui) if (!ui) - ui = new(user, src, ui_key, "ComputerFabricator", "Personal Computer Vendor", ui_x, ui_y, state = state) + ui = new(user, src, "ComputerFabricator") ui.open() /obj/machinery/lapvend/attackby(obj/item/I, mob/user) diff --git a/code/modules/paperwork/paper.dm b/code/modules/paperwork/paper.dm index d53e9aab03a..ac3a4d8ff4f 100644 --- a/code/modules/paperwork/paper.dm +++ b/code/modules/paperwork/paper.dm @@ -1,4 +1,4 @@ -/* +/** * Paper * also scraps of paper * @@ -11,12 +11,11 @@ #define MODE_WRITING 1 #define MODE_STAMPING 2 - /** - ** This is a custom ui state. All it really does is keep track of pen - ** being used and if they are editing it or not. This way we can keep - ** the data with the ui rather than on the paper - **/ + * This is a custom ui state. All it really does is keep track of pen + * being used and if they are editing it or not. This way we can keep + * the data with the ui rather than on the paper + */ /datum/ui_state/default/paper_state /// What edit mode we are in and who is /// writing on it right now @@ -33,7 +32,6 @@ var/stamp_name = "" var/stamp_class = "" - /datum/ui_state/default/paper_state/proc/copy_from(datum/ui_state/default/paper_state/from) switch(from.edit_mode) if(MODE_READING) @@ -49,12 +47,11 @@ stamp_class = from.stamp_class stamp_name = from.stamp_name - /** - ** Paper is now using markdown (like in github pull notes) for ALL rendering - ** so we do loose a bit of functionality but we gain in easy of use of - ** paper and getting rid of that crashing bug - **/ + * Paper is now using markdown (like in github pull notes) for ALL rendering + * so we do loose a bit of functionality but we gain in easy of use of + * paper and getting rid of that crashing bug + */ /obj/item/paper name = "paper" gender = NEUTER @@ -92,9 +89,6 @@ var/contact_poison // Reagent ID to transfer on contact var/contact_poison_volume = 0 - // ui stuff - var/ui_x = 600 - var/ui_y = 800 // Ok, so WHY are we caching the ui's? // Since we are not using autoupdate we // need some way to update the ui's of @@ -106,7 +100,6 @@ // people look at it var/list/viewing_ui = list() - /// When the sheet can be "filled out" /// This is an associated list var/list/form_fields = list() @@ -119,10 +112,10 @@ . = ..() /** - ** This proc copies this sheet of paper to a new - ** sheet, Makes it nice and easy for carbon and - ** the copyer machine - **/ + * This proc copies this sheet of paper to a new + * sheet, Makes it nice and easy for carbon and + * the copyer machine + */ /obj/item/paper/proc/copy() var/obj/item/paper/N = new(arglist(args)) N.info = info @@ -136,10 +129,10 @@ return N /** - ** This proc sets the text of the paper and updates the - ** icons. You can modify the pen_color after if need - ** be. - **/ + * This proc sets the text of the paper and updates the + * icons. You can modify the pen_color after if need + * be. + */ /obj/item/paper/proc/setText(text) info = text form_fields = null @@ -155,24 +148,16 @@ contact_poison = null . = ..() - /obj/item/paper/Initialize() . = ..() pixel_y = rand(-8, 8) pixel_x = rand(-9, 9) update_icon() - /obj/item/paper/update_icon_state() if(info && show_written_words) icon_state = "[initial(icon_state)]_words" -/obj/item/paper/ui_base_html(html) - /// This might change in a future PR - var/datum/asset/spritesheet/assets = get_asset_datum(/datum/asset/spritesheet/simple/paper) - . = replacetext(html, "", assets.css_tag()) - - /obj/item/paper/verb/rename() set name = "Rename paper" set category = "Object" @@ -192,17 +177,14 @@ name = "paper[(n_name ? text("- '[n_name]'") : null)]" add_fingerprint(usr) - /obj/item/paper/suicide_act(mob/user) user.visible_message("[user] scratches a grid on [user.p_their()] wrist with the paper! It looks like [user.p_theyre()] trying to commit sudoku...") return (BRUTELOSS) - /// ONLY USED FOR APRIL FOOLS /obj/item/paper/proc/reset_spamflag() spam_flag = FALSE - /obj/item/paper/attack_self(mob/user) if(rigged && (SSevents.holidays && SSevents.holidays[APRIL_FOOLS])) if(!spam_flag) @@ -211,7 +193,6 @@ addtimer(CALLBACK(src, .proc/reset_spamflag), 20) . = ..() - /obj/item/paper/proc/clearpaper() info = "" stamps = null @@ -219,30 +200,28 @@ cut_overlays() update_icon_state() - /obj/item/paper/examine_more(mob/user) ui_interact(user) return list("You try to read [src]...") - /obj/item/paper/can_interact(mob/user) if(!..()) return FALSE - if(resistance_flags & ON_FIRE) // Are we on fire? Hard ot read if so + // Are we on fire? Hard ot read if so + if(resistance_flags & ON_FIRE) return FALSE - if(user.is_blind()) // Even harder to read if your blind...braile? humm + // Even harder to read if your blind...braile? humm + if(user.is_blind()) return FALSE - return user.can_read(src) // checks if the user can read. - + // checks if the user can read. + return user.can_read(src) /** - ** This creates the ui, since we are using a custom state but not much else - ** just makes it easyer to make it. Also we make a custom ui_key as I am - ** not sure how tgui handles many producers? -**/ + * This creates the ui, since we are using a custom state but not much else + * just makes it easyer to make it. + */ /obj/item/paper/proc/create_ui(mob/user, datum/ui_state/default/paper_state/state) - ui_interact(user, "main", null, FALSE, null, state) - + ui_interact(user, state = state) /obj/item/proc/burn_paper_product_attackby_check(obj/item/I, mob/living/user, bypass_clumsy) var/ignition_message = I.ignition_effect(src, user) @@ -317,24 +296,27 @@ if(.) info = "[stars(info)]" -/obj/item/paper/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/default/paper_state/state = new) - ui_key = "main-[REF(user)]" - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/item/paper/ui_assets(mob/user) + return list( + get_asset_datum(/datum/asset/spritesheet/simple/paper), + ) + +/obj/item/paper/ui_interact(mob/user, datum/tgui/ui, + datum/ui_state/default/paper_state/state) + // Update the state + ui = ui || SStgui.get_open_ui(user, src) + if(ui && state) + var/datum/ui_state/default/paper_state/current_state = ui.state + current_state.copy_from(state) + // Update the UI + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - var/datum/asset/assets = get_asset_datum(/datum/asset/spritesheet/simple/paper) - assets.send(user) - // The x size is because we double the width for the editor - ui = new(user, src, ui_key, "PaperSheet", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "PaperSheet", name) + state = new + ui.set_state(state) ui.set_autoupdate(FALSE) viewing_ui[user] = ui ui.open() - else - var/datum/ui_state/default/paper_state/last_state = ui.state - if(last_state) - last_state.copy_from(state) - else - ui.state = state - /obj/item/paper/ui_close(mob/user) /// close the editing window and change the mode @@ -344,7 +326,7 @@ // Again, we have to do this as autoupdate is off /obj/item/paper/proc/update_all_ui() for(var/datum/tgui/ui in viewing_ui) - ui.update() + ui.process(force = TRUE) // Again, we have to do this as autoupdate is off /obj/item/paper/proc/close_all_ui() @@ -380,7 +362,6 @@ return data - /obj/item/paper/ui_act(action, params, datum/tgui/ui, datum/ui_state/default/paper_state/state) if(..()) return @@ -442,21 +423,18 @@ . = TRUE - -/* +/** * Construction paper */ - /obj/item/paper/construction /obj/item/paper/construction/Initialize() . = ..() color = pick("FF0000", "#33cc33", "#ffb366", "#551A8B", "#ff80d5", "#4d94ff") -/* +/** * Natural paper */ - /obj/item/paper/natural/Initialize() . = ..() color = "#FFF5ED" diff --git a/code/modules/plumbing/plumbers/acclimator.dm b/code/modules/plumbing/plumbers/acclimator.dm index e16d891f268..bd87ab009f7 100644 --- a/code/modules/plumbing/plumbers/acclimator.dm +++ b/code/modules/plumbing/plumbers/acclimator.dm @@ -26,9 +26,6 @@ */ var/emptying = FALSE - ui_x = 320 - ui_y = 271 - /obj/machinery/plumbing/acclimator/Initialize(mapload, bolt) . = ..() AddComponent(/datum/component/plumbing/acclimator, bolt) @@ -65,10 +62,10 @@ if(HEATING) icon_state += "_hot" -/obj/machinery/plumbing/acclimator/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/plumbing/acclimator/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "ChemAcclimator", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "ChemAcclimator", name) ui.open() /obj/machinery/plumbing/acclimator/ui_data(mob/user) diff --git a/code/modules/plumbing/plumbers/filter.dm b/code/modules/plumbing/plumbers/filter.dm index afae76e5c5d..bb94d0e769a 100644 --- a/code/modules/plumbing/plumbers/filter.dm +++ b/code/modules/plumbing/plumbers/filter.dm @@ -13,17 +13,14 @@ ///whitelist of chems but their name instead of path var/list/english_right = list() - ui_x = 500 - ui_y = 300 - /obj/machinery/plumbing/filter/Initialize(mapload, bolt) . = ..() AddComponent(/datum/component/plumbing/filter, bolt) -/obj/machinery/plumbing/filter/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/plumbing/filter/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "ChemFilter", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "ChemFilter", name) ui.open() /obj/machinery/plumbing/filter/ui_data(mob/user) diff --git a/code/modules/plumbing/plumbers/pill_press.dm b/code/modules/plumbing/plumbers/pill_press.dm index f950d03c879..9fad7115787 100644 --- a/code/modules/plumbing/plumbers/pill_press.dm +++ b/code/modules/plumbing/plumbers/pill_press.dm @@ -28,9 +28,6 @@ ///max amount of pills allowed on our tile before we start storing them instead var/max_floor_products = 10 - ui_x = 300 - ui_y = 227 - /obj/machinery/plumbing/pill_press/examine(mob/user) . = ..() . += "The [name] currently has [stored_products.len] stored. There needs to be less than [max_floor_products] on the floor to continue dispensing." @@ -85,16 +82,15 @@ AM.forceMove(drop_location()) -/obj/machinery/plumbing/pill_press/ui_base_html(html) - var/datum/asset/spritesheet/simple/assets = get_asset_datum(/datum/asset/spritesheet/simple/pills) - . = replacetext(html, "", assets.css_tag()) +/obj/machinery/plumbing/pill_press/ui_assets(mob/user) + return list( + get_asset_datum(/datum/asset/spritesheet/simple/pills), + ) -/obj/machinery/plumbing/pill_press/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/plumbing/pill_press/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - var/datum/asset/assets = get_asset_datum(/datum/asset/spritesheet/simple/pills) - assets.send(user) - ui = new(user, src, ui_key, "ChemPress", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "ChemPress", name) ui.open() /obj/machinery/plumbing/pill_press/ui_data(mob/user) diff --git a/code/modules/plumbing/plumbers/reaction_chamber.dm b/code/modules/plumbing/plumbers/reaction_chamber.dm index 0ff34ed55e8..4fc1c18da4f 100644 --- a/code/modules/plumbing/plumbers/reaction_chamber.dm +++ b/code/modules/plumbing/plumbers/reaction_chamber.dm @@ -3,11 +3,8 @@ name = "reaction chamber" desc = "Keeps chemicals seperated until given conditions are met." icon_state = "reaction_chamber" - buffer = 200 reagent_flags = TRANSPARENT | NO_REACT - ui_x = 250 - ui_y = 225 /**list of set reagents that the reaction_chamber allows in, and must all be present before mixing is enabled. * example: list(/datum/reagent/water = 20, /datum/reagent/fuel/oil = 50) */ @@ -31,10 +28,10 @@ else icon_state = initial(icon_state) -/obj/machinery/plumbing/reaction_chamber/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/plumbing/reaction_chamber/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "ChemReactionChamber", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "ChemReactionChamber", name) ui.open() /obj/machinery/plumbing/reaction_chamber/ui_data(mob/user) diff --git a/code/modules/plumbing/plumbers/splitters.dm b/code/modules/plumbing/plumbers/splitters.dm index fe8fbd5ebb3..266cb3bf2db 100644 --- a/code/modules/plumbing/plumbers/splitters.dm +++ b/code/modules/plumbing/plumbers/splitters.dm @@ -15,17 +15,14 @@ //the maximum you can set the transfer to var/max_transfer = 9 - ui_x = 220 - ui_y = 105 - /obj/machinery/plumbing/splitter/Initialize(mapload, bolt) . = ..() AddComponent(/datum/component/plumbing/splitter, bolt) -/obj/machinery/plumbing/splitter/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/plumbing/splitter/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "ChemSplitter", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "ChemSplitter", name) ui.open() /obj/machinery/plumbing/splitter/ui_data(mob/user) diff --git a/code/modules/plumbing/plumbers/synthesizer.dm b/code/modules/plumbing/plumbers/synthesizer.dm index 24b5df99ec3..2d782e9d3e6 100644 --- a/code/modules/plumbing/plumbers/synthesizer.dm +++ b/code/modules/plumbing/plumbers/synthesizer.dm @@ -43,12 +43,9 @@ /datum/reagent/sulfur, /datum/reagent/toxin/acid, /datum/reagent/water, - /datum/reagent/fuel + /datum/reagent/fuel, ) - ui_x = 300 - ui_y = 375 - /obj/machinery/plumbing/synthesizer/Initialize(mapload, bolt) . = ..() AddComponent(/datum/component/plumbing/simple_supply, bolt) @@ -60,10 +57,10 @@ return reagents.add_reagent(reagent_id, amount) -/obj/machinery/plumbing/synthesizer/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/plumbing/synthesizer/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "ChemSynthesizer", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "ChemSynthesizer", name) ui.open() /obj/machinery/plumbing/synthesizer/ui_data(mob/user) diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index 247ce4ef186..6da99752a4d 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -57,8 +57,6 @@ damage_deflection = 10 resistance_flags = FIRE_PROOF interaction_flags_machine = INTERACT_MACHINE_WIRES_IF_OPEN | INTERACT_MACHINE_ALLOW_SILICON | INTERACT_MACHINE_OPEN_SILICON - ui_x = 450 - ui_y = 460 var/lon_range = 1.5 var/area/area @@ -849,12 +847,10 @@ if((machine_stat & MAINT) && !opened) //no board; no interface return -/obj/machinery/power/apc/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) - +/obj/machinery/power/apc/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "Apc", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "Apc", name) ui.open() /obj/machinery/power/apc/ui_data(mob/user) diff --git a/code/modules/power/gravitygenerator.dm b/code/modules/power/gravitygenerator.dm index a3ce0fa42f9..002bcfc9fd9 100644 --- a/code/modules/power/gravitygenerator.dm +++ b/code/modules/power/gravitygenerator.dm @@ -116,8 +116,6 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne sprite_number = 8 use_power = IDLE_POWER_USE interaction_flags_machine = INTERACT_MACHINE_ALLOW_SILICON | INTERACT_MACHINE_OFFLINE - ui_x = 400 - ui_y = 165 var/on = TRUE var/breaker = TRUE var/list/parts = list() @@ -222,11 +220,10 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne return return ..() -/obj/machinery/gravity_generator/main/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/gravity_generator/main/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "GravityGenerator", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "GravityGenerator", name) ui.open() /obj/machinery/gravity_generator/main/ui_data(mob/user) diff --git a/code/modules/power/monitor.dm b/code/modules/power/monitor.dm index 974fb1b9e2e..393d403c4df 100644 --- a/code/modules/power/monitor.dm +++ b/code/modules/power/monitor.dm @@ -11,8 +11,6 @@ active_power_usage = 100 circuit = /obj/item/circuitboard/computer/powermonitor tgui_id = "PowerMonitor" - ui_x = 550 - ui_y = 700 var/obj/structure/cable/attached_wire var/obj/machinery/power/apc/local_apc @@ -84,11 +82,10 @@ if(demand.len > record_size) demand.Cut(1, 2) -/obj/machinery/computer/monitor/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/computer/monitor/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "PowerMonitor", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "PowerMonitor", name) ui.open() /obj/machinery/computer/monitor/ui_data() diff --git a/code/modules/power/port_gen.dm b/code/modules/power/port_gen.dm index e2ec3378c27..47ca16f3a2a 100644 --- a/code/modules/power/port_gen.dm +++ b/code/modules/power/port_gen.dm @@ -7,8 +7,6 @@ density = TRUE anchored = FALSE use_power = NO_POWER_USE - ui_x = 450 - ui_y = 340 var/active = FALSE var/power_gen = 5000 @@ -222,11 +220,10 @@ /obj/machinery/power/port_gen/pacman/attack_paw(mob/user) interact(user) -/obj/machinery/power/port_gen/pacman/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/power/port_gen/pacman/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "PortableGenerator", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "PortableGenerator", name) ui.open() /obj/machinery/power/port_gen/pacman/ui_data() diff --git a/code/modules/power/singularity/particle_accelerator/particle_control.dm b/code/modules/power/singularity/particle_accelerator/particle_control.dm index 5e6e94ee057..f26edda43fc 100644 --- a/code/modules/power/singularity/particle_accelerator/particle_control.dm +++ b/code/modules/power/singularity/particle_accelerator/particle_control.dm @@ -10,8 +10,6 @@ active_power_usage = 10000 dir = NORTH mouse_opacity = MOUSE_OPACITY_OPAQUE - ui_x = 350 - ui_y = 185 var/strength_upper_limit = 2 var/interface_control = TRUE var/list/obj/structure/particle_accelerator/connected_parts @@ -277,11 +275,10 @@ return ..() return UI_CLOSE -/obj/machinery/particle_accelerator/control_box/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/particle_accelerator/control_box/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "ParticleAccelerator", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "ParticleAccelerator", name) ui.open() /obj/machinery/particle_accelerator/control_box/ui_data(mob/user) diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm index af63f7ceb75..a2fd977d4f5 100644 --- a/code/modules/power/smes.dm +++ b/code/modules/power/smes.dm @@ -21,8 +21,6 @@ density = TRUE use_power = NO_POWER_USE circuit = /obj/item/circuitboard/machine/smes - ui_x = 340 - ui_y = 350 var/capacity = 5e6 // maximum charge var/charge = 0 // actual charge @@ -323,11 +321,10 @@ return -/obj/machinery/power/smes/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/power/smes/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "Smes", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "Smes", name) ui.open() /obj/machinery/power/smes/ui_data() diff --git a/code/modules/power/solar.dm b/code/modules/power/solar.dm index e030bb0bdd3..c8bdb7831f6 100644 --- a/code/modules/power/solar.dm +++ b/code/modules/power/solar.dm @@ -348,11 +348,10 @@ else . += mutable_appearance(icon, icon_screen) -/obj/machinery/power/solar_control/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/power/solar_control/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "SolarControl", name, 380, 230, master_ui, state) + ui = new(user, src, "SolarControl", name) ui.open() /obj/machinery/power/solar_control/ui_data() diff --git a/code/modules/power/turbine.dm b/code/modules/power/turbine.dm index 6321ed75a44..8924e1dd70c 100644 --- a/code/modules/power/turbine.dm +++ b/code/modules/power/turbine.dm @@ -56,8 +56,6 @@ resistance_flags = FIRE_PROOF CanAtmosPass = ATMOS_PASS_DENSITY circuit = /obj/item/circuitboard/machine/power_turbine - ui_x = 310 - ui_y = 150 var/opened = 0 var/obj/machinery/power/compressor/compressor var/turf/outturf @@ -249,11 +247,10 @@ default_deconstruction_crowbar(I) -/obj/machinery/power/turbine/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/power/turbine/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "TurbineComputer", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "TurbineComputer", name) ui.open() /obj/machinery/power/turbine/ui_data(mob/user) @@ -292,8 +289,6 @@ icon_screen = "turbinecomp" icon_keyboard = "tech_key" circuit = /obj/item/circuitboard/computer/turbine_computer - ui_x = 310 - ui_y = 150 var/obj/machinery/power/compressor/compressor var/id = 0 @@ -313,11 +308,10 @@ else compressor = locate(/obj/machinery/power/compressor) in range(7, src) -/obj/machinery/computer/turbine_computer/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/computer/turbine_computer/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "TurbineComputer", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "TurbineComputer", name) ui.open() /obj/machinery/computer/turbine_computer/ui_data(mob/user) diff --git a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm index bc6cd2ed4c3..86234b27ca3 100644 --- a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm +++ b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm @@ -22,8 +22,6 @@ interaction_flags_machine = INTERACT_MACHINE_OPEN | INTERACT_MACHINE_ALLOW_SILICON | INTERACT_MACHINE_OFFLINE resistance_flags = FIRE_PROOF | ACID_PROOF circuit = /obj/item/circuitboard/machine/chem_dispenser - ui_x = 565 - ui_y = 620 var/obj/item/stock_parts/cell/cell var/powerefficiency = 0.1 @@ -171,11 +169,10 @@ beaker = null cut_overlays() -/obj/machinery/chem_dispenser/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/chem_dispenser/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "ChemDispenser", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "ChemDispenser", name) if(user.hallucinating()) ui.set_autoupdate(FALSE) //to not ruin the immersion by constantly changing the fake chemicals ui.open() diff --git a/code/modules/reagents/chemistry/machinery/chem_heater.dm b/code/modules/reagents/chemistry/machinery/chem_heater.dm index 362fe121fac..c34b78f894e 100644 --- a/code/modules/reagents/chemistry/machinery/chem_heater.dm +++ b/code/modules/reagents/chemistry/machinery/chem_heater.dm @@ -7,8 +7,6 @@ idle_power_usage = 40 resistance_flags = FIRE_PROOF | ACID_PROOF circuit = /obj/item/circuitboard/machine/chem_heater - ui_x = 275 - ui_y = 320 var/obj/item/reagent_containers/beaker = null var/target_temperature = 300 @@ -91,11 +89,10 @@ replace_beaker() return ..() -/obj/machinery/chem_heater/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/chem_heater/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "ChemHeater", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "ChemHeater", name) ui.open() /obj/machinery/chem_heater/ui_data() diff --git a/code/modules/reagents/chemistry/machinery/chem_master.dm b/code/modules/reagents/chemistry/machinery/chem_master.dm index 24930231063..6c0e63e0f7c 100644 --- a/code/modules/reagents/chemistry/machinery/chem_master.dm +++ b/code/modules/reagents/chemistry/machinery/chem_master.dm @@ -9,8 +9,6 @@ idle_power_usage = 20 resistance_flags = FIRE_PROOF | ACID_PROOF circuit = /obj/item/circuitboard/machine/chem_master - ui_x = 465 - ui_y = 550 var/obj/item/reagent_containers/beaker = null var/obj/item/storage/pill_bottle/bottle = null @@ -152,21 +150,17 @@ bottle = null return ..() -/obj/machinery/chem_master/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/chem_master/ui_assets(mob/user) + return list( + get_asset_datum(/datum/asset/spritesheet/simple/pills), + ) + +/obj/machinery/chem_master/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - var/datum/asset/assets = get_asset_datum(/datum/asset/spritesheet/simple/pills) - assets.send(user) - - ui = new(user, src, ui_key, "ChemMaster", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "ChemMaster", name) ui.open() -//Insert our custom spritesheet css link into the html -/obj/machinery/chem_master/ui_base_html(html) - var/datum/asset/spritesheet/simple/assets = get_asset_datum(/datum/asset/spritesheet/simple/pills) - . = replacetext(html, "", assets.css_tag()) - /obj/machinery/chem_master/ui_data(mob/user) var/list/data = list() data["isBeakerLoaded"] = beaker ? 1 : 0 diff --git a/code/modules/reagents/chemistry/machinery/chem_synthesizer.dm b/code/modules/reagents/chemistry/machinery/chem_synthesizer.dm index 6ecc6788575..7dfd60ecaa2 100644 --- a/code/modules/reagents/chemistry/machinery/chem_synthesizer.dm +++ b/code/modules/reagents/chemistry/machinery/chem_synthesizer.dm @@ -7,18 +7,14 @@ resistance_flags = INDESTRUCTIBLE | FIRE_PROOF | ACID_PROOF | LAVA_PROOF flags_1 = NODECONSTRUCT_1 use_power = NO_POWER_USE - ui_x = 390 - ui_y = 330 - var/static/list/shortcuts = list( "meth" = /datum/reagent/drug/methamphetamine ) -/obj/machinery/chem_dispenser/chem_synthesizer/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/chem_dispenser/chem_synthesizer/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "ChemDebugSynthesizer", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "ChemDebugSynthesizer", name) ui.open() /obj/machinery/chem_dispenser/chem_synthesizer/ui_act(action, params) diff --git a/code/modules/reagents/chemistry/machinery/pandemic.dm b/code/modules/reagents/chemistry/machinery/pandemic.dm index bed1f93060d..df56eaa79ec 100644 --- a/code/modules/reagents/chemistry/machinery/pandemic.dm +++ b/code/modules/reagents/chemistry/machinery/pandemic.dm @@ -11,8 +11,6 @@ idle_power_usage = 20 resistance_flags = ACID_PROOF circuit = /obj/item/circuitboard/computer/pandemic - ui_x = 520 - ui_y = 550 var/wait var/datum/symptom/selected_symptom @@ -145,10 +143,10 @@ beaker = null update_icon() -/obj/machinery/computer/pandemic/ui_interact(mob/user, ui_key = "main", datum/tgui/ui, force_open = FALSE, datum/tgui/master_ui, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/computer/pandemic/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "Pandemic", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "Pandemic", name) ui.open() /obj/machinery/computer/pandemic/ui_data(mob/user) diff --git a/code/modules/reagents/chemistry/machinery/smoke_machine.dm b/code/modules/reagents/chemistry/machinery/smoke_machine.dm index d5dd6b4f0a3..41b8c94ffd6 100644 --- a/code/modules/reagents/chemistry/machinery/smoke_machine.dm +++ b/code/modules/reagents/chemistry/machinery/smoke_machine.dm @@ -7,8 +7,6 @@ icon_state = "smoke0" density = TRUE circuit = /obj/item/circuitboard/machine/smoke_machine - ui_x = 350 - ui_y = 350 var/efficiency = 10 var/on = FALSE @@ -103,11 +101,10 @@ reagents.clear_reagents() return ..() -/obj/machinery/smoke_machine/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/smoke_machine/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "SmokeMachine", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "SmokeMachine", name) ui.open() /obj/machinery/smoke_machine/ui_data(mob/user) diff --git a/code/modules/recycling/disposal/bin.dm b/code/modules/recycling/disposal/bin.dm index 485c81e69ea..f8eb5607209 100644 --- a/code/modules/recycling/disposal/bin.dm +++ b/code/modules/recycling/disposal/bin.dm @@ -11,8 +11,6 @@ interaction_flags_machine = INTERACT_MACHINE_OPEN | INTERACT_MACHINE_WIRES_IF_OPEN | INTERACT_MACHINE_ALLOW_SILICON | INTERACT_MACHINE_OPEN_SILICON obj_flags = CAN_BE_HIT | USES_TGUI flags_1 = RAD_PROTECT_CONTENTS_1 | RAD_NO_CONTAMINATE_1 - ui_x = 300 - ui_y = 180 var/datum/gas_mixture/air_contents // internal reservoir var/full_pressure = FALSE @@ -279,13 +277,15 @@ // handle machine interaction -/obj/machinery/disposal/bin/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.notcontained_state) +/obj/machinery/disposal/bin/ui_state(mob/user) + return GLOB.notcontained_state + +/obj/machinery/disposal/bin/ui_interact(mob/user, datum/tgui/ui) if(machine_stat & BROKEN) return - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "DisposalUnit", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "DisposalUnit", name) ui.open() /obj/machinery/disposal/bin/ui_data(mob/user) diff --git a/code/modules/research/bepis.dm b/code/modules/research/bepis.dm index e49b8ced80a..69cc42b1a54 100644 --- a/code/modules/research/bepis.dm +++ b/code/modules/research/bepis.dm @@ -33,10 +33,13 @@ var/inaccuracy_percentage = 1.5 var/positive_cash_offset = 0 var/negative_cash_offset = 0 - var/minor_rewards = list(/obj/item/stack/circuit_stack/full, //To add a new minor reward, add it here. - /obj/item/pen/survival, - /obj/item/circuitboard/machine/sleeper/party, - /obj/item/toy/sprayoncan) + var/minor_rewards = list( + //To add a new minor reward, add it here. + /obj/item/stack/circuit_stack/full, + /obj/item/pen/survival, + /obj/item/circuitboard/machine/sleeper/party, + /obj/item/toy/sprayoncan, + ) var/static/list/item_list = list() /obj/machinery/rnd/bepis/attackby(obj/item/O, mob/user, params) @@ -179,10 +182,10 @@ icon_state = "chamber" return -/obj/machinery/rnd/bepis/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/rnd/bepis/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "Bepis", name, 500, 480, master_ui, state) + ui = new(user, src, "Bepis", name) ui.open() RefreshParts() diff --git a/code/modules/research/nanites/nanite_chamber_computer.dm b/code/modules/research/nanites/nanite_chamber_computer.dm index b9623b751dd..70e4d055907 100644 --- a/code/modules/research/nanites/nanite_chamber_computer.dm +++ b/code/modules/research/nanites/nanite_chamber_computer.dm @@ -5,8 +5,6 @@ var/obj/item/disk/nanite_program/disk icon_screen = "nanite_chamber_control" circuit = /obj/item/circuitboard/computer/nanite_chamber_control - ui_x = 380 - ui_y = 570 /obj/machinery/computer/nanite_chamber_control/Initialize() . = ..() @@ -25,10 +23,10 @@ find_chamber() ..() -/obj/machinery/computer/nanite_chamber_control/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/computer/nanite_chamber_control/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "NaniteChamberControl", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "NaniteChamberControl", name) ui.open() /obj/machinery/computer/nanite_chamber_control/ui_data() diff --git a/code/modules/research/nanites/nanite_cloud_controller.dm b/code/modules/research/nanites/nanite_cloud_controller.dm index 3ba7834f694..27384c66ace 100644 --- a/code/modules/research/nanites/nanite_cloud_controller.dm +++ b/code/modules/research/nanites/nanite_cloud_controller.dm @@ -4,8 +4,6 @@ icon = 'icons/obj/machines/research.dmi' icon_state = "nanite_cloud_controller" circuit = /obj/item/circuitboard/computer/nanite_cloud_controller - ui_x = 375 - ui_y = 700 var/obj/item/disk/nanite_program/disk var/list/datum/nanite_cloud_backup/cloud_backups = list() @@ -59,10 +57,10 @@ backup.nanites = cloud_copy investigate_log("[key_name(user)] created a new nanite cloud backup with id #[cloud_id]", INVESTIGATE_NANITES) -/obj/machinery/computer/nanite_cloud_controller/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/computer/nanite_cloud_controller/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "NaniteCloudControl", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "NaniteCloudControl", name) ui.open() /obj/machinery/computer/nanite_cloud_controller/ui_data() diff --git a/code/modules/research/nanites/nanite_program_hub.dm b/code/modules/research/nanites/nanite_program_hub.dm index 7a90a8d27ca..21eb6820257 100644 --- a/code/modules/research/nanites/nanite_program_hub.dm +++ b/code/modules/research/nanites/nanite_program_hub.dm @@ -7,22 +7,20 @@ anchored = TRUE density = TRUE circuit = /obj/item/circuitboard/machine/nanite_program_hub - ui_x = 500 - ui_y = 700 var/obj/item/disk/nanite_program/disk var/datum/techweb/linked_techweb var/current_category = "Main" var/detail_view = TRUE var/categories = list( - list(name = "Utility Nanites"), - list(name = "Medical Nanites"), - list(name = "Sensor Nanites"), - list(name = "Augmentation Nanites"), - list(name = "Suppression Nanites"), - list(name = "Weaponized Nanites"), - list(name = "Protocols") - ) + list(name = "Utility Nanites"), + list(name = "Medical Nanites"), + list(name = "Sensor Nanites"), + list(name = "Augmentation Nanites"), + list(name = "Suppression Nanites"), + list(name = "Weaponized Nanites"), + list(name = "Protocols"), + ) /obj/machinery/nanite_program_hub/Initialize() . = ..() @@ -65,10 +63,10 @@ eject(user) return -/obj/machinery/nanite_program_hub/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/nanite_program_hub/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "NaniteProgramHub", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "NaniteProgramHub", name) ui.open() /obj/machinery/nanite_program_hub/ui_data() diff --git a/code/modules/research/nanites/nanite_programmer.dm b/code/modules/research/nanites/nanite_programmer.dm index 4fbe699f94e..7dfffbd7475 100644 --- a/code/modules/research/nanites/nanite_programmer.dm +++ b/code/modules/research/nanites/nanite_programmer.dm @@ -10,8 +10,6 @@ density = TRUE flags_1 = HEAR_1 circuit = /obj/item/circuitboard/machine/nanite_programmer - ui_x = 420 - ui_y = 550 /obj/machinery/nanite_programmer/attackby(obj/item/I, mob/user) if(istype(I, /obj/item/disk/nanite_program)) @@ -52,10 +50,10 @@ eject(user) return -/obj/machinery/nanite_programmer/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/nanite_programmer/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "NaniteProgrammer", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "NaniteProgrammer", name) ui.open() /obj/machinery/nanite_programmer/ui_data() diff --git a/code/modules/research/nanites/nanite_remote.dm b/code/modules/research/nanites/nanite_remote.dm index b222b2ad358..e3f5a0f286c 100644 --- a/code/modules/research/nanites/nanite_remote.dm +++ b/code/modules/research/nanites/nanite_remote.dm @@ -80,10 +80,13 @@ var/datum/nanite_program/relay/N = X N.relay_signal(code, relay_code, source) -/obj/item/nanite_remote/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.hands_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/item/nanite_remote/ui_state(mob/user) + return GLOB.hands_state + +/obj/item/nanite_remote/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "NaniteRemote", name, 420, 500, master_ui, state) + ui = new(user, src, "NaniteRemote", name) ui.open() /obj/item/nanite_remote/ui_data() @@ -94,7 +97,6 @@ data["locked"] = locked data["saved_settings"] = saved_settings data["program_name"] = current_program_name - return data /obj/item/nanite_remote/ui_act(action, params) diff --git a/code/modules/ruins/spaceruin_code/TheDerelict.dm b/code/modules/ruins/spaceruin_code/TheDerelict.dm index e153b159cde..65a81e289d0 100644 --- a/code/modules/ruins/spaceruin_code/TheDerelict.dm +++ b/code/modules/ruins/spaceruin_code/TheDerelict.dm @@ -20,7 +20,6 @@ name = "Vault Raider Objectives" info = "Objectives #1: Find out what is hidden in Kosmicheskaya Stantsiya 13s Vault" - /// Vault controller for use on the derelict/KS13. /obj/machinery/computer/vaultcontroller name = "vault controller" @@ -38,15 +37,10 @@ var/siphoned_power = 0 var/siphon_max = 1e7 - ui_x = 300 - ui_y = 120 - - /obj/machinery/computer/monitor/examine(mob/user) . = ..() . += "It appears to be powered via a cable connector." - //Checks for cable connection, charges if possible. /obj/machinery/computer/vaultcontroller/process() if(siphoned_power >= siphon_max) @@ -55,13 +49,11 @@ if(attached_cable) attempt_siphon() - ///Looks for a cable connection beneath the machine. /obj/machinery/computer/vaultcontroller/proc/update_cable() var/turf/T = get_turf(src) attached_cable = locate(/obj/structure/cable) in T - ///Initializes airlock links. /obj/machinery/computer/vaultcontroller/proc/find_airlocks() for(var/obj/machinery/door/airlock/A in GLOB.airlocks) @@ -73,7 +65,6 @@ door2 = A break - ///Tries to charge from powernet excess, no upper limit except max charge. /obj/machinery/computer/vaultcontroller/proc/attempt_siphon() var/surpluspower = clamp(attached_cable.surplus(), 0, (siphon_max - siphoned_power)) @@ -81,7 +72,6 @@ attached_cable.add_load(surpluspower) siphoned_power += surpluspower - ///Handles the doors closing /obj/machinery/computer/vaultcontroller/proc/cycle_close(obj/machinery/door/airlock/A) A.safe = FALSE //Make sure its forced closed, always @@ -89,14 +79,12 @@ A.close() A.bolt() - ///Handles the doors opening /obj/machinery/computer/vaultcontroller/proc/cycle_open(obj/machinery/door/airlock/A) A.unbolt() A.open() A.bolt() - ///Attempts to lock the vault doors /obj/machinery/computer/vaultcontroller/proc/lock_vault() if(door1 && !door1.density) @@ -106,7 +94,6 @@ if(door1.density && door1.locked && door2.density && door2.locked) locked = TRUE - ///Attempts to unlock the vault doors /obj/machinery/computer/vaultcontroller/proc/unlock_vault() if(door1 && door1.density) @@ -116,7 +103,6 @@ if(!door1.density && door1.locked && !door2.density && door2.locked) locked = FALSE - ///Attempts to lock/unlock vault doors, if machine is charged. /obj/machinery/computer/vaultcontroller/proc/activate_lock() if(siphoned_power < siphon_max) @@ -128,15 +114,12 @@ else lock_vault() - -/obj/machinery/computer/vaultcontroller/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/computer/vaultcontroller/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "VaultController", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "VaultController", name) ui.open() - /obj/machinery/computer/vaultcontroller/ui_act(action, params) if(..()) return @@ -144,7 +127,6 @@ if("togglelock") activate_lock() - /obj/machinery/computer/vaultcontroller/ui_data() var/list/data = list() data["stored"] = siphoned_power @@ -152,7 +134,6 @@ data["doorstatus"] = locked return data - ///Airlock that can't be deconstructed, broken or hacked. /obj/machinery/door/airlock/vault/derelict locked = TRUE @@ -161,14 +142,12 @@ resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF id_tag = "derelictvault" - ///Overrides screwdriver attack to prevent all deconstruction and hacking. /obj/machinery/door/airlock/vault/derelict/attackby(obj/item/C, mob/user, params) if(C.tool_behaviour == TOOL_SCREWDRIVER) return ..() - // So drones can teach borgs and AI dronespeak. For best effect, combine with mother drone lawset. /obj/item/dronespeak_manual name = "dronespeak manual" diff --git a/code/modules/security_levels/keycard_authentication.dm b/code/modules/security_levels/keycard_authentication.dm index 28b2dfbaa9c..bd424474a98 100644 --- a/code/modules/security_levels/keycard_authentication.dm +++ b/code/modules/security_levels/keycard_authentication.dm @@ -15,8 +15,6 @@ GLOBAL_DATUM_INIT(keycard_events, /datum/events, new) power_channel = AREA_USAGE_ENVIRON req_access = list(ACCESS_KEYCARD_AUTH) resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF - ui_x = 375 - ui_y = 125 var/datum/callback/ev var/event = "" @@ -33,11 +31,13 @@ GLOBAL_DATUM_INIT(keycard_events, /datum/events, new) QDEL_NULL(ev) return ..() -/obj/machinery/keycard_auth/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.physical_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/keycard_auth/ui_state(mob/user) + return GLOB.physical_state + +/obj/machinery/keycard_auth/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "KeycardAuth", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "KeycardAuth", name) ui.open() /obj/machinery/keycard_auth/ui_data() diff --git a/code/modules/shuttle/emergency.dm b/code/modules/shuttle/emergency.dm index 198a31bade4..5cc8fbe33b1 100644 --- a/code/modules/shuttle/emergency.dm +++ b/code/modules/shuttle/emergency.dm @@ -8,8 +8,6 @@ desc = "For shuttle control." icon_screen = "shuttle" icon_keyboard = "tech_key" - ui_x = 400 - ui_y = 350 var/auth_need = 3 var/list/authorized = list() @@ -19,11 +17,14 @@ say("Please equip your ID card into your ID slot to authenticate.") . = ..() -/obj/machinery/computer/emergency_shuttle/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.human_adjacent_state) +/obj/machinery/computer/emergency_shuttle/ui_state(mob/user) + return GLOB.human_adjacent_state - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/computer/emergency_shuttle/ui_interact(mob/user, datum/tgui/ui) + + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "EmergencyShuttleConsole", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "EmergencyShuttleConsole", name) ui.open() /obj/machinery/computer/emergency_shuttle/ui_data() diff --git a/code/modules/station_goals/bsa.dm b/code/modules/station_goals/bsa.dm index 48324aa064c..7877971f033 100644 --- a/code/modules/station_goals/bsa.dm +++ b/code/modules/station_goals/bsa.dm @@ -235,19 +235,19 @@ circuit = /obj/item/circuitboard/computer/bsa_control icon = 'icons/obj/machines/particle_accelerator.dmi' icon_state = "control_boxp" - ui_x = 400 - ui_y = 220 var/obj/machinery/bsa/full/cannon var/notice var/target var/area_aim = FALSE //should also show areas for targeting -/obj/machinery/computer/bsa_control/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ - datum/tgui/master_ui = null, datum/ui_state/state = GLOB.physical_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/computer/bsa_control/ui_state(mob/user) + return GLOB.physical_state + +/obj/machinery/computer/bsa_control/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "BluespaceArtillery", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "BluespaceArtillery", name) ui.open() /obj/machinery/computer/bsa_control/ui_data() diff --git a/code/modules/station_goals/dna_vault.dm b/code/modules/station_goals/dna_vault.dm index eed291b61be..71a256c0f7b 100644 --- a/code/modules/station_goals/dna_vault.dm +++ b/code/modules/station_goals/dna_vault.dm @@ -131,9 +131,6 @@ light_range = 3 light_power = 1.5 light_color = LIGHT_COLOR_CYAN - ui_x = 350 - ui_y = 400 - //High defaults so it's not completed automatically if there's no station goal var/animals_max = 100 @@ -176,15 +173,13 @@ qdel(filler) . = ..() - -/obj/machinery/dna_vault/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.physical_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/dna_vault/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) roll_powers(user) - ui = new(user, src, ui_key, "DnaVault", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "DnaVault", name) ui.open() - /obj/machinery/dna_vault/proc/roll_powers(mob/user) if(user in power_lottery) return diff --git a/code/modules/station_goals/shield.dm b/code/modules/station_goals/shield.dm index 57fd3aaa615..e9b8d039cc3 100644 --- a/code/modules/station_goals/shield.dm +++ b/code/modules/station_goals/shield.dm @@ -40,15 +40,12 @@ name = "satellite control" desc = "Used to control the satellite network." circuit = /obj/item/circuitboard/computer/sat_control - ui_x = 400 - ui_y = 305 - var/notice -/obj/machinery/computer/sat_control/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/computer/sat_control/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, ui_key, "SatelliteControl", name, ui_x, ui_y, master_ui, state) + ui = new(user, src, "SatelliteControl", name) ui.open() /obj/machinery/computer/sat_control/ui_act(action, params) diff --git a/code/modules/tgui/external.dm b/code/modules/tgui/external.dm index 57fb28bf3ba..46b324e1512 100644 --- a/code/modules/tgui/external.dm +++ b/code/modules/tgui/external.dm @@ -1,7 +1,5 @@ /** - * tgui external - * - * Contains all external tgui declarations. + * External tgui definitions, such as src_object APIs. * * Copyright (c) 2020 Aleksej Komarov * SPDX-License-Identifier: MIT @@ -14,13 +12,9 @@ * 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_key string The ui_key of the UI. * optional ui datum/tgui The UI to be updated, if it exists. - * optional force_open bool If the UI should be re-opened instead of updated. - * optional master_ui datum/tgui The parent UI. - * optional state datum/ui_state The state used to determine status. */ -/datum/proc/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) +/datum/proc/ui_interact(mob/user, datum/tgui/ui) return FALSE // Not implemented. /** @@ -40,10 +34,11 @@ * 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. + * + * 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. * @@ -55,18 +50,17 @@ /** * public * - * Forces an update on static data. Should be done manually whenever something happens to change static data. + * Forces an update on static data. Should be done manually whenever something + * happens to change static data. * * required user the mob currently interacting with the ui * optional ui ui to be updated - * optional ui_key ui key of ui to be updated */ -/datum/proc/update_static_data(mob/user, datum/tgui/ui, ui_key = "main") - ui = SStgui.try_update_ui(user, src, ui_key, ui) - // If there was no ui to update, there's no static data to update either. +/datum/proc/update_static_data(mob/user, datum/tgui/ui) if(!ui) - return - ui.push_data(null, ui_static_data(user), TRUE) + ui = SStgui.get_open_ui(user, src) + if(ui) + ui.send_full_update() /** * public @@ -88,17 +82,12 @@ * public * * Called on an object when a tgui object is being created, allowing you to - * customise the html - * For example: inserting a custom stylesheet that you need in the head + * push various assets to tgui, for examples spritesheets. * - * For this purpose, some tags are available in the html, to be parsed out - ^ with replacetext - * (customheadhtml) - Additions to the head tag - * - * required html the html base text + * return list List of asset datums or file paths. */ -/datum/proc/ui_base_html(html) - return html +/datum/proc/ui_assets(mob/user) + return list() /** * private @@ -110,6 +99,15 @@ /datum/proc/ui_host(mob/user) 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) + return GLOB.default_state + /** * global * @@ -121,9 +119,17 @@ /** * global * - * Used to track UIs for a mob. + * Tracks open UIs for a user. */ -/mob/var/list/open_uis = list() +/mob/var/list/tgui_open_uis = list() + +/** + * global + * + * Tracks open windows for a user. + */ +/client/var/list/tgui_windows = list() + /** * public * @@ -140,17 +146,43 @@ * * required uiref ref The UI that was closed. */ -/client/verb/uiclose(ref as text) +/client/verb/uiclose(window_id as text) // Name the verb, and hide it from the user panel. set name = "uiclose" - set hidden = 1 + set hidden = TRUE + var/mob/user = src && src.mob + if(!user) + return + // Close all tgui datums based on window_id. + SStgui.force_close_window(user, window_id) - // Get the UI based on the ref. - var/datum/tgui/ui = locate(ref) - - // If we found the UI, close it. - if(istype(ui)) - ui.close() - // Unset machine just to be sure. - if(src && src.mob) - src.mob.unset_machine() +/** + * Middleware for /client/Topic. + * + * return bool Whether the topic is passed (TRUE), or cancelled (FALSE). + */ +/proc/tgui_Topic(href_list) + // Skip non-tgui topics + if(!href_list["tgui"]) + return TRUE + var/type = href_list["type"] + // Unconditionally collect tgui logs + if(type == "log") + log_tgui(usr, href_list["message"]) + // 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.") + SStgui.force_close_window(usr, window_id) + return FALSE + // 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 FALSE diff --git a/code/modules/tgui/states.dm b/code/modules/tgui/states.dm index 33f42d5eb21..4a5ec565355 100644 --- a/code/modules/tgui/states.dm +++ b/code/modules/tgui/states.dm @@ -1,8 +1,6 @@ /** - * tgui states - * - * Base state and helpers for states. Just does some sanity checks, implement - * a state for in-depth checks. + * Base state and helpers for states. Just does some sanity checks, + * implement a proper state for in-depth checks. * * Copyright (c) 2020 Aleksej Komarov * SPDX-License-Identifier: MIT @@ -30,9 +28,10 @@ . = max(., UI_INTERACTIVE) // Regular ghosts can always at least view if in range. - var/clientviewlist = getviewsize(user.client.view) - if(get_dist(src_object, user) < max(clientviewlist[1],clientviewlist[2])) - . = max(., UI_UPDATE) + if(user.client) + var/clientviewlist = getviewsize(user.client.view) + if(get_dist(src_object, user) < max(clientviewlist[1], clientviewlist[2])) + . = max(., UI_UPDATE) // Check if the state allows interaction var/result = state.can_use_topic(src_object, user) @@ -50,7 +49,8 @@ * return UI_state The state of the UI. */ /datum/ui_state/proc/can_use_topic(src_object, mob/user) - return UI_CLOSE // Don't allow interaction by default. + // Don't allow interaction by default. + return UI_CLOSE /** * public @@ -60,11 +60,14 @@ * return UI_state The state of the UI. */ /mob/proc/shared_ui_interaction(src_object) - if(!client) // Close UIs if mindless. + // Close UIs if mindless. + if(!client) return UI_CLOSE - else if(stat) // Disable UIs if unconcious. + // Disable UIs if unconcious. + else if(stat) return UI_DISABLED - else if(incapacitated()) // Update UIs if incapicitated but concious. + // Update UIs if incapicitated but concious. + else if(incapacitated()) return UI_UPDATE return UI_INTERACTIVE @@ -74,12 +77,14 @@ return UI_UPDATE /mob/living/silicon/ai/shared_ui_interaction(src_object) - if(lacks_power()) // Disable UIs if the AI is unpowered. + // Disable UIs if the AI is unpowered. + if(lacks_power()) return UI_DISABLED return ..() /mob/living/silicon/robot/shared_ui_interaction(src_object) - if(!cell || cell.charge <= 0 || lockcharge) // Disable UIs if the Borg is unpowered or locked. + // Disable UIs if the Borg is unpowered or locked. + if(!cell || cell.charge <= 0 || lockcharge) return UI_DISABLED return ..() @@ -96,7 +101,8 @@ * return UI_state The state of the UI. */ /atom/proc/contents_ui_distance(src_object, mob/living/user) - return user.shared_living_ui_distance(src_object) // Just call this mob's check. + // Just call this mob's check. + return user.shared_living_ui_distance(src_object) /** * public @@ -108,17 +114,21 @@ * return UI_state The state of the UI. */ /mob/living/proc/shared_living_ui_distance(atom/movable/src_object, viewcheck = TRUE) - if(viewcheck && !(src_object in view(src))) // If the object is obscured, close it. + // If the object is obscured, close it. + if(viewcheck && !(src_object in view(src))) return UI_CLOSE - var/dist = get_dist(src_object, src) - if(dist <= 1) // Open and interact if 1-0 tiles away. + // Open and interact if 1-0 tiles away. + if(dist <= 1) return UI_INTERACTIVE - else if(dist <= 2) // View only if 2-3 tiles away. + // View only if 2-3 tiles away. + else if(dist <= 2) return UI_UPDATE - else if(dist <= 5) // Disable if 5 tiles away. + // Disable if 5 tiles away. + else if(dist <= 5) return UI_DISABLED - return UI_CLOSE // Otherwise, we got nothing. + // Otherwise, we got nothing. + return UI_CLOSE /mob/living/carbon/human/shared_living_ui_distance(atom/movable/src_object, viewcheck = TRUE) if(dna.check_mutation(TK) && tkMaxRangeCheck(src, src_object)) diff --git a/code/modules/tgui/states/admin.dm b/code/modules/tgui/states/admin.dm index 61fc3731188..227a2940785 100644 --- a/code/modules/tgui/states/admin.dm +++ b/code/modules/tgui/states/admin.dm @@ -2,6 +2,9 @@ * tgui state: admin_state * * Checks that the user is an admin, end-of-story. + * + * Copyright (c) 2020 Aleksej Komarov + * SPDX-License-Identifier: MIT */ GLOBAL_DATUM_INIT(admin_state, /datum/ui_state/admin_state, new) diff --git a/code/modules/tgui/states/always.dm b/code/modules/tgui/states/always.dm index a741e2e3d4b..210f0896a2f 100644 --- a/code/modules/tgui/states/always.dm +++ b/code/modules/tgui/states/always.dm @@ -2,6 +2,9 @@ * tgui state: always_state * * Always grants the user UI_INTERACTIVE. Period. + * + * Copyright (c) 2020 Aleksej Komarov + * SPDX-License-Identifier: MIT */ GLOBAL_DATUM_INIT(always_state, /datum/ui_state/always_state, new) diff --git a/code/modules/tgui/states/conscious.dm b/code/modules/tgui/states/conscious.dm index 4e2793d1300..670ca7c07e8 100644 --- a/code/modules/tgui/states/conscious.dm +++ b/code/modules/tgui/states/conscious.dm @@ -2,6 +2,9 @@ * tgui state: conscious_state * * Only checks if the user is conscious. + * + * Copyright (c) 2020 Aleksej Komarov + * SPDX-License-Identifier: MIT */ GLOBAL_DATUM_INIT(conscious_state, /datum/ui_state/conscious_state, new) diff --git a/code/modules/tgui/states/contained.dm b/code/modules/tgui/states/contained.dm index f02424d01e6..1eb8edba25f 100644 --- a/code/modules/tgui/states/contained.dm +++ b/code/modules/tgui/states/contained.dm @@ -2,6 +2,9 @@ * tgui state: contained_state * * Checks that the user is inside the src_object. + * + * Copyright (c) 2020 Aleksej Komarov + * SPDX-License-Identifier: MIT */ GLOBAL_DATUM_INIT(contained_state, /datum/ui_state/contained_state, new) diff --git a/code/modules/tgui/states/deep_inventory.dm b/code/modules/tgui/states/deep_inventory.dm index 43758cbab17..a2b9276a593 100644 --- a/code/modules/tgui/states/deep_inventory.dm +++ b/code/modules/tgui/states/deep_inventory.dm @@ -1,7 +1,11 @@ /** * tgui state: deep_inventory_state * - * Checks that the src_object is in the user's deep (backpack, box, toolbox, etc) inventory. + * Checks that the src_object is in the user's deep + * (backpack, box, toolbox, etc) inventory. + * + * Copyright (c) 2020 Aleksej Komarov + * SPDX-License-Identifier: MIT */ GLOBAL_DATUM_INIT(deep_inventory_state, /datum/ui_state/deep_inventory_state, new) diff --git a/code/modules/tgui/states/default.dm b/code/modules/tgui/states/default.dm index 6bb159640e4..367e57beffa 100644 --- a/code/modules/tgui/states/default.dm +++ b/code/modules/tgui/states/default.dm @@ -1,7 +1,11 @@ /** * tgui state: default_state * - * Checks a number of things -- mostly physical distance for humans and view for robots. + * Checks a number of things -- mostly physical distance for humans + * and view for robots. + * + * Copyright (c) 2020 Aleksej Komarov + * SPDX-License-Identifier: MIT */ GLOBAL_DATUM_INIT(default_state, /datum/ui_state/default, new) diff --git a/code/modules/tgui/states/hands.dm b/code/modules/tgui/states/hands.dm index aedae477dd2..1c885ed4140 100644 --- a/code/modules/tgui/states/hands.dm +++ b/code/modules/tgui/states/hands.dm @@ -2,6 +2,9 @@ * tgui state: hands_state * * Checks that the src_object is in the user's hands. + * + * Copyright (c) 2020 Aleksej Komarov + * SPDX-License-Identifier: MIT */ GLOBAL_DATUM_INIT(hands_state, /datum/ui_state/hands_state, new) diff --git a/code/modules/tgui/states/human_adjacent.dm b/code/modules/tgui/states/human_adjacent.dm index 7aefe43e44c..2ac7c8637b6 100644 --- a/code/modules/tgui/states/human_adjacent.dm +++ b/code/modules/tgui/states/human_adjacent.dm @@ -3,6 +3,9 @@ * * In addition to default checks, only allows interaction for a * human adjacent user. + * + * Copyright (c) 2020 Aleksej Komarov + * SPDX-License-Identifier: MIT */ GLOBAL_DATUM_INIT(human_adjacent_state, /datum/ui_state/human_adjacent_state, new) diff --git a/code/modules/tgui/states/inventory.dm b/code/modules/tgui/states/inventory.dm index 43fe2cb4512..dc5dd0d57e6 100644 --- a/code/modules/tgui/states/inventory.dm +++ b/code/modules/tgui/states/inventory.dm @@ -1,7 +1,11 @@ /** * tgui state: inventory_state * - * Checks that the src_object is in the user's top-level (hand, ear, pocket, belt, etc) inventory. + * Checks that the src_object is in the user's top-level + * (hand, ear, pocket, belt, etc) inventory. + * + * Copyright (c) 2020 Aleksej Komarov + * SPDX-License-Identifier: MIT */ GLOBAL_DATUM_INIT(inventory_state, /datum/ui_state/inventory_state, new) diff --git a/code/modules/tgui/states/language_menu.dm b/code/modules/tgui/states/language_menu.dm index 5c816c8922a..6389b05cd5e 100644 --- a/code/modules/tgui/states/language_menu.dm +++ b/code/modules/tgui/states/language_menu.dm @@ -1,5 +1,8 @@ /** * tgui state: language_menu_state + * + * Copyright (c) 2020 Aleksej Komarov + * SPDX-License-Identifier: MIT */ GLOBAL_DATUM_INIT(language_menu_state, /datum/ui_state/language_menu, new) diff --git a/code/modules/tgui/states/not_incapacitated.dm b/code/modules/tgui/states/not_incapacitated.dm index 1b48f7f41a4..16dcb7881ed 100644 --- a/code/modules/tgui/states/not_incapacitated.dm +++ b/code/modules/tgui/states/not_incapacitated.dm @@ -2,6 +2,9 @@ * tgui state: not_incapacitated_state * * Checks that the user isn't incapacitated + * + * Copyright (c) 2020 Aleksej Komarov + * SPDX-License-Identifier: MIT */ GLOBAL_DATUM_INIT(not_incapacitated_state, /datum/ui_state/not_incapacitated_state, new) diff --git a/code/modules/tgui/states/notcontained.dm b/code/modules/tgui/states/notcontained.dm index 642c6ce95f4..1d4e6aec192 100644 --- a/code/modules/tgui/states/notcontained.dm +++ b/code/modules/tgui/states/notcontained.dm @@ -1,7 +1,11 @@ /** * tgui state: notcontained_state * - * Checks that the user is not inside src_object, and then makes the default checks. + * Checks that the user is not inside src_object, and then makes the + * default checks. + * + * Copyright (c) 2020 Aleksej Komarov + * SPDX-License-Identifier: MIT */ GLOBAL_DATUM_INIT(notcontained_state, /datum/ui_state/notcontained_state, new) diff --git a/code/modules/tgui/states/observer.dm b/code/modules/tgui/states/observer.dm index 86ad776b135..d105de1c0c0 100644 --- a/code/modules/tgui/states/observer.dm +++ b/code/modules/tgui/states/observer.dm @@ -2,6 +2,9 @@ * tgui state: observer_state * * Checks that the user is an observer/ghost. + * + * Copyright (c) 2020 Aleksej Komarov + * SPDX-License-Identifier: MIT */ GLOBAL_DATUM_INIT(observer_state, /datum/ui_state/observer_state, new) diff --git a/code/modules/tgui/states/physical.dm b/code/modules/tgui/states/physical.dm index 88c8a291aa8..3073039d14c 100644 --- a/code/modules/tgui/states/physical.dm +++ b/code/modules/tgui/states/physical.dm @@ -2,6 +2,9 @@ * tgui state: physical_state * * Short-circuits the default state to only check physical distance. + * + * Copyright (c) 2020 Aleksej Komarov + * SPDX-License-Identifier: MIT */ GLOBAL_DATUM_INIT(physical_state, /datum/ui_state/physical, new) diff --git a/code/modules/tgui/states/self.dm b/code/modules/tgui/states/self.dm index b0c9500fbcf..4b6e3b9fd9f 100644 --- a/code/modules/tgui/states/self.dm +++ b/code/modules/tgui/states/self.dm @@ -2,6 +2,9 @@ * tgui state: self_state * * Only checks that the user and src_object are the same. + * + * Copyright (c) 2020 Aleksej Komarov + * SPDX-License-Identifier: MIT */ GLOBAL_DATUM_INIT(self_state, /datum/ui_state/self_state, new) diff --git a/code/modules/tgui/states/zlevel.dm b/code/modules/tgui/states/zlevel.dm index 5e3ccfb7de2..64ea2fa1c0e 100644 --- a/code/modules/tgui/states/zlevel.dm +++ b/code/modules/tgui/states/zlevel.dm @@ -2,6 +2,9 @@ * tgui state: z_state * * Only checks that the Z-level of the user and src_object are the same. + * + * Copyright (c) 2020 Aleksej Komarov + * SPDX-License-Identifier: MIT */ GLOBAL_DATUM_INIT(z_state, /datum/ui_state/z_state, new) diff --git a/code/modules/tgui/subsystem.dm b/code/modules/tgui/subsystem.dm deleted file mode 100644 index 3fbf98c3df3..00000000000 --- a/code/modules/tgui/subsystem.dm +++ /dev/null @@ -1,250 +0,0 @@ -/** - * tgui subsystem - * - * Contains all tgui state and subsystem code. - * - * Copyright (c) 2020 Aleksej Komarov - * SPDX-License-Identifier: MIT - */ - -/** - * public - * - * Get an open UI given a user, src_object, and ui_key and try to update it with data. - * - * required user mob The mob who opened/is using the UI. - * required src_object datum The object/datum which owns the UI. - * required ui_key string The ui_key of the UI. - * optional ui datum/tgui The UI to be updated, if it exists. - * optional force_open bool If the UI should be re-opened instead of updated. - * - * return datum/tgui The found UI. - */ -/datum/controller/subsystem/tgui/proc/try_update_ui(mob/user, datum/src_object, ui_key, datum/tgui/ui, force_open = FALSE) - if(isnull(ui)) // No UI was passed, so look for one. - ui = get_open_ui(user, src_object, ui_key) - - if(!isnull(ui)) - var/data = src_object.ui_data(user) // Get data from the src_object. - if(!force_open) // UI is already open; update it. - ui.push_data(data) - else // Re-open it anyways. - ui.reinitialize(null, data) - return ui // We found the UI, return it. - else - return null // We couldn't find a UI. - -/** - * private - * - * Get an open UI given a user, src_object, and ui_key. - * - * required user mob The mob who opened/is using the UI. - * required src_object datum The object/datum which owns the UI. - * required ui_key string The ui_key of the UI. - * - * return datum/tgui The found UI. - */ -/datum/controller/subsystem/tgui/proc/get_open_ui(mob/user, datum/src_object, ui_key) - var/src_object_key = "[REF(src_object)]" - if(isnull(open_uis[src_object_key]) || !istype(open_uis[src_object_key], /list)) - return null // No UIs open. - else if(isnull(open_uis[src_object_key][ui_key]) || !istype(open_uis[src_object_key][ui_key], /list)) - return null // No UIs open for this object. - - for(var/datum/tgui/ui in open_uis[src_object_key][ui_key]) // Find UIs for this object. - if(ui.user == user) // Make sure we have the right user - return ui - - return null // Couldn't find a UI! - -/** - * private - * - * Update all UIs attached to src_object. - * - * required src_object datum The object/datum which owns the UIs. - * - * return int The number of UIs updated. - */ -/datum/controller/subsystem/tgui/proc/update_uis(datum/src_object) - var/src_object_key = "[REF(src_object)]" - if(isnull(open_uis[src_object_key]) || !istype(open_uis[src_object_key], /list)) - return 0 // Couldn't find any UIs for this object. - - var/update_count = 0 - for(var/ui_key in open_uis[src_object_key]) - for(var/datum/tgui/ui in open_uis[src_object_key][ui_key]) - if(ui && ui.src_object && ui.user && ui.src_object.ui_host(ui.user)) // Check the UI is valid. - ui.process(force = 1) // Update the UI. - update_count++ // Count each UI we update. - return update_count - -/** - * private - * - * Close all UIs attached to src_object. - * - * required src_object datum The object/datum which owns the UIs. - * - * return int The number of UIs closed. - */ -/datum/controller/subsystem/tgui/proc/close_uis(datum/src_object) - var/src_object_key = "[REF(src_object)]" - if(isnull(open_uis[src_object_key]) || !istype(open_uis[src_object_key], /list)) - return 0 // Couldn't find any UIs for this object. - - var/close_count = 0 - for(var/ui_key in open_uis[src_object_key]) - for(var/datum/tgui/ui in open_uis[src_object_key][ui_key]) - if(ui && ui.src_object && ui.user && ui.src_object.ui_host(ui.user)) // Check the UI is valid. - ui.close() // Close the UI. - close_count++ // Count each UI we close. - return close_count - -/** - * private - * - * Close *ALL* UIs - * - * return int The number of UIs closed. - */ -/datum/controller/subsystem/tgui/proc/close_all_uis() - var/close_count = 0 - for(var/src_object_key in open_uis) - for(var/ui_key in open_uis[src_object_key]) - for(var/datum/tgui/ui in open_uis[src_object_key][ui_key]) - if(ui && ui.src_object && ui.user && ui.src_object.ui_host(ui.user)) // Check the UI is valid. - ui.close() // Close the UI. - close_count++ // Count each UI we close. - return close_count - -/** - * private - * - * Update all UIs belonging to a user. - * - * required user mob The mob who opened/is using the UI. - * optional src_object datum If provided, only update UIs belonging this src_object. - * optional ui_key string If provided, only update UIs with this UI key. - * - * return int The number of UIs updated. - */ -/datum/controller/subsystem/tgui/proc/update_user_uis(mob/user, datum/src_object = null, ui_key = null) - if(isnull(user.open_uis) || !istype(user.open_uis, /list) || open_uis.len == 0) - return 0 // Couldn't find any UIs for this user. - - var/update_count = 0 - for(var/datum/tgui/ui in user.open_uis) - if((isnull(src_object) || !isnull(src_object) && ui.src_object == src_object) && (isnull(ui_key) || !isnull(ui_key) && ui.ui_key == ui_key)) - ui.process(force = 1) // Update the UI. - update_count++ // Count each UI we upadte. - return update_count - -/** - * private - * - * Close all UIs belonging to a user. - * - * required user mob The mob who opened/is using the UI. - * optional src_object datum If provided, only close UIs belonging this src_object. - * optional ui_key string If provided, only close UIs with this UI key. - * - * return int The number of UIs closed. - */ -/datum/controller/subsystem/tgui/proc/close_user_uis(mob/user, datum/src_object = null, ui_key = null) - if(isnull(user.open_uis) || !istype(user.open_uis, /list) || open_uis.len == 0) - return 0 // Couldn't find any UIs for this user. - - var/close_count = 0 - for(var/datum/tgui/ui in user.open_uis) - if((isnull(src_object) || !isnull(src_object) && ui.src_object == src_object) && (isnull(ui_key) || !isnull(ui_key) && ui.ui_key == ui_key)) - ui.close() // Close the UI. - close_count++ // Count each UI we close. - return close_count - -/** - * private - * - * Add a UI to the list of open UIs. - * - * required ui datum/tgui The UI to be added. - */ -/datum/controller/subsystem/tgui/proc/on_open(datum/tgui/ui) - var/src_object_key = "[REF(ui.src_object)]" - if(isnull(open_uis[src_object_key]) || !istype(open_uis[src_object_key], /list)) - open_uis[src_object_key] = list(ui.ui_key = list()) // Make a list for the ui_key and src_object. - else if(isnull(open_uis[src_object_key][ui.ui_key]) || !istype(open_uis[src_object_key][ui.ui_key], /list)) - open_uis[src_object_key][ui.ui_key] = list() // Make a list for the ui_key. - - // Append the UI to all the lists. - ui.user.open_uis |= ui - var/list/uis = open_uis[src_object_key][ui.ui_key] - uis |= ui - processing_uis |= ui - -/** - * private - * - * Remove a UI from the list of open UIs. - * - * required ui datum/tgui The UI to be removed. - * - * return bool If the UI was removed or not. - */ -/datum/controller/subsystem/tgui/proc/on_close(datum/tgui/ui) - var/src_object_key = "[REF(ui.src_object)]" - if(isnull(open_uis[src_object_key]) || !istype(open_uis[src_object_key], /list)) - return 0 // It wasn't open. - else if(isnull(open_uis[src_object_key][ui.ui_key]) || !istype(open_uis[src_object_key][ui.ui_key], /list)) - return 0 // It wasn't open. - - processing_uis.Remove(ui) // Remove it from the list of processing UIs. - if(ui.user) // If the user exists, remove it from them too. - ui.user.open_uis.Remove(ui) - var/Ukey = ui.ui_key - var/list/uis = open_uis[src_object_key][Ukey] // Remove it from the list of open UIs. - uis.Remove(ui) - if(!uis.len) - var/list/uiobj = open_uis[src_object_key] - uiobj.Remove(Ukey) - if(!uiobj.len) - open_uis.Remove(src_object_key) - - return 1 // Let the caller know we did it. - -/** - * private - * - * Handle client logout, by closing all their UIs. - * - * required user mob The mob which logged out. - * - * return int The number of UIs closed. - */ -/datum/controller/subsystem/tgui/proc/on_logout(mob/user) - return close_user_uis(user) - -/** - * private - * - * Handle clients switching mobs, by transferring their UIs. - * - * required user source The client's original mob. - * required user target The client's new mob. - * - * return bool If the UIs were transferred. - */ -/datum/controller/subsystem/tgui/proc/on_transfer(mob/source, mob/target) - if(!source || isnull(source.open_uis) || !istype(source.open_uis, /list) || open_uis.len == 0) - return 0 // The old mob had no open UIs. - - if(isnull(target.open_uis) || !istype(target.open_uis, /list)) - target.open_uis = list() // Create a list for the new mob if needed. - - for(var/datum/tgui/ui in source.open_uis) - ui.user = target // Inform the UIs of their new owner. - target.open_uis.Add(ui) // Transfer all the UIs. - - source.open_uis.Cut() // Clear the old list. - return 1 // Let the caller know we did it. diff --git a/code/modules/tgui/tgui.dm b/code/modules/tgui/tgui.dm index 6373caef7b2..716f3546f2d 100644 --- a/code/modules/tgui/tgui.dm +++ b/code/modules/tgui/tgui.dm @@ -1,8 +1,4 @@ /** - * tgui - * - * /tg/station user interface library - * * Copyright (c) 2020 Aleksej Komarov * SPDX-License-Identifier: MIT */ @@ -17,34 +13,28 @@ var/datum/src_object /// The title of te UI. var/title - /// The ui_key of the UI. This allows multiple UIs for one src_object. - var/ui_key /// The window_id for browse() and onclose(). - var/window_id - /// The window width. - var/width = 0 - /// The window height - var/height = 0 + var/datum/tgui_window/window + /// Key that is used for remembering the window geometry. + var/window_key + /// Deprecated: Window size. + var/window_size /// The interface (template) to be used for this UI. var/interface /// Update the UI every MC tick. var/autoupdate = TRUE /// If the UI has been initialized yet. var/initialized = FALSE - /// The data (and datastructure) used to initialize the UI. - var/list/initial_data - /// The static data used to initialize the UI. - var/list/initial_static_data - /// Holder for the json string, that is sent during the initial update - var/_initial_update + /// Time of opening the window. + var/opened_at + /// Stops further updates when close() was called. + var/closing = FALSE /// The status/visibility of the UI. var/status = UI_INTERACTIVE /// Topic state used to determine status/interactability. var/datum/ui_state/state = null - /// The parent UI. - var/datum/tgui/master_ui - /// Children of this UI. - var/list/datum/tgui/children = list() + /// Asset data to be sent with every update + var/list/asset_data /** * public @@ -53,38 +43,25 @@ * * required user mob The mob who opened/is using the UI. * required src_object datum The object or datum which owns the UI. - * required ui_key string The ui_key of the UI. * required interface string The interface used to render the UI. * optional title string The title of the UI. - * optional width int The window width. - * optional height int The window height. - * optional master_ui datum/tgui The parent UI. - * optional state datum/ui_state The state used to determine status. + * optional ui_x int Deprecated: Window width. + * optional ui_y int Deprecated: Window height. * * return datum/tgui The requested UI. */ -/datum/tgui/New(mob/user, datum/src_object, ui_key, interface, title, width = 0, height = 0, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) +/datum/tgui/New(mob/user, datum/src_object, interface, title, ui_x, ui_y) + log_tgui(user, "new [interface] fancy [user.client.prefs.tgui_fancy]") src.user = user src.src_object = src_object - src.ui_key = ui_key - // DO NOT replace with \ref here. src_object could potentially be tagged - src.window_id = "[REF(src_object)]-[ui_key]" + src.window_key = "[REF(src_object)]-main" src.interface = interface - if(title) - src.title = sanitize(title) - if(width) - src.width = width - if(height) - src.height = height - - src.master_ui = master_ui - if(master_ui) - master_ui.children += src - src.state = state - - var/datum/asset/assets = get_asset_datum(/datum/asset/group/tgui) - assets.send(user) + src.title = title + src.state = src_object.ui_state() + // Deprecated + if(ui_x && ui_y) + src.window_size = list(ui_x, ui_y) /** * public @@ -93,83 +70,50 @@ */ /datum/tgui/proc/open() if(!user.client) - return // Bail if there is no client. - - update_status(push = FALSE) // Update the window status. + return null + if(window) + return null + process_status() if(status < UI_UPDATE) - return // Bail if we're not supposed to open. - - // Build window options - var/window_options = "can_minimize=0;auto_format=0;" - // If we have a width and height, use them. - if(width && height) - window_options += "size=[width]x[height];" - // Remove titlebar and resize handles for a fancy window - if(user.client.prefs.tgui_fancy) - window_options += "titlebar=0;can_resize=0;" + return null + window = SStgui.request_pooled_window(user) + if(!window) + return null + opened_at = world.time + window.acquire_lock(src) + if(!window.is_ready()) + window.initialize() else - window_options += "titlebar=1;can_resize=1;" - - // Generate page html - var/html - html = SStgui.basehtml - // Allow the src object to override the html if needed - html = src_object.ui_base_html(html) - // Replace template tokens with important UI data - // NOTE: Intentional \ref usage; tgui datums can't/shouldn't - // be tagged, so this is an effective unwrap - html = replacetextEx(html, "\[tgui:ref]", "\ref[src]") - - // Open the window. - user << browse(html, "window=[window_id];[window_options]") - - // Instruct the client to signal UI when the window is closed. - // NOTE: Intentional \ref usage; tgui datums can't/shouldn't - // be tagged, so this is an effective unwrap - winset(user, window_id, "on-close=\"uiclose \ref[src]\"") - - // Pre-fetch initial state while browser is still loading in - // another thread - if(!initial_data) - initial_data = src_object.ui_data(user) - if(!initial_static_data) - initial_static_data = src_object.ui_static_data(user) - _initial_update = url_encode(get_json(initial_data, initial_static_data)) - + window.send_message("ping") + for(var/datum/asset/asset in src_object.ui_assets(user)) + send_asset(asset) + window.send_message("update", get_payload( + with_data = TRUE, + with_static_data = TRUE)) SStgui.on_open(src) /** * public * - * Reinitialize the UI. - * (Possibly with a new interface and/or data). + * Close the UI. * - * optional template string The name of the new interface. - * optional data list The new initial data. + * optional can_be_suspended bool */ -/datum/tgui/proc/reinitialize(interface, list/data, list/static_data) - if(interface) - src.interface = interface - if(data) - initial_data = data - if(static_data) - initial_static_data = static_data - open() - -/** - * public - * - * Close the UI, and all its children. - */ -/datum/tgui/proc/close() - user << browse(null, "window=[window_id]") // Close the window. - src_object.ui_close(user) - SStgui.on_close(src) - for(var/datum/tgui/child in children) // Loop through and close all children. - child.close() - children.Cut() +/datum/tgui/proc/close(can_be_suspended = TRUE) + if(closing) + return + closing = TRUE + // If we don't have window_id, open proc did not have the opportunity + // to finish, therefore it's safe to skip this whole block. + if(window) + // Windows you want to keep are usually blue screens of death + // and we want to keep them around, to allow user to read + // the error message properly. + window.release_lock() + window.close(can_be_suspended) + src_object.ui_close(user) + SStgui.on_close(src) state = null - master_ui = null qdel(src) /** @@ -177,187 +121,176 @@ * * Enable/disable auto-updating of the UI. * - * required state bool Enable/disable auto-updating. + * required value bool Enable/disable auto-updating. */ -/datum/tgui/proc/set_autoupdate(state = TRUE) - autoupdate = state +/datum/tgui/proc/set_autoupdate(autoupdate) + src.autoupdate = autoupdate + +/** + * public + * + * Replace current ui.state with a new one. + * + * required state datum/ui_state/state Next state + */ +/datum/tgui/proc/set_state(datum/ui_state/state) + src.state = state + +/** + * public + * + * Makes an asset available to use in tgui. + * + * required asset datum/asset + */ +/datum/tgui/proc/send_asset(var/datum/asset/asset) + if(!user.client) + return + if(istype(asset, /datum/asset/spritesheet)) + var/datum/asset/spritesheet/spritesheet = asset + LAZYINITLIST(asset_data) + LAZYADD(asset_data["styles"], list(spritesheet.css_filename())) + asset.send(user) + +/** + * public + * + * Send a full update to the client (includes static data). + * + * optional custom_data list Custom data to send instead of ui_data. + * optional force bool Send an update even if UI is not interactive. + */ +/datum/tgui/proc/send_full_update(custom_data, force) + if(!user.client || !initialized || closing) + return + var/should_update_data = force || status > UI_UPDATE + window.send_message("update", get_payload( + custom_data, + with_data = should_update_data, + with_static_data = TRUE)) + +/** + * public + * + * Send a partial update to the client (excludes static data). + * + * optional custom_data list Custom data to send instead of ui_data. + * optional force bool Send an update even if UI is not interactive. + */ +/datum/tgui/proc/send_update(custom_data, force) + if(!user.client || !initialized || closing) + return + var/should_update_data = force || status > UI_UPDATE + window.send_message("update", get_payload( + custom_data, + with_data = should_update_data)) /** * private * * Package the data to send to the UI, as JSON. - * This includes the UI data and config_data. * - * return string The packaged JSON. + * return list */ -/datum/tgui/proc/get_json(list/data, list/static_data) +/datum/tgui/proc/get_payload(custom_data, with_data, with_static_data) var/list/json_data = list() - json_data["config"] = list( "title" = title, "status" = status, "interface" = interface, - "fancy" = user.client.prefs.tgui_fancy, - "locked" = user.client.prefs.tgui_lock, - "observer" = isobserver(user), - "window" = window_id, - // NOTE: Intentional \ref usage; tgui datums can't/shouldn't - // be tagged, so this is an effective unwrap - "ref" = "\ref[src]" + "window" = list( + "key" = window_key, + "size" = window_size, + "fancy" = user.client.prefs.tgui_fancy, + "locked" = user.client.prefs.tgui_lock, + ), + "user" = list( + "name" = "[user]", + "ckey" = "[user.ckey]", + "observer" = isobserver(user), + ), ) - - if(!isnull(data)) + var/data = custom_data || with_data && src_object.ui_data(user) + if(data) json_data["data"] = data - if(!isnull(static_data)) + var/static_data = with_static_data && src_object.ui_static_data(user) + if(static_data) json_data["static_data"] = static_data - - // Send shared states + if(asset_data) + json_data["assets"] = asset_data if(src_object.tgui_shared_states) json_data["shared"] = src_object.tgui_shared_states - - // Generate the JSON. - var/json = json_encode(json_data) - // Strip #255/improper. - json = replacetext(json, "\proper", "") - json = replacetext(json, "\improper", "") - return json + return json_data /** * private * - * Handle clicks from the UI. - * Call the src_object's ui_act() if status is UI_INTERACTIVE. - * If the src_object's ui_act() returns 1, update all UIs attacked to it. - */ -/datum/tgui/Topic(href, href_list) - if(user != usr) - return // Something is not right here. - - var/action = href_list["action"] - var/params = href_list; params -= "action" - - switch(action) - if("tgui:initialize") - user << output(_initial_update, "[window_id].browser:update") - initialized = TRUE - if("tgui:setSharedState") - // Update the window state. - update_status(push = FALSE) - // Bail if UI is not interactive or usr calling Topic - // is not the UI user. - if(status != UI_INTERACTIVE) - return - var/key = params["key"] - var/value = params["value"] - if(!src_object.tgui_shared_states) - src_object.tgui_shared_states = list() - src_object.tgui_shared_states[key] = value - SStgui.update_uis(src_object) - if("tgui:setFancy") - var/value = text2num(params["value"]) - user.client.prefs.tgui_fancy = value - if("tgui:log") - // Force window to show frills on fatal errors - if(params["fatal"]) - winset(user, window_id, "titlebar=1;can-resize=1;size=600x600") - log_message(params["log"]) - if("tgui:link") - user << link(params["url"]) - else - // Update the window state. - update_status(push = FALSE) - // Call ui_act() on the src_object. - if(src_object.ui_act(action, params, src, state)) - // Update if the object requested it. - SStgui.update_uis(src_object) - -/** - * private - * - * Update the UI. - * Only updates the data if update is true, otherwise only updates the status. - * - * optional force bool If the UI should be forced to update. + * Run an update cycle for this UI. Called internally by SStgui + * every second or so. */ /datum/tgui/process(force = FALSE) + if(closing) + return var/datum/host = src_object.ui_host(user) - if(!src_object || !host || !user) // If the object or user died (or something else), abort. + // If the object or user died (or something else), abort. + if(!src_object || !host || !user || !window) + close(can_be_suspended = FALSE) + return + // Validate ping + if(!initialized && world.time - opened_at > TGUI_PING_TIMEOUT) + log_tgui(user, \ + "Error: Zombie window detected, killing it with fire.\n" \ + + "window_id: [window.id]\n" \ + + "world.time: [world.time]") + close(can_be_suspended = FALSE) + return + // Update through a normal call to ui_interact + if(status != UI_DISABLED && (autoupdate || force)) + src_object.ui_interact(user, src) + return + // Update status only + var/needs_update = process_status() + if(status <= UI_CLOSE) close() return - - if(status && (force || autoupdate)) - update() // Update the UI if the status and update settings allow it. - else - update_status(push = TRUE) // Otherwise only update status. + if(needs_update) + window.send_message("update", get_payload()) /** * private * - * Push data to an already open UI. - * - * required data list The data to send. - * optional force bool If the update should be sent regardless of state. + * Updates the status, and returns TRUE if status has changed. */ -/datum/tgui/proc/push_data(data, static_data, force = FALSE) - // Update the window state. - update_status(push = FALSE) - // Cannot update UI if it is not set up yet. - if(!initialized) - return - // Cannot update UI, we have no visibility. - if(status <= UI_DISABLED && !force) - return - // Send the new JSON to the update() Javascript function. - user << output( - url_encode(get_json(data, static_data)), - "[window_id].browser:update") +/datum/tgui/proc/process_status() + var/prev_status = status + status = src_object.ui_status(user, state) + return prev_status != status /** * private * - * Updates the UI by interacting with the src_object again, which will hopefully - * call try_ui_update on it. - * - * optional force_open bool If force_open should be passed to ui_interact. + * Callback for handling incoming tgui messages. */ -/datum/tgui/proc/update(force_open = FALSE) - src_object.ui_interact(user, ui_key, src, force_open, master_ui, state) - -/** - * private - * - * Update the status/visibility of the UI for its user. - * - * optional push bool Push an update to the UI (an update is always sent for UI_DISABLED). - */ -/datum/tgui/proc/update_status(push = FALSE) - var/status = src_object.ui_status(user, state) - if(master_ui) - status = min(status, master_ui.status) - set_status(status, push) - if(status == UI_CLOSE) - close() - -/** - * private - * - * Set the status/visibility of the UI. - * - * required status int The status to set (UI_CLOSE/UI_DISABLED/UI_UPDATE/UI_INTERACTIVE). - * optional push bool Push an update to the UI (an update is always sent for UI_DISABLED). - */ -/datum/tgui/proc/set_status(status, push = FALSE) - // Only update if status has changed. - if(src.status != status) - if(src.status == UI_DISABLED) - src.status = status - if(push) - update() - else - src.status = status - // Update if the UI just because disabled, or a push is requested. - if(status == UI_DISABLED || push) - push_data(null, force = TRUE) - -/datum/tgui/proc/log_message(message) - log_tgui("[user] ([user.ckey]) using \"[title]\":\n[message]") +/datum/tgui/proc/on_message(type, list/payload, list/href_list) + // Pass act type messages to ui_act + if(type && copytext(type, 1, 5) == "act/") + process_status() + if(src_object.ui_act(copytext(type, 5), payload, src, state)) + SStgui.update_uis(src_object) + return FALSE + switch(type) + if("ready") + initialized = TRUE + if("pingReply") + initialized = TRUE + if("suspend") + close(can_be_suspended = TRUE) + if("close") + close(can_be_suspended = FALSE) + if("log") + if(href_list["fatal"]) + close(can_be_suspended = FALSE) + if("setSharedState") + LAZYINITLIST(src_object.tgui_shared_states) + src_object.tgui_shared_states[href_list["key"]] = href_list["value"] + SStgui.update_uis(src_object) diff --git a/code/modules/tgui/tgui_window.dm b/code/modules/tgui/tgui_window.dm new file mode 100644 index 00000000000..3d847c9c282 --- /dev/null +++ b/code/modules/tgui/tgui_window.dm @@ -0,0 +1,203 @@ +/** + * Copyright (c) 2020 Aleksej Komarov + * SPDX-License-Identifier: MIT + */ + +/datum/tgui_window + var/id + var/client/client + var/pooled + var/pool_index + var/status = TGUI_WINDOW_CLOSED + var/locked = FALSE + var/datum/tgui/locked_by + var/fatally_errored = FALSE + var/message_queue + +/** + * public + * + * Create a new tgui window. + * + * required client /client + * required id string A unique window identifier. + */ +/datum/tgui_window/New(client/client, id, pooled = FALSE) + src.id = id + src.client = client + src.pooled = pooled + if(pooled) + client.tgui_windows[id] = src + src.pool_index = TGUI_WINDOW_INDEX(id) + +/** + * public + * + * Initializes the window with a fresh page. Puts window into the "loading" + * state. You can begin sending messages right after initializing. Messages + * will be put into the queue until the window finishes loading. + */ +/datum/tgui_window/proc/initialize() + log_tgui(client, "[id]/initialize") + if(!client) + return + status = TGUI_WINDOW_LOADING + fatally_errored = FALSE + message_queue = null + // Build window options + var/options = "file=[id].html;can_minimize=0;auto_format=0;" + // Remove titlebar and resize handles for a fancy window + if(client.prefs.tgui_fancy) + options += "titlebar=0;can_resize=0;" + else + options += "titlebar=1;can_resize=1;" + // Generate page html + // TODO: Make this static + var/html = SStgui.basehtml + html = replacetextEx(html, "\[tgui:windowId]", id) + // Send required assets + var/datum/asset/asset + asset = get_asset_datum(/datum/asset/group/tgui) + asset.send(client) + // Open the window + client << browse(html, "window=[id];[options]") + // Instruct the client to signal UI when the window is closed. + winset(client, id, "on-close=\"uiclose [id]\"") + +/** + * public + * + * Checks if the window is ready to receive data. + * + * return bool + */ +/datum/tgui_window/proc/is_ready() + return status == TGUI_WINDOW_READY + +/** + * public + * + * Checks if the window can be sanely suspended. + * + * return bool + */ +/datum/tgui_window/proc/can_be_suspended() + return !fatally_errored \ + && pooled \ + && pool_index > 0 \ + && pool_index <= TGUI_WINDOW_SOFT_LIMIT \ + && status >= TGUI_WINDOW_READY + +/** + * public + * + * Acquire the window lock. Pool will not be able to provide this window + * to other UIs for the duration of the lock. + * + * Can be given an optional tgui datum, which will hook its on_message + * callback into the message stream. + * + * optional ui /datum/tgui + */ +/datum/tgui_window/proc/acquire_lock(datum/tgui/ui) + log_tgui(client, "[id]/acquire_lock") + locked = TRUE + locked_by = ui + +/** + * Release the window lock. + */ +/datum/tgui_window/proc/release_lock() + log_tgui(client, "[id]/release_lock") + locked = FALSE + locked_by = null + +/** + * public + * + * Close the UI. + * + * optional can_be_suspended bool + */ +/datum/tgui_window/proc/close(can_be_suspended = TRUE) + log_tgui(client, "[id]/close") + if(!client) + return + if(can_be_suspended && can_be_suspended()) + log_tgui(client, "suspending") + status = TGUI_WINDOW_READY + send_message("suspend") + return + locked = FALSE + locked_by = null + status = TGUI_WINDOW_CLOSED + message_queue = null + // Do not close the window to give user some time + // to read the error message. + if(!fatally_errored) + client << browse(null, "window=[id]") + +/** + * public + * + * Sends a message to tgui window. + * + * required type string Message type + * required payload list Message payload + * optional force bool Send regardless of the ready status. + */ +/datum/tgui_window/proc/send_message(type, list/payload, force) + if(!client) + return + var/message = json_encode(list( + "type" = type, + "payload" = payload, + )) + // Strip #255/improper. + message = replacetext(message, "\proper", "") + message = replacetext(message, "\improper", "") + // Pack for sending via output() + message = url_encode(message) + // Place into queue if window is still loading + if(!force && status == TGUI_WINDOW_LOADING) + if(!message_queue) + message_queue = list() + message_queue += list(message) + return + client << output(message, "[id].browser:update") + +/** + * private + * + * Sends queued messages if the queue wasn't empty. + */ +/datum/tgui_window/proc/flush_message_queue() + if(!client || !message_queue) + return + for(var/message in message_queue) + client << output(message, "[id].browser:update") + message_queue = null + +/** + * private + * + * Callback for handling incoming tgui messages. + */ +/datum/tgui_window/proc/on_message(type, list/payload, list/href_list) + switch(type) + if("ready") + status = TGUI_WINDOW_READY + if("log") + if(href_list["fatal"]) + fatally_errored = TRUE + // Pass message to UI that requested the lock + if(locked && locked_by) + locked_by.on_message(type, payload, href_list) + flush_message_queue() + return + // If not locked, handle these message types + switch(type) + if("suspend") + close(can_be_suspended = TRUE) + if("close") + close(can_be_suspended = FALSE) diff --git a/code/modules/vending/_vending.dm b/code/modules/vending/_vending.dm index 6e5e6a07068..f4fc524d0cb 100644 --- a/code/modules/vending/_vending.dm +++ b/code/modules/vending/_vending.dm @@ -691,16 +691,15 @@ GLOBAL_LIST_EMPTY(vending_products) return ..() -/obj/machinery/vending/ui_base_html(html) - var/datum/asset/spritesheet/assets = get_asset_datum(/datum/asset/spritesheet/vending) - . = replacetext(html, "", assets.css_tag()) +/obj/machinery/vending/ui_assets(mob/user) + return list( + get_asset_datum(/datum/asset/spritesheet/vending), + ) -/obj/machinery/vending/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) - ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) +/obj/machinery/vending/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - var/datum/asset/assets = get_asset_datum(/datum/asset/spritesheet/vending) - assets.send(user) - ui = new(user, src, ui_key, "Vending", ui_key, 450, 600, master_ui, state) + ui = new(user, src, "Vending") ui.open() /obj/machinery/vending/ui_static_data(mob/user) diff --git a/tgstation.dme b/tgstation.dme index 05c6ba0762d..2b029f2035e 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -3062,8 +3062,8 @@ #include "code\modules\tgs\includes.dm" #include "code\modules\tgui\external.dm" #include "code\modules\tgui\states.dm" -#include "code\modules\tgui\subsystem.dm" #include "code\modules\tgui\tgui.dm" +#include "code\modules\tgui\tgui_window.dm" #include "code\modules\tgui\states\admin.dm" #include "code\modules\tgui\states\always.dm" #include "code\modules\tgui\states\conscious.dm" diff --git a/tgui/.eslintrc.yml b/tgui/.eslintrc.yml index 67e74085c7e..9fd4db9fd2e 100644 --- a/tgui/.eslintrc.yml +++ b/tgui/.eslintrc.yml @@ -8,6 +8,8 @@ env: es6: true browser: true node: true +globals: + Byond: readonly plugins: - react settings: @@ -388,7 +390,7 @@ rules: ## Enforce a particular style for multiline comments # multiline-comment-style: error ## Enforce newlines between operands of ternary expressions - multiline-ternary: [error, always-multiline] + # multiline-ternary: [error, always-multiline] ## Require constructor names to begin with a capital letter # new-cap: error ## Enforce or disallow parentheses when invoking a constructor with no diff --git a/tgui/.gitattributes b/tgui/.gitattributes index 0016cc3bf67..9382416e69f 100644 --- a/tgui/.gitattributes +++ b/tgui/.gitattributes @@ -2,9 +2,18 @@ ## Enforce text mode and LF line breaks *.js text eol=lf +*.jsx text eol=lf +*.ts text eol=lf +*.tsx text eol=lf *.css text eol=lf +*.scss text eol=lf *.html text eol=lf *.json text eol=lf +*.yml text eol=lf +*.md text eol=lf +*.bat text eol=lf +yarn.lock text eol=lf +bin/tgui text eol=lf ## Treat bundles as binary and ignore them during conflicts *.bundle.* binary merge=tgui-merge-bundle diff --git a/tgui/README.md b/tgui/README.md index c4793247649..9eab0196de6 100644 --- a/tgui/README.md +++ b/tgui/README.md @@ -67,8 +67,9 @@ Run one of the following: game as you code it. Very useful, highly recommended. - In order to use it, you should start the game server first, connect to it and wait until the world has been properly loaded and you are no longer - in the lobby. Start tgui dev server. You'll know that it's hooked correctly - if data gets dumped to the log when tgui windows are opened. + in the lobby. Start tgui dev server, and once it has finished building, + press F5 on any tgui window. You'll know that it's hooked correctly if + you see a green bug icon in titlebar and data gets dumped to the console. - `bin/tgui --dev --reload` - reload byond cache once. - `bin/tgui --dev --debug` - run server with debug logging enabled. - `bin/tgui --dev --no-hot` - disable hot module replacement (helps when @@ -134,11 +135,11 @@ logs and time spent on rendering. Use this information to optimize your code, and try to keep re-renders below 16ms. **Kitchen Sink.** -Press `Ctrl+Alt+=` to open the KitchenSink interface. This interface is a +Press `F12` to open the KitchenSink interface. This interface is a playground to test various tgui components. **Layout Debugger.** -Press `Ctrl+Alt+-` to toggle the *layout debugger*. It will show outlines of +Press `F11` to toggle the *layout debugger*. It will show outlines of all tgui elements, which makes it easy to understand how everything comes together, and can reveal certain layout bugs which are not normally visible. diff --git a/tgui/bin/tgui b/tgui/bin/tgui index eb1f200b31e..97a86159e6b 100755 --- a/tgui/bin/tgui +++ b/tgui/bin/tgui @@ -52,6 +52,7 @@ task-dev-server() { task-eslint() { cd "${base_dir}" eslint ./packages "${@}" + echo "tgui: eslint check passed" } ## Mr. Proper @@ -153,6 +154,13 @@ if [[ ${1} == '--lint-harder' ]]; then exit 0 fi +if [[ ${1} == '--fix' ]]; then + shift 1 + task-install + task-eslint --fix "${@}" + exit 0 +fi + ## Analyze the bundle if [[ ${1} == '--analyze' ]]; then task-install diff --git a/tgui/docs/component-reference.md b/tgui/docs/component-reference.md index e1f7ebf9b43..549956738fa 100644 --- a/tgui/docs/component-reference.md +++ b/tgui/docs/component-reference.md @@ -279,7 +279,7 @@ Example (button):
- {type === 'button' &&
);
}
}
-
-const ButtonMock = () => (
-
-);
diff --git a/tgui/packages/tgui/components/Chart.js b/tgui/packages/tgui/components/Chart.js
index 16ed82c3559..77913779db8 100644
--- a/tgui/packages/tgui/components/Chart.js
+++ b/tgui/packages/tgui/components/Chart.js
@@ -7,7 +7,6 @@
import { map, zipWith } from 'common/collections';
import { pureComponentHooks } from 'common/react';
import { Component, createRef } from 'inferno';
-import { IS_IE8 } from '../byond';
import { Box } from './Box';
const normalizeData = (data, scale, rangeX, rangeY) => {
@@ -123,5 +122,5 @@ const Stub = props => null;
// IE8: No inline svg support
export const Chart = {
- Line: IS_IE8 ? Stub : LineChart,
+ Line: Byond.IS_LTE_IE8 ? Stub : LineChart,
};
diff --git a/tgui/packages/tgui/components/Flex.js b/tgui/packages/tgui/components/Flex.js
index 4ee69a1902a..02d2fac3148 100644
--- a/tgui/packages/tgui/components/Flex.js
+++ b/tgui/packages/tgui/components/Flex.js
@@ -5,7 +5,6 @@
*/
import { classes, pureComponentHooks } from 'common/react';
-import { IS_IE8 } from '../byond';
import { Box, unit } from './Box';
export const computeFlexProps = props => {
@@ -22,10 +21,10 @@ export const computeFlexProps = props => {
return {
className: classes([
'Flex',
- IS_IE8 && (
+ Byond.IS_LTE_IE10 && (
direction === 'column'
- ? 'Flex--ie8--column'
- : 'Flex--ie8'
+ ? 'Flex--iefix--column'
+ : 'Flex--iefix'
),
inline && 'Flex--inline',
spacing > 0 && 'Flex--spacing--' + spacing,
@@ -63,7 +62,7 @@ export const computeFlexItemProps = props => {
return {
className: classes([
'Flex__item',
- IS_IE8 && 'Flex__item--ie8',
+ Byond.IS_LTE_IE10 && 'Flex__item--iefix',
className,
]),
style: {
diff --git a/tgui/packages/tgui/components/Knob.js b/tgui/packages/tgui/components/Knob.js
index e72b15f1959..4861e71bf3e 100644
--- a/tgui/packages/tgui/components/Knob.js
+++ b/tgui/packages/tgui/components/Knob.js
@@ -6,7 +6,6 @@
import { keyOfMatchingRange, scale } from 'common/math';
import { classes } from 'common/react';
-import { IS_IE8 } from '../byond';
import { computeBoxClassName, computeBoxProps } from './Box';
import { DraggableControl } from './DraggableControl';
import { NumberInput } from './NumberInput';
@@ -14,7 +13,7 @@ import { NumberInput } from './NumberInput';
export const Knob = props => {
// IE8: I don't want to support a yet another component on IE8.
// IE8: It also can't handle SVG.
- if (IS_IE8) {
+ if (Byond.IS_LTE_IE8) {
return (
+ unselectable={Byond.IS_LTE_IE8}>
{value + (unit ? ' ' + unit : '')}
);
diff --git a/tgui/packages/tgui/components/Section.js b/tgui/packages/tgui/components/Section.js
index 2f9fa239b18..af59bc40223 100644
--- a/tgui/packages/tgui/components/Section.js
+++ b/tgui/packages/tgui/components/Section.js
@@ -5,7 +5,7 @@
*/
import { classes, isFalsy, pureComponentHooks } from 'common/react';
-import { Box } from './Box';
+import { computeBoxClassName, computeBoxProps } from './Box';
export const Section = props => {
const {
@@ -13,20 +13,22 @@ export const Section = props => {
title,
level = 1,
buttons,
- content,
+ fill,
children,
...rest
} = props;
const hasTitle = !isFalsy(title) || !isFalsy(buttons);
- const hasContent = !isFalsy(content) || !isFalsy(children);
+ const hasContent = !isFalsy(children);
return (
-
@@ -39,11 +41,10 @@ export const Section = props => {
)}
{hasContent && (
);
};
diff --git a/tgui/packages/tgui/components/Slider.js b/tgui/packages/tgui/components/Slider.js
index 7ae74684fbb..005e6c1f8f7 100644
--- a/tgui/packages/tgui/components/Slider.js
+++ b/tgui/packages/tgui/components/Slider.js
@@ -6,14 +6,13 @@
import { clamp01, keyOfMatchingRange, scale } from 'common/math';
import { classes } from 'common/react';
-import { IS_IE8 } from '../byond';
import { computeBoxClassName, computeBoxProps } from './Box';
import { DraggableControl } from './DraggableControl';
import { NumberInput } from './NumberInput';
export const Slider = props => {
// IE8: I don't want to support a yet another component on IE8.
- if (IS_IE8) {
+ if (Byond.IS_LTE_IE8) {
return (
- {content}
{children}
)}
-
+ - {COLORS_ARBITRARY.map(color => ( + {COLORS_SPECTRUM.map(color => ( ))} - {COLORS_ARBITRARY.map(color => ( + {COLORS_SPECTRUM.map(color => ( -+ ++ |