Fix FPS and other preferences not properly applying after reconnect (#61542)

Fixes #61515. Preferences were only applied on load_preferences(), which only fires when the preferences datum is created. Preferences datums are cached, and so load_preferences is only called the once.
This commit is contained in:
Mothblocks
2021-09-19 12:15:47 -07:00
committed by GitHub
parent cc991d6860
commit cde482bb24
3 changed files with 11 additions and 6 deletions
+1
View File
@@ -238,6 +238,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
prefs = GLOB.preferences_datums[ckey]
if(prefs)
prefs.parent = src
prefs.apply_all_client_preferences()
else
prefs = new /datum/preferences(src)
GLOB.preferences_datums[ckey] = prefs
+9
View File
@@ -329,6 +329,15 @@ GLOBAL_LIST_EMPTY(preferences_datums)
return preferences
/// Applies all PREFERENCE_PLAYER preferences
/datum/preferences/proc/apply_all_client_preferences()
for (var/datum/preference/preference as anything in get_preferences_in_priority_order())
if (preference.savefile_identifier != PREFERENCE_PLAYER)
continue
value_cache -= preference.type
preference.apply_to_client(parent, read_preference(preference.type))
// This is necessary because you can open the set preferences menu before
// the atoms SS is done loading.
INITIALIZE_IMMEDIATE(/atom/movable/screen/character_preview_view)
+1 -6
View File
@@ -163,12 +163,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
fcopy(S, bacpath) //byond helpfully lets you use a savefile for the first arg.
return FALSE
for (var/datum/preference/preference as anything in get_preferences_in_priority_order())
if (preference.savefile_identifier != PREFERENCE_PLAYER)
continue
value_cache -= preference.type
preference.apply_to_client(parent, read_preference(preference.type))
apply_all_client_preferences()
//general preferences
READ_FILE(S["lastchangelog"], lastchangelog)