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 21:29:37 -07:00
committed by GitHub
parent f14c571ec4
commit 65e7c8c6bd
4 changed files with 11 additions and 9 deletions
@@ -25,7 +25,7 @@
/datum/preferences/proc/savefile_needs_update_skyrat(list/save_data)
var/savefile_version = save_data["modular_version"]
if(save_data.len && savefile_version < MODULAR_SAVEFILE_VERSION_MAX)
if(savefile_version && savefile_version < MODULAR_SAVEFILE_VERSION_MAX) // BUBBER EDIT
return savefile_version
return MODULAR_SAVEFILE_UP_TO_DATE
@@ -79,7 +79,7 @@
languages = save_languages
tgui_prefs_migration = save_data["tgui_prefs_migration"]
if(!tgui_prefs_migration && save_data.len) // If save_data is empty, this is definitely a new character
if(!tgui_prefs_migration && save_data["modular_version"] && save_data["modular_version"] < MODULAR_SAVEFILE_VERSION_MAX) // BUBBER EDIT - if we're missing version from migration, then the char is new. Won't be able to migrate either.
to_chat(parent, examine_block(span_redtext("PREFERENCE MIGRATION BEGINNING.\
\nDO NOT INTERACT WITH YOUR PREFERENCES UNTIL THIS PROCESS HAS BEEN COMPLETED.\
\nDO NOT DISCONNECT UNTIL THIS PROCESS HAS BEEN COMPLETED.\
@@ -284,8 +284,9 @@
save_data["alt_job_titles"] = alt_job_titles
save_data["languages"] = languages
save_data["food_preferences"] = food_preferences
if(updated)
save_data["modular_version"] = MODULAR_SAVEFILE_VERSION_MAX
//if(updated) // BUBBER EDIT - This is bullshit, results in newly created characters getting invalid data. Load character should forcefully migrate it, so we can safely assume its up to date
// save_data["modular_version"] = MODULAR_SAVEFILE_VERSION_MAX
save_data["modular_version"] = MODULAR_SAVEFILE_VERSION_MAX
/datum/preferences/proc/update_body_parts(datum/preference/preference)