cases go brrrrr

This commit is contained in:
TDSSS
2020-10-28 15:16:43 +01:00
parent f086341668
commit b1960b5c40
3 changed files with 25 additions and 25 deletions
@@ -17,20 +17,20 @@ SUBSYSTEM_DEF(persistent_data)
/datum/controller/subsystem/persistent_data/Initialize()
// Load all the data of registered atoms
for(var/atom/A in registered_atoms)
A.PersistentLoad()
A.persistent_load()
return ..()
/datum/controller/subsystem/persistent_data/Shutdown()
// Save all the data of registered atoms
for(var/atom/A in registered_atoms)
A.PersistentSave()
A.persistent_save()
/**
* Proc to register an atom with SSpersistent_data
*
* This will add any provided atom to the list of registered atoms, and add it to the Initialization queue
* If the system has already initialized, it calls PersistentLoad() at that moment
* If the system has already initialized, it calls persistent_load() at that moment
*
* Arguments:
* * A - Atom to register
@@ -38,21 +38,21 @@ SUBSYSTEM_DEF(persistent_data)
/datum/controller/subsystem/persistent_data/proc/register(atom/A)
registered_atoms |= A
if(initialized)
A.PersistentLoad()
A.persistent_load()
/**
* Atom Persistent Loader
*
* Overridden on every atom which needs to load persistent data
*/
/atom/proc/PersistentLoad()
stack_trace("PeristentLoad() called on an atom which does not have persistent data storage!")
/atom/proc/persistent_load()
stack_trace("peristent_load() called on an atom which does not have persistent data storage!")
/**
* Atom Persistent Saver
*
* Overridden on every atom which needs to save persistent data
*/
/atom/proc/PersistentSave()
stack_trace("PeristentSave() called on an atom which does not have persistent data storage!")
/atom/proc/persistent_save()
stack_trace("peristent_save() called on an atom which does not have persistent data storage!")
@@ -46,12 +46,12 @@
SSpersistent_data.register(src)
..()
/mob/living/simple_animal/pet/cat/Runtime/PersistentLoad()
Read_Memory()
Deploy_The_Cats()
/mob/living/simple_animal/pet/cat/Runtime/persistent_load()
read_memory()
deploy_the_cats()
/mob/living/simple_animal/pet/cat/Runtime/PersistentSave()
Write_Memory(FALSE)
/mob/living/simple_animal/pet/cat/Runtime/persistent_save()
write_memory(FALSE)
/mob/living/simple_animal/pet/cat/Runtime/make_babies()
var/mob/baby = ..()
@@ -61,11 +61,11 @@
/mob/living/simple_animal/pet/cat/Runtime/death()
if(can_die())
Write_Memory(TRUE)
write_memory(TRUE)
SSpersistent_data.registered_atoms -= src // We just saved. Dont save at round end
return ..()
/mob/living/simple_animal/pet/cat/Runtime/proc/Read_Memory()
/mob/living/simple_animal/pet/cat/Runtime/proc/read_memory()
var/savefile/S = new /savefile("data/npc_saves/Runtime.sav")
S["family"] >> family
@@ -73,7 +73,7 @@
family = list()
log_debug("Persistent data for [src] loaded (family: [list2params(family)])")
/mob/living/simple_animal/pet/cat/Runtime/proc/Write_Memory(dead)
/mob/living/simple_animal/pet/cat/Runtime/proc/write_memory(dead)
var/savefile/S = new /savefile("data/npc_saves/Runtime.sav")
family = list()
if(!dead)
@@ -87,7 +87,7 @@
S["family"] << family
log_debug("Persistent data for [src] saved (family: [list2params(family)])")
/mob/living/simple_animal/pet/cat/Runtime/proc/Deploy_The_Cats()
/mob/living/simple_animal/pet/cat/Runtime/proc/deploy_the_cats()
for(var/cat_type in family)
if(family[cat_type] > 0)
for(var/i in 1 to min(family[cat_type],100)) //Limits to about 500 cats, you wouldn't think this would be needed (BUT IT IS)
@@ -427,12 +427,12 @@
SSpersistent_data.register(src)
/mob/living/simple_animal/pet/dog/corgi/Ian/death()
Write_Memory(TRUE)
write_memory(TRUE)
SSpersistent_data.registered_atoms -= src // We already wrote here, dont overwrite!
..()
/mob/living/simple_animal/pet/dog/corgi/Ian/PersistentLoad()
Read_Memory()
/mob/living/simple_animal/pet/dog/corgi/Ian/persistent_load()
read_memory()
if(age == 0)
var/turf/target = get_turf(loc)
if(target)
@@ -441,7 +441,7 @@
P.real_name = "Ian"
P.gender = MALE
P.desc = "It's the HoP's beloved corgi puppy."
Write_Memory(FALSE)
write_memory(FALSE)
SSpersistent_data.registered_atoms -= src // We already wrote here, dont overwrite!
qdel(src)
return
@@ -452,10 +452,10 @@
desc = "At a ripe old age of [record_age], Ian's not as spry as he used to be, but he'll always be the HoP's beloved corgi." //RIP
turns_per_move = 20
/mob/living/simple_animal/pet/dog/corgi/Ian/PersistentSave()
Write_Memory(FALSE)
/mob/living/simple_animal/pet/dog/corgi/Ian/persistent_save()
write_memory(FALSE)
/mob/living/simple_animal/pet/dog/corgi/Ian/proc/Read_Memory()
/mob/living/simple_animal/pet/dog/corgi/Ian/proc/read_memory()
if(fexists("data/npc_saves/Ian.sav")) //legacy compatability to convert old format to new
var/savefile/S = new /savefile("data/npc_saves/Ian.sav")
S["age"] >> age
@@ -478,7 +478,7 @@
place_on_head(new saved_head)
log_debug("Persistent data for [src] loaded (age: [age] | record_age: [record_age] | saved_head: [saved_head])")
/mob/living/simple_animal/pet/dog/corgi/Ian/proc/Write_Memory(dead)
/mob/living/simple_animal/pet/dog/corgi/Ian/proc/write_memory(dead)
var/json_file = file("data/npc_saves/Ian.json")
var/list/file_data = list()
if(!dead)