Fixes preferences resetting (#3104)

## About The Pull Request
Fixes https://github.com/Bubberstation/Bubberstation/issues/2879

The reason for the issue seems rooted in skyrat's own port of the
original json configs on tg (or perhaps the loads of changes they've
made to it over the years). This pr patches it so that characters won't
reset between rounds.

original fixes by smartkar
## Why It's Good For The Game
Guess
## Proof Of Testing
<details>
<summary>Screenshots/Videos</summary>


![qe0kfreu8l](https://github.com/user-attachments/assets/c84b20a1-c09b-4905-b682-3c280c7e8ab3)


</details>
It saves the character on creation and works fine after re-accessing the
savefile

## Changelog
🆑
fixes: fixes the issue where characters would reset after a round or on
switching character slots
/🆑
This commit is contained in:
Mosley
2025-02-16 23:29:37 -05:00
committed by GitHub
parent f14c571ec4
commit 65e7c8c6bd
4 changed files with 11 additions and 9 deletions
+4 -4
View File
@@ -25,7 +25,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
*/
/datum/preferences/proc/save_data_needs_update(list/save_data)
if(!save_data) // empty list, either savefile isnt loaded or its a new char
return -1
return -3 // BUBBER EDIT
if(save_data["version"] < SAVEFILE_VERSION_MIN)
return -2
if(save_data["version"] < SAVEFILE_VERSION_MAX)
@@ -328,7 +328,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
all_quirks = SSquirks.filter_invalid_quirks(SANITIZE_LIST(all_quirks), augments)// SKYRAT EDIT - AUGMENTS+
validate_quirks()
return TRUE
return needs_update != -3 // BUBBER EDIT
/datum/preferences/proc/save_character(update) // Skyrat edit - Choose when to update (This is stupid)
SHOULD_NOT_SLEEP(TRUE)
@@ -343,7 +343,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
if (preference.savefile_identifier != PREFERENCE_CHARACTER)
continue
if (!(preference.type in recently_updated_keys))
if (!update && !(preference.type in recently_updated_keys)) // BUBBER EDIT
continue
recently_updated_keys -= preference.type
@@ -376,7 +376,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
if (!load_character(new_slot))
tainted_character_profiles = TRUE
randomise_appearance_prefs()
save_character()
save_character(TRUE) // BUBBER EDIT
for (var/datum/preference_middleware/preference_middleware as anything in middleware)
preference_middleware.on_new_character(usr)