From af1abcd81db0f12ada4da7f058485f1ea62b854d Mon Sep 17 00:00:00 2001 From: LT3 <83487515+lessthnthree@users.noreply.github.com> Date: Fri, 18 Apr 2025 15:00:32 -0700 Subject: [PATCH] Preference menu buttons are disabled until subsystem initializes (#90685) --- code/_onclick/hud/new_player.dm | 40 ++++++++++++++++++++++++++-- code/controllers/subsystem.dm | 2 +- code/modules/client/preferences.dm | 4 +++ icons/hud/lobby/character_setup.dmi | Bin 1465 -> 3323 bytes 4 files changed, 43 insertions(+), 3 deletions(-) diff --git a/code/_onclick/hud/new_player.dm b/code/_onclick/hud/new_player.dm index 04342f4267c..438a71619ca 100644 --- a/code/_onclick/hud/new_player.dm +++ b/code/_onclick/hud/new_player.dm @@ -201,8 +201,20 @@ name = "View Character Setup" screen_loc = "TOP:-70,CENTER:-54" icon = 'icons/hud/lobby/character_setup.dmi' - icon_state = "character_setup" + icon_state = "character_setup_disabled" base_icon_state = "character_setup" + enabled = FALSE + +/atom/movable/screen/lobby/button/character_setup/Initialize(mapload, datum/hud/hud_owner) + . = ..() + // We need IconForge and the assets to be ready before allowing the menu to open + if(SSearly_assets.initialized == INITIALIZATION_INNEW_REGULAR || SSatoms.initialized == INITIALIZATION_INNEW_REGULAR) + flick("[base_icon_state]_enabled", src) + set_button_status(TRUE) + else + set_button_status(FALSE) + RegisterSignal(SSearly_assets, COMSIG_SUBSYSTEM_POST_INITIALIZE, PROC_REF(enable_character_setup)) + RegisterSignal(SSatoms, COMSIG_SUBSYSTEM_POST_INITIALIZE, PROC_REF(enable_character_setup)) /atom/movable/screen/lobby/button/character_setup/Click(location, control, params) . = ..() @@ -214,6 +226,13 @@ preferences.update_static_data(usr) preferences.ui_interact(usr) +/atom/movable/screen/lobby/button/character_setup/proc/enable_character_setup() + SIGNAL_HANDLER + flick("[base_icon_state]_enabled", src) + set_button_status(TRUE) + UnregisterSignal(SSearly_assets, COMSIG_SUBSYSTEM_POST_INITIALIZE) + UnregisterSignal(SSatoms, COMSIG_SUBSYSTEM_POST_INITIALIZE) + ///Button that appears before the game has started /atom/movable/screen/lobby/button/ready name = "Toggle Readiness" @@ -373,9 +392,20 @@ /atom/movable/screen/lobby/button/bottom/settings name = "View Game Preferences" - icon_state = "settings" + icon_state = "settings_disabled" base_icon_state = "settings" screen_loc = "TOP:-122,CENTER:+29" + enabled = FALSE + +/atom/movable/screen/lobby/button/bottom/settings/Initialize(mapload, datum/hud/hud_owner) + . = ..() + // We need IconForge and the assets to be ready before allowing the menu to open + if(SSearly_assets.initialized == INITIALIZATION_INNEW_REGULAR || SSatoms.initialized == INITIALIZATION_INNEW_REGULAR) + set_button_status(TRUE) + else + set_button_status(FALSE) + RegisterSignal(SSearly_assets, COMSIG_SUBSYSTEM_POST_INITIALIZE, PROC_REF(enable_settings)) + RegisterSignal(SSatoms, COMSIG_SUBSYSTEM_POST_INITIALIZE, PROC_REF(enable_settings)) /atom/movable/screen/lobby/button/bottom/settings/Click(location, control, params) . = ..() @@ -387,6 +417,12 @@ preferences.update_static_data(usr) preferences.ui_interact(usr) +/atom/movable/screen/lobby/button/bottom/settings/proc/enable_settings() + SIGNAL_HANDLER + set_button_status(TRUE) + UnregisterSignal(SSearly_assets, COMSIG_SUBSYSTEM_POST_INITIALIZE) + UnregisterSignal(SSatoms, COMSIG_SUBSYSTEM_POST_INITIALIZE) + /atom/movable/screen/lobby/button/bottom/changelog_button name = "View Changelog" icon_state = "changelog" diff --git a/code/controllers/subsystem.dm b/code/controllers/subsystem.dm index 0dbe2af2f8b..02f45a54150 100644 --- a/code/controllers/subsystem.dm +++ b/code/controllers/subsystem.dm @@ -40,7 +40,7 @@ /// Which stage does this subsystem init at. Earlier stages can fire while later stages init. var/init_stage = INITSTAGE_MAIN - /// This var is set to TRUE after the subsystem has been initialized. + /// This var is set to `INITIALIZATION_INNEW_REGULAR` after the subsystem has been initialized. var/initialized = FALSE /// Set to 0 to prevent fire() calls, mostly for admin use or subsystems that may be resumed later diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 173a06b677d..135dd8a0297 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -143,6 +143,10 @@ GLOBAL_LIST_EMPTY(preferences_datums) // I'm making the assumption that ui close will be called whenever a user logs out, or loses a window // If this isn't the case, kill me and restore the code, thanks + // We need IconForge and the assets to be ready before allowing the menu to open + if(SSearly_assets.initialized != INITIALIZATION_INNEW_REGULAR) + return + ui = SStgui.try_update_ui(user, src, ui) if(!ui) character_preview_view = create_character_preview_view(user) diff --git a/icons/hud/lobby/character_setup.dmi b/icons/hud/lobby/character_setup.dmi index d3b94fb43e95008d3b03c1e651ff9cd03e493561..a5f15dcd14669167ae1ae90b98cd937269c1143c 100644 GIT binary patch literal 3323 zcmb7H2{@Gd8W*M*YUavXNcXmkEt$x^4P#$stb?-e6&m6&4h<%ykQz?eGRWA9LK9gY)5iXty@lT2L%Z>NZHME$Rde7l-l$2DI=R?$bdAt*MfY3bks03~I z6d;*xvCfVz0;aR?LI9#I(G?SG5gZeU4UdiukBSr!_@yW>_c1ut6ndeb>U59g_G~C~ z*GYsZWF36JM{Jh*wuDA^0d#U@UW)X`=2Hvgi{m*>BO_TUb+Sb33y7$NWHcuy9cyNiH|<7 zJL5ehS(kJLUVt|}>=XyzynGF5)3zb0S^dW37Sf)zKw@J|vP&~`{ zi~&+WK+Mm^!p!xTB6cyvW3or0vom+cC8Z~&s^#>T`ccfKVGeJbZ$WnPf(hOovB1T0 zasxACyT@HUq12YpyLS&kTj4_&8d?Pz(;H%`hcGbfg&}OYl7_k|%$lt>1Xnnz!<(;$ z?#iq=WJU;S9B!-m5W$qU?>nollk=-m{|$4U-a?6&^=#dQ#nf+AOtAJ`q|A$%$u~X= zarYi-L%y0nlZ#Iap zJ6^S%O?`AlA4M9S`L+DE!}R3$WPiouwUaL=eXcB5rmtj4GtbK0KsT@#$(?pVG_TjQ znqn>|y625$-_Z}#T) ztZvW{4j)%f?d_R@v1a>gL%1XDy*JUL=Zqkg^450OsTo$eJsB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