Permalink
Browse files

SStgui

Recompute the globals

Updated globals.

tgui uses QDELETED
  • Loading branch information...
afterthought2 committed Jun 30, 2018
1 parent 610bd97 commit 345274d762cc66285c019debefa596ef476e2fc5
@@ -154,7 +154,6 @@
#include "code\controllers\evacuation\evacuation_shuttle.dm"
#include "code\controllers\evacuation\~evac.dm"
#include "code\controllers\Processes\nanoui.dm"
#include "code\controllers\Processes\tgui.dm"
#include "code\controllers\Processes\ticker.dm"
#include "code\controllers\Processes\vote.dm"
#include "code\controllers\ProcessScheduler\core\process.dm"
@@ -178,6 +177,7 @@
#include "code\controllers\subsystems\skybox.dm"
#include "code\controllers\subsystems\sun.dm"
#include "code\controllers\subsystems\supply.dm"
#include "code\controllers\subsystems\tgui.dm"
#include "code\controllers\subsystems\timer.dm"
#include "code\controllers\subsystems\trade.dm"
#include "code\controllers\subsystems\wireless.dm"
@@ -2457,7 +2457,6 @@
#include "code\modules\tables\tables.dm"
#include "code\modules\tables\update_triggers.dm"
#include "code\modules\tgui\external.dm"
#include "code\modules\tgui\process.dm"
#include "code\modules\tgui\states.dm"
#include "code\modules\tgui\tgui.dm"
#include "code\modules\tgui\states\admin.dm"
@@ -26,6 +26,7 @@
#define SS_PRIORITY_PROCESSING 30 // Generic datum processor. Replaces objects processor.
#define SS_PRIORITY_GARBAGE 25 // Garbage collection.
#define SS_PRIORITY_VINES 25 // Spreading vine effects.
#define SS_PRIORITY_TGUI 20 // Updates to tgui uis.
#define SS_PRIORITY_TURF 20 // Radioactive walls/blob.
#define SS_PRIORITY_EVAC 20 // Processes the evac controller.
#define SS_PRIORITY_WIRELESS 10 // Wireless connection setup.
@@ -83,6 +83,8 @@
return global.SSsun;
if("SSsupply")
return global.SSsupply;
if("SStgui")
return global.SStgui;
if("SStimer")
return global.SStimer;
if("SStrade")
@@ -679,8 +681,6 @@
return global.plant_seed_sprites;
if("playable_species")
return global.playable_species;
if("point_source_descriptions")
return global.point_source_descriptions;
if("possible_changeling_IDs")
return global.possible_changeling_IDs;
if("power_alarm")
@@ -907,8 +907,6 @@
return global.tg_self_state;
if("tg_z_state")
return global.tg_z_state;
if("tgui_process")
return global.tgui_process;
if("ticker")
return global.ticker;
if("tickerProcess")
@@ -1072,6 +1070,8 @@
global.SSsun=newval;
if("SSsupply")
global.SSsupply=newval;
if("SStgui")
global.SStgui=newval;
if("SStimer")
global.SStimer=newval;
if("SStrade")
@@ -1668,8 +1668,6 @@
global.plant_seed_sprites=newval;
if("playable_species")
global.playable_species=newval;
if("point_source_descriptions")
global.point_source_descriptions=newval;
if("possible_changeling_IDs")
global.possible_changeling_IDs=newval;
if("power_alarm")
@@ -1896,8 +1894,6 @@
global.tg_self_state=newval;
if("tg_z_state")
global.tg_z_state=newval;
if("tgui_process")
global.tgui_process=newval;
if("ticker")
global.ticker=newval;
if("tickerProcess")
@@ -2019,6 +2015,7 @@
"SSskybox",
"SSsun",
"SSsupply",
"SStgui",
"SStimer",
"SStrade",
"SSturf",
@@ -2317,7 +2314,6 @@
"plant_controller",
"plant_seed_sprites",
"playable_species",
"point_source_descriptions",
"possible_changeling_IDs",
"power_alarm",
"powerinstances",
@@ -2431,7 +2427,6 @@
"tg_physical_state",
"tg_self_state",
"tg_z_state",
"tgui_process",
"ticker",
"tickerProcess",
"ticket_panels",

This file was deleted.

Oops, something went wrong.
@@ -1,5 +1,48 @@
SUBSYSTEM_DEF(tgui)
name = "tgui"
priority = SS_PRIORITY_TGUI
wait = 1 SECOND
flags = SS_BACKGROUND|SS_POST_FIRE_TIMING

var/basehtml // The HTML base used for all UIs.
var/list/tg_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/tmp/list/current_run = list()

