mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-23 03:57:48 +01:00
More work towards saving
This commit is contained in:
@@ -23,25 +23,48 @@ V::::::V V::::::VO:::::::OOO:::::::ORR:::::R R:::::REE::::::EEEEEE
|
||||
// Overrides/additions to stock defines go here, as well as hooks. Sort them by
|
||||
// the object they are overriding. So all /mob/living together, etc.
|
||||
//
|
||||
/datum/configuration
|
||||
var/items_survive_digestion = 1 //For configuring if the important_items survive digestion
|
||||
|
||||
//
|
||||
// The datum type bolted onto normal preferences datums for storing Virgo stuff
|
||||
//
|
||||
/client
|
||||
var/datum/vore_preferences/prefs_vr
|
||||
|
||||
/hook/client_new/proc/add_prefs_vr(client/C)
|
||||
C.prefs_vr = new/datum/vore_preferences(C)
|
||||
if(C.prefs_vr)
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
/datum/vore_preferences
|
||||
//Actual preferences
|
||||
var/digestable = 1
|
||||
var/list/belly_prefs = list()
|
||||
|
||||
/datum/configuration
|
||||
var/items_survive_digestion = 1 //For configuring if the important_items survive digestion
|
||||
//Mechanically required
|
||||
var/path
|
||||
var/slot
|
||||
var/client/client
|
||||
var/client_ckey
|
||||
|
||||
/datum/vore_preferences/New(client/C)
|
||||
if(istype(C))
|
||||
client = C
|
||||
client_ckey = C.ckey
|
||||
load_vore(C)
|
||||
|
||||
//
|
||||
// Adding procs to types to support vore
|
||||
//
|
||||
/datum/vore_preferences/proc/save_vore_preferences()
|
||||
//POLARISTODO
|
||||
save_vore()
|
||||
return
|
||||
|
||||
/datum/vore_preferences/proc/load_vore_preferences()
|
||||
//POLARISTODO
|
||||
load_vore()
|
||||
return
|
||||
|
||||
//
|
||||
@@ -66,3 +89,39 @@ V::::::V V::::::VO:::::::OOO:::::::ORR:::::R R:::::REE::::::EEEEEE
|
||||
return(B)
|
||||
|
||||
return 0
|
||||
|
||||
//
|
||||
// Save/Load Vore Preferences
|
||||
//
|
||||
/datum/vore_preferences/proc/load_vore(filename="preferences_vr.sav")
|
||||
if(!client || !client_ckey) return 0 //No client, how can we save?
|
||||
if(!path)
|
||||
path = "data/player_saves/[copytext(client_ckey,1,2)]/[client_ckey]/[filename]"
|
||||
if(!path) return 0 //Path couldn't be set?
|
||||
|
||||
var/savefile/S = new /savefile(path)
|
||||
if(!S) return 0 //Savefile object couldn't be created?
|
||||
|
||||
S.cd = "/"
|
||||
if(!slot)
|
||||
slot = client.prefs.default_slot
|
||||
|
||||
slot = sanitize_integer(slot, 1, config.character_slots, initial(client.prefs.default_slot))
|
||||
S.cd = "/character[slot]"
|
||||
|
||||
S["digestable"] >> digestable
|
||||
S["belly_prefs"] >> belly_prefs
|
||||
|
||||
return 1
|
||||
|
||||
/datum/vore_preferences/proc/save_vore()
|
||||
if(!path) return 0
|
||||
if(!slot) return 0
|
||||
var/savefile/S = new /savefile(path)
|
||||
if(!S) return 0
|
||||
S.cd = "/character[slot]"
|
||||
|
||||
S["digestable"] << digestable
|
||||
S["belly_prefs"] << belly_prefs
|
||||
|
||||
return 1
|
||||
@@ -1,6 +1,8 @@
|
||||
//The base hooks themselves
|
||||
|
||||
//New() hooks
|
||||
/hook/client_new
|
||||
|
||||
/hook/mob_new
|
||||
|
||||
/hook/living_new
|
||||
|
||||
Reference in New Issue
Block a user