From 044cae07d1f76c9f868553b7fdb6a0b77c82f1ce Mon Sep 17 00:00:00 2001
From: Bloop <13398309+vinylspiders@users.noreply.github.com>
Date: Mon, 6 Jul 2026 01:56:48 -0400
Subject: [PATCH] Fixes character slots not updating (#96808)
## About The Pull Request
Moves `"character_profiles"` out of `ui_static_data()`. We already have
the `tainted_character_profiles` to prevent unnecessary updates, and
this data is not static.
Before, button doesn't update
After
Deletion is functional and updates as well
Quirks update when switching slots
## Why It's Good For The Game
Fixes a bug/oversight
## Changelog
:cl:
fix: in prefs menu, changing your character name will now update your
slot button correctly
fix: fixes an issue where switching slots would carry over the quirks of
a previous slot until you add or remove a quirk
/:cl:
---
code/modules/client/preferences.dm | 3 +--
code/modules/client/preferences/middleware/quirks.dm | 1 +
code/modules/client/preferences_savefile.dm | 9 +++++++++
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm
index e1d644bb000..59313dee4ab 100644
--- a/code/modules/client/preferences.dm
+++ b/code/modules/client/preferences.dm
@@ -146,6 +146,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
+ tainted_character_profiles = TRUE
character_preview_view = create_character_preview_view(user)
ui = new(user, src, "PreferencesMenu")
ui.set_autoupdate(FALSE)
@@ -179,8 +180,6 @@ GLOBAL_LIST_EMPTY(preferences_datums)
/datum/preferences/ui_static_data(mob/user)
var/list/data = list()
- data["character_profiles"] = create_character_profiles()
-
data["character_preview_view"] = character_preview_view.assigned_map
data["overflow_role"] = SSjob.get_job_type(SSjob.overflow_role).title
data["window"] = current_window
diff --git a/code/modules/client/preferences/middleware/quirks.dm b/code/modules/client/preferences/middleware/quirks.dm
index 6705b0262c2..f950db61564 100644
--- a/code/modules/client/preferences/middleware/quirks.dm
+++ b/code/modules/client/preferences/middleware/quirks.dm
@@ -96,6 +96,7 @@
/datum/preference_middleware/quirks/on_new_character(mob/user)
tainted = TRUE
+ preferences.update_static_data(user, always_instant = TRUE)
/datum/preference_middleware/quirks/proc/give_quirk(list/params, mob/user)
var/quirk_name = params["quirk"]
diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm
index 6dd20be22f5..639ba4afea6 100644
--- a/code/modules/client/preferences_savefile.dm
+++ b/code/modules/client/preferences_savefile.dm
@@ -348,6 +348,13 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
var/tree_key = "character[slot]"
var/list/save_data = savefile.get_entry(tree_key)
+ if(isnull(save_data))
+ for (var/datum/preference/preference as anything in get_preferences_in_priority_order())
+ if (preference.savefile_identifier != PREFERENCE_CHARACTER)
+ continue
+ value_cache -= preference.type
+ return FALSE
+
var/data_validity_integer = check_savedata_version(save_data)
if(IS_DATA_OBSOLETE(data_validity_integer)) //fatal, can't load any data
return FALSE
@@ -437,6 +444,8 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
if (!load_character(new_slot))
tainted_character_profiles = TRUE
randomise_appearance_prefs()
+ all_quirks = list()
+ recently_updated_keys |= /datum/preference/name/real_name
save_character()
for (var/datum/preference_middleware/preference_middleware as anything in middleware)