/datum/controller/subsystem/tgui/Initialize()
. = ..()
basehtml = file2text('tgui/tgui.html')

/datum/controller/subsystem/tgui/fire(resumed = 0)
if (!resumed)
src.current_run = processing_uis.Copy()

var/list/current_run = src.current_run

while(current_run.len)
var/datum/tgui/ui = current_run[current_run.len]
current_run.len--

if(QDELETED(ui) || QDELETED(ui.user) || QDELETED(ui.src_object))
processing_uis -= ui
if (MC_TICK_CHECK)
return
continue

ui.process() //not forced
if (MC_TICK_CHECK)
return

/datum/controller/subsystem/tgui/stat_entry()
..("UI:[tg_open_uis.len], P:[processing_uis.len]")

/datum/controller/subsystem/tgui/VV_hidden()
. = ..()
. += list("basehtml")

/**
* tgui process
* tgui subsystem
*
* Contains all tgui state and process code.
**/
@@ -17,7 +60,7 @@
*
* return datum/tgui The found UI.
**/
/datum/controller/process/tgui/proc/try_update_ui(mob/user, datum/src_object, ui_key, datum/tgui/ui, force_open = 0)
/datum/controller/subsystem/tgui/proc/try_update_ui(mob/user, datum/src_object, ui_key, datum/tgui/ui, force_open = 0)
if(isnull(ui)) // No UI was passed, so look for one.
ui = get_open_ui(user, src_object, ui_key)

@@ -42,7 +85,7 @@
*
* return datum/tgui The found UI.
**/
/datum/controller/process/tgui/proc/get_open_ui(mob/user, datum/src_object, ui_key)
/datum/controller/subsystem/tgui/proc/get_open_ui(mob/user, datum/src_object, ui_key)
var/src_object_key = "\ref[src_object]"
if(isnull(tg_open_uis[src_object_key]) || !istype(tg_open_uis[src_object_key], /list))
return null // No UIs open.
@@ -64,7 +107,7 @@
*
* return int The number of UIs updated.
**/
/datum/controller/process/tgui/proc/update_uis(datum/src_object)
/datum/controller/subsystem/tgui/proc/update_uis(datum/src_object)
var/src_object_key = "\ref[src_object]"
if(isnull(tg_open_uis[src_object_key]) || !istype(tg_open_uis[src_object_key], /list))
return 0 // Couldn't find any UIs for this object.
@@ -86,7 +129,7 @@
*
* return int The number of UIs closed.
**/
/datum/controller/process/tgui/proc/close_uis(datum/src_object)
/datum/controller/subsystem/tgui/proc/close_uis(datum/src_object)
var/src_object_key = "\ref[src_object]"
if(isnull(tg_open_uis[src_object_key]) || !istype(tg_open_uis[src_object_key], /list))
return 0 // Couldn't find any UIs for this object.
@@ -110,7 +153,7 @@
*
* return int The number of UIs updated.
**/
/datum/controller/process/tgui/proc/update_user_uis(mob/user, datum/src_object = null, ui_key = null)
/datum/controller/subsystem/tgui/proc/update_user_uis(mob/user, datum/src_object = null, ui_key = null)
if(isnull(user.tg_open_uis) || !istype(user.tg_open_uis, /list) || tg_open_uis.len == 0)
return 0 // Couldn't find any UIs for this user.

@@ -132,7 +175,7 @@
*
* return int The number of UIs closed.
**/
/datum/controller/process/tgui/proc/close_user_uis(mob/user, datum/src_object = null, ui_key = null)
/datum/controller/subsystem/tgui/proc/close_user_uis(mob/user, datum/src_object = null, ui_key = null)
if(isnull(user.tg_open_uis) || !istype(user.tg_open_uis, /list) || tg_open_uis.len == 0)
return 0 // Couldn't find any UIs for this user.

@@ -150,7 +193,7 @@
*
* required ui datum/tgui The UI to be added.
**/
/datum/controller/process/tgui/proc/on_open(datum/tgui/ui)
/datum/controller/subsystem/tgui/proc/on_open(datum/tgui/ui)
var/src_object_key = "\ref[ui.src_object]"
if(isnull(tg_open_uis[src_object_key]) || !istype(tg_open_uis[src_object_key], /list))
tg_open_uis[src_object_key] = list(ui.ui_key = list()) // Make a list for the ui_key and src_object.
@@ -172,7 +215,7 @@
*
* return bool If the UI was removed or not.
**/
/datum/controller/process/tgui/proc/on_close(datum/tgui/ui)
/datum/controller/subsystem/tgui/proc/on_close(datum/tgui/ui)
var/src_object_key = "\ref[ui.src_object]"
if(isnull(tg_open_uis[src_object_key]) || !istype(tg_open_uis[src_object_key], /list))
return 0 // It wasn't open.
@@ -202,7 +245,7 @@
*
* return int The number of UIs closed.
**/
/datum/controller/process/tgui/proc/on_logout(mob/user)
/datum/controller/subsystem/tgui/proc/on_logout(mob/user)
return close_user_uis(user)

/**
@@ -215,7 +258,7 @@
*
* return bool If the UIs were transferred.
**/
/datum/controller/process/tgui/proc/on_transfer(mob/source, mob/target)
/datum/controller/subsystem/tgui/proc/on_transfer(mob/source, mob/target)
if(!source || isnull(source.tg_open_uis) || !istype(source.tg_open_uis, /list) || tg_open_uis.len == 0)
return 0 // The old mob had no open UIs.

@@ -30,7 +30,7 @@
/obj/item/weapon/airlock_electronics/tg_ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, \
datum/tgui/master_ui = null, datum/ui_state/state = tg_hands_state)

tgui_process.try_update_ui(user, src, ui_key, ui, force_open)
SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "airlock_electronics", src.name, 1000, 500, master_ui, state)
ui.open()
@@ -114,7 +114,7 @@
lockable = 0

/obj/item/weapon/airlock_electronics/brace/tg_ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = tg_deep_inventory_state)
tgui_process.try_update_ui(user, src, ui_key, ui, force_open)
SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "airlock_electronics", src.name, 1000, 500, master_ui, state)
ui.open()
@@ -200,7 +200,7 @@


/obj/machinery/door_timer/tg_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 = tgui_process.try_update_ui(user, src, ui_key, ui, force_open)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "brig_timer", name , 300, 150, master_ui, state)
ui.open()
@@ -106,7 +106,7 @@ datum/track/proc/GetTrack()
return ..()

/obj/machinery/media/jukebox/tg_ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = tg_default_state)
ui = tgui_process.try_update_ui(user, src, ui_key, ui, force_open)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "jukebox", "Your Media Library", 340, 440, master_ui, state)
ui.open()
@@ -109,7 +109,7 @@ obj/machinery/resleever/Process()


/obj/machinery/resleever/tg_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 = tgui_process.try_update_ui(user, src, ui_key, ui, force_open)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "resleever", "Neural Lace Resleever", 300, 300, master_ui, state)
ui.open()
@@ -119,7 +119,7 @@ obj/item/device/suit_sensor_jammer/ui_status(mob/user, datum/ui_state/state)
return ..()

obj/item/device/suit_sensor_jammer/tg_ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = tg_default_state)
ui = tgui_process.try_update_ui(user, src, ui_key, ui, force_open)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "suit_sensor_jammer", "Sensor Jammer", 350, 610, master_ui, state)
ui.open()
@@ -11,7 +11,7 @@
tg_ui_interact(user)

/datum/storage_ui/tgui/close_all()
tgui_process.close_uis(src)
SStgui.close_uis(src)

/datum/storage_ui/tgui/on_open(var/mob/user)
tg_ui_interact(user)
@@ -25,7 +25,7 @@
tg_ui_interact(user)

/datum/storage_ui/tgui/tg_ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = tg_physical_state)
ui = tgui_process.try_update_ui(user, src, ui_key, ui, force_open)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "storage", storage.name, 340, 440, master_ui, state)
ui.open()
@@ -35,7 +35,7 @@

var/list/items_by_name_and_type = list()
for(var/obj/item/W in storage)
group_by(items_by_name_and_type, "[W.name]§[W.type]", W)
group_by(items_by_name_and_type, "[W.name][W.type]", W)

var/list/item_list = list()
for(var/name_and_type in items_by_name_and_type)
@@ -211,7 +211,7 @@
tg_ui_interact(user)

/obj/item/integrated_circuit/logic/unary/access_verifier/tg_ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = tg_hands_state)
tgui_process.try_update_ui(user, src, ui_key, ui, force_open)
SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "airlock_electronics", src.name, 1000, 500, master_ui, state)
ui.open()
@@ -1,6 +1,6 @@
/mob/Logout()
GLOB.nanomanager.user_logout(src) // this is used to clean up (remove) this user's Nano UIs
tgui_process && tgui_process.on_logout(src)
SStgui && SStgui.on_logout(src)
GLOB.player_list -= src
log_access("Logout: [key_name(src)]")
handle_admin_logout()
Oops, something went wrong.

0 comments on commit 345274d

Please sign in to comment.