dodgin bullets

This commit is contained in:
Putnam
2020-09-29 21:07:41 -07:00
parent 0c7003b3a5
commit c644495e5e
3 changed files with 13 additions and 7 deletions

View File

@@ -8,6 +8,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/client/parent var/client/parent
//doohickeys for savefiles //doohickeys for savefiles
var/path var/path
var/vr_path
var/default_slot = 1 //Holder so it doesn't default to slot 1, rather the last one used var/default_slot = 1 //Holder so it doesn't default to slot 1, rather the last one used
var/max_save_slots = 16 var/max_save_slots = 16

View File

@@ -212,6 +212,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
if(!ckey) if(!ckey)
return return
path = "data/player_saves/[ckey[1]]/[ckey]/[filename]" path = "data/player_saves/[ckey[1]]/[ckey]/[filename]"
vr_path = "data/player_saves/[ckey[1]]/[ckey]/vore"
/datum/preferences/proc/load_preferences() /datum/preferences/proc/load_preferences()
if(!path) if(!path)
@@ -609,9 +610,9 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
S["vore_flags"] >> vore_flags S["vore_flags"] >> vore_flags
S["vore_taste"] >> vore_taste S["vore_taste"] >> vore_taste
var/vr_path = "data/player_saves/[parent.ckey[1]]/[parent.ckey]/vore/character[default_slot]_v2.json" var/char_vr_path = "[vr_path]/character_[default_slot]_v2.json"
if(fexists(vr_path)) if(fexists(char_vr_path))
var/list/json_from_file = json_decode(file2text(vr_path)) var/list/json_from_file = json_decode(file2text(char_vr_path))
if(json_from_file) if(json_from_file)
belly_prefs = json_from_file["belly_prefs"] belly_prefs = json_from_file["belly_prefs"]
//gear loadout //gear loadout
@@ -880,11 +881,11 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
WRITE_FILE(S["vore_flags"] , vore_flags) WRITE_FILE(S["vore_flags"] , vore_flags)
WRITE_FILE(S["vore_taste"] , vore_taste) WRITE_FILE(S["vore_taste"] , vore_taste)
var/vr_path = "data/player_saves/[parent.ckey[1]]/[parent.ckey]/vore/character[default_slot]_v2.json" var/char_vr_path = "[vr_path]/character_[default_slot]_v2.json"
var/belly_prefs_json = safe_json_encode(list("belly_prefs" = belly_prefs)) var/belly_prefs_json = safe_json_encode(list("belly_prefs" = belly_prefs))
if(fexists(vr_path)) if(fexists(char_vr_path))
fdel(path) fdel(char_vr_path)
text2file(belly_prefs_json,path) text2file(belly_prefs_json,char_vr_path)
WRITE_FILE(S["persistent_scars"] , persistent_scars) WRITE_FILE(S["persistent_scars"] , persistent_scars)
WRITE_FILE(S["scars1"] , scars_list["1"]) WRITE_FILE(S["scars1"] , scars_list["1"])

View File

@@ -10,5 +10,9 @@
Fail("Flavor text is failing to save.") Fail("Flavor text is failing to save.")
if(P.features["ooc_notes"] != "Bar") if(P.features["ooc_notes"] != "Bar")
Fail("OOC text is failing to save.") Fail("OOC text is failing to save.")
P.save_character()
P.load_character()
if(P.features["flavor_text"] != "Foo")
Fail("Repeated saving and loading possibly causing save deletion.")
catch(var/exception/e) catch(var/exception/e)
Fail("Failed to save and load character due to exception [e.file]:[e.line], [e.name]") Fail("Failed to save and load character due to exception [e.file]:[e.line], [e.name]")