Merge pull request #13467 from Putnam3145/past-me-idiot

Fixes vore prefs (I was looking in the wrong place the whole time)
This commit is contained in:
silicons
2020-10-01 03:10:04 -07:00
committed by GitHub
5 changed files with 23 additions and 14 deletions

View File

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

View File

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

View File

@@ -10,5 +10,9 @@
Fail("Flavor text is failing to save.")
if(P.features["ooc_notes"] != "Bar")
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)
Fail("Failed to save and load character due to exception [e.file]:[e.line], [e.name]")

View File

@@ -273,16 +273,7 @@
to_chat(src,"<span class='warning'>You attempted to apply your vore prefs but somehow you're in this character without a client.prefs variable. Tell a dev.</span>")
return FALSE
ENABLE_BITFIELD(vore_flags,VOREPREF_INIT)
// garbage data coming back the other way or breaking absorbed would be bad, so instead we do this
vore_flags |= CHECK_BITFIELD(client.prefs.vore_flags,DIGESTABLE) // set to 1 if prefs is 1
vore_flags |= CHECK_BITFIELD(client.prefs.vore_flags,DEVOURABLE)
vore_flags |= CHECK_BITFIELD(client.prefs.vore_flags,FEEDING)
vore_flags &= CHECK_BITFIELD(client.prefs.vore_flags,DIGESTABLE) // set to 0 if prefs is 0
vore_flags &= CHECK_BITFIELD(client.prefs.vore_flags,DEVOURABLE)
vore_flags &= CHECK_BITFIELD(client.prefs.vore_flags,FEEDING)
COPY_SPECIFIC_BITFIELDS(vore_flags,client.prefs.vore_flags,DIGESTABLE | DEVOURABLE | FEEDING | LICKABLE)
vore_taste = client.prefs.vore_taste
release_vore_contents(silent = TRUE)