Fix TGUI latejoin menu not closing properly, properly this time (#71883)

## About The Pull Request
Fixes issue in #71868

TGUI latejoin window stayed open because of an erroneous `isnewplayer`
check in the latejoin's `ui_interact` which blocked `try_update_ui` from
being called, therefore not letting the UI update its status.

also fixes dreamchecker warnings in latejoin menu code

## Why It's Good For The Game
bgug fix

## Changelog
No playerfacing changes.
This commit is contained in:
distributivgesetz
2022-12-10 16:03:26 +02:00
committed by GitHub
parent 0c1b323765
commit 52461de714
@@ -23,9 +23,6 @@ GLOBAL_DATUM_INIT(latejoin_menu, /datum/latejoin_menu, new)
user.jobs_menu_mounted = TRUE // Don't flood a user's chat if they open and close the UI.
/datum/latejoin_menu/ui_interact(mob/dead/new_player/user, datum/tgui/ui)
if(!istype(user))
return
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
// In case they reopen the GUI
@@ -51,7 +48,7 @@ GLOBAL_DATUM_INIT(latejoin_menu, /datum/latejoin_menu, new)
switch(SSshuttle.emergency.mode)
if(SHUTTLE_ESCAPE)
data["shuttle_status"] = "The station has been evacuated."
if(SHUTTLE_CALL || SHUTTLE_DOCKED || SHUTTLE_IGNITING || SHUTTLE_ESCAPE)
if(SHUTTLE_CALL, SHUTTLE_DOCKED, SHUTTLE_IGNITING, SHUTTLE_ESCAPE)
if(!SSshuttle.canRecall())
data["shuttle_status"] = "The station is currently undergoing evacuation procedures."
@@ -114,8 +111,9 @@ GLOBAL_DATUM_INIT(latejoin_menu, /datum/latejoin_menu, new)
return list("departments_static" = departments)
/datum/latejoin_menu/ui_state(mob/user)
return GLOB.new_player_state
// we can't use GLOB.new_player_state here since it also allows any admin to see the ui, which will cause runtimes
/datum/latejoin_menu/ui_status(mob/user)
return isnewplayer(user) ? UI_INTERACTIVE : UI_CLOSE
/datum/latejoin_menu/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()
@@ -158,9 +156,9 @@ GLOBAL_DATUM_INIT(latejoin_menu, /datum/latejoin_menu, new)
tgui_alert(owner, "The server is full!", "Oh No!")
return TRUE
SStgui.close_user_uis(owner, src) // Bandaid fix cause ui_state doesn't react properly to spawning in.
// SAFETY: AttemptLateSpawn has it's own sanity checks. This is perfectly safe.
owner.AttemptLateSpawn(params["job"])
return TRUE
if("viewpoll")