Preference menu buttons are disabled until subsystem initializes (#90685)

This commit is contained in:
LT3
2025-04-18 15:00:32 -07:00
committed by GitHub
parent 879d3b068b
commit 40f644d6d4
4 changed files with 43 additions and 3 deletions

View File

@@ -200,8 +200,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)
. = ..()
@@ -213,6 +225,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"

View File

@@ -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

View File

@@ -135,6 +135,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)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB