TGUI Fix verb, TGUI AI state fix, TGUI focus fix

This commit is contained in:
ShadowLarkens
2020-09-16 19:54:54 -07:00
parent 44f65e2602
commit ef846b5807
4 changed files with 75 additions and 17 deletions
+12 -5
View File
@@ -133,13 +133,19 @@
*
* optional can_be_suspended bool
*/
/datum/tgui_window/proc/close(can_be_suspended = TRUE)
/datum/tgui_window/proc/close(can_be_suspended = TRUE, logout = FALSE)
if(!client)
return
if(can_be_suspended && can_be_suspended())
log_tgui(client, "[id]/close: suspending")
status = TGUI_WINDOW_READY
send_message("suspend")
// You would think that BYOND would null out client or make it stop passing istypes or, y'know, ANYTHING during
// logout, but nope! It appears to be perfectly valid to call winset by every means we can measure in Logout,
// and yet it causes a bad client runtime. To avoid that happening, we just have to know if we're in Logout or
// not.
if(!logout && client)
winset(client, null, "mapwindow.map.focus=true")
return
log_tgui(client, "[id]/close")
release_lock()
@@ -149,7 +155,8 @@
// to read the error message.
if(!fatally_errored)
client << browse(null, "window=[id]")
if(!logout && client)
winset(client, null, "mapwindow.map.focus=true")
/**
* public
*
@@ -189,9 +196,9 @@
/datum/tgui_window/proc/send_asset(datum/asset/asset)
if(!client || !asset)
return
// if(istype(asset, /datum/asset/spritesheet))
// var/datum/asset/spritesheet/spritesheet = asset
// send_message("asset/stylesheet", spritesheet.css_filename())
if(istype(asset, /datum/asset/spritesheet))
var/datum/asset/spritesheet/spritesheet = asset
send_message("asset/stylesheet", spritesheet.css_filename())
send_message("asset/mappings", asset.get_url_mappings())
sent_assets += list(asset)
asset.send(client)