diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index 049a374d8e..754c33d3d3 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -427,6 +427,11 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car verify_keybindings_valid() // one of these days this will runtime and you'll be glad that i put it in a different proc so no one gets their saves wiped + if(S["unlockable_loadout"]) + unlockable_loadout_data = safe_json_decode(S["unlockable_loadout"]) + else + unlockable_loadout_data = list() + if(needs_update >= 0) //save the updated version var/old_default_slot = default_slot var/old_max_save_slots = max_save_slots @@ -532,6 +537,11 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car WRITE_FILE(S["auto_ooc"], auto_ooc) WRITE_FILE(S["no_tetris_storage"], no_tetris_storage) + if(length(unlockable_loadout_data)) + WRITE_FILE(S["unlockable_loadout"], safe_json_encode(unlockable_loadout_data)) + else + WRITE_FILE(S["unlockable_loadout"], safe_json_encode(list())) + return 1 /datum/preferences/proc/load_character(slot, bypass_cooldown = FALSE) @@ -741,11 +751,6 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car else loadout_data = list() - if(S["unlockable_loadout"]) - unlockable_loadout_data = safe_json_decode(S["unlockable_loadout"]) - else - unlockable_loadout_data = list() - //try to fix any outdated data if necessary //preference updating will handle saving the updated data for us. if(needs_update >= 0) @@ -1083,11 +1088,6 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car else S["loadout"] << safe_json_encode(list()) - if(length(unlockable_loadout_data)) - S["unlockable_loadout"] << safe_json_encode(unlockable_loadout_data) - else - S["unlockable_loadout"] << safe_json_encode(list()) - cit_character_pref_save(S) return 1