actual tgui code
This commit is contained in:
@@ -130,6 +130,13 @@
|
||||
*/
|
||||
/client/var/list/tgui_windows = list()
|
||||
|
||||
/**
|
||||
* global
|
||||
*
|
||||
* TRUE if cache was reloaded by tgui dev server at least once.
|
||||
*/
|
||||
/client/var/tgui_cache_reloaded = FALSE
|
||||
|
||||
/**
|
||||
* public
|
||||
*
|
||||
@@ -159,16 +166,29 @@
|
||||
/**
|
||||
* Middleware for /client/Topic.
|
||||
*
|
||||
* return bool Whether the topic is passed (TRUE), or cancelled (FALSE).
|
||||
* return bool If TRUE, prevents propagation of the topic call.
|
||||
*/
|
||||
/proc/tgui_Topic(href_list)
|
||||
// Skip non-tgui topics
|
||||
if(!href_list["tgui"])
|
||||
return TRUE
|
||||
return FALSE
|
||||
var/type = href_list["type"]
|
||||
// Unconditionally collect tgui logs
|
||||
if(type == "log")
|
||||
log_tgui(usr, href_list["message"])
|
||||
// Reload all tgui windows
|
||||
if(type == "cacheReloaded")
|
||||
if(!check_rights(R_ADMIN) || usr.client.tgui_cache_reloaded)
|
||||
return TRUE
|
||||
// Mark as reloaded
|
||||
usr.client.tgui_cache_reloaded = TRUE
|
||||
// Notify windows
|
||||
var/list/windows = usr.client.tgui_windows
|
||||
for(var/window_id in windows)
|
||||
var/datum/tgui_window/window = windows[window_id]
|
||||
if (window.status == TGUI_WINDOW_READY)
|
||||
window.on_message(type, null, href_list)
|
||||
return TRUE
|
||||
// Locate window
|
||||
var/window_id = href_list["window_id"]
|
||||
var/datum/tgui_window/window
|
||||
@@ -177,7 +197,7 @@
|
||||
if(!window)
|
||||
log_tgui(usr, "Error: Couldn't find the window datum, force closing.")
|
||||
SStgui.force_close_window(usr, window_id)
|
||||
return FALSE
|
||||
return TRUE
|
||||
// Decode payload
|
||||
var/payload
|
||||
if(href_list["payload"])
|
||||
@@ -185,4 +205,4 @@
|
||||
// Pass message to window
|
||||
if(window)
|
||||
window.on_message(type, payload, href_list)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
Reference in New Issue
Block a user