Files
GS13NG/code/modules/vore/eating/vore_vr.dm
Poojawa 4ab7f126ed Vore system updates (#2864)
* Tasting, digest/transfer chance, improvements

* more vague for defaults

* Actually let's hold off on silenced mode 'cuz broke

* make sure it's all commented out

* reverts vorepanel updater, buggy af. Adds mob vore

Ian can eat you now. \o/
2017-09-19 14:03:13 -05:00

142 lines
4.1 KiB
Plaintext

/*
VVVVVVVV VVVVVVVV OOOOOOOOO RRRRRRRRRRRRRRRRR EEEEEEEEEEEEEEEEEEEEEE
V::::::V V::::::V OO:::::::::OO R::::::::::::::::R E::::::::::::::::::::E
V::::::V V::::::V OO:::::::::::::OO R::::::RRRRRR:::::R E::::::::::::::::::::E
V::::::V V::::::VO:::::::OOO:::::::ORR:::::R R:::::REE::::::EEEEEEEEE::::E
V:::::V V:::::V O::::::O O::::::O R::::R R:::::R E:::::E EEEEEE
V:::::V V:::::V O:::::O O:::::O R::::R R:::::R E:::::E
V:::::V V:::::V O:::::O O:::::O R::::RRRRRR:::::R E::::::EEEEEEEEEE
V:::::V V:::::V O:::::O O:::::O R:::::::::::::RR E:::::::::::::::E
V:::::V V:::::V O:::::O O:::::O R::::RRRRRR:::::R E:::::::::::::::E
V:::::V V:::::V O:::::O O:::::O R::::R R:::::R E::::::EEEEEEEEEE
V:::::V:::::V O:::::O O:::::O R::::R R:::::R E:::::E
V:::::::::V O::::::O O::::::O R::::R R:::::R E:::::E EEEEEE
V:::::::V O:::::::OOO:::::::ORR:::::R R:::::REE::::::EEEEEEEE:::::E
V:::::V OO:::::::::::::OO R::::::R R:::::RE::::::::::::::::::::E
V:::V OO:::::::::OO R::::::R R:::::RE::::::::::::::::::::E
VVV OOOOOOOOO RRRRRRRR RRRRRRREEEEEEEEEEEEEEEEEEEEEE
-Aro <3 */
//
// 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.
//
//
// The datum type bolted onto normal preferences datums for storing Vore 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 TRUE
return FALSE
/datum/vore_preferences
//Actual preferences
var/digestable = TRUE
var/devourable = FALSE
var/list/belly_prefs = list()
var/vore_taste
//Mechanically required
var/path
var/slot
var/client/client
var/client_ckey
var/client/parent
/datum/vore_preferences/New(client/C)
if(istype(C))
client = C
client_ckey = C.ckey
load_vore(C)
//
// Check if an object is capable of eating things, based on vore_organs
//
/proc/is_vore_predator(var/mob/living/O)
if(istype(O,/mob/living))
if(O.vore_organs.len > 0)
return TRUE
return FALSE
//
// Belly searching for simplifying other procs
//
/proc/check_belly(atom/movable/A)
if(istype(A.loc,/mob/living))
var/mob/living/M = A.loc
for(var/I in M.vore_organs)
var/datum/belly/B = M.vore_organs[I]
if(A in B.internal_contents)
return(B)
return FALSE
//
// Save/Load Vore Preferences
//
/datum/vore_preferences/proc/load_vore()
if(!client || !client_ckey) return FALSE //No client, how can we save?
slot = client.prefs.default_slot
path = client.prefs.path
if(!path) return FALSE //Path couldn't be set?
if(!fexists(path)) //Never saved before
save_vore() //Make the file first
return TRUE
var/savefile/S = new /savefile(path)
if(!S) return FALSE //Savefile object couldn't be created?
S.cd = "/character[slot]"
S["digestable"] >> digestable
S["devourable"] >> devourable
S["belly_prefs"] >> belly_prefs
S["vore_taste"] >> vore_taste
if(isnull(digestable))
digestable = TRUE
if(isnull(devourable))
devourable = FALSE
if(isnull(belly_prefs))
belly_prefs = list()
return TRUE
/datum/vore_preferences/proc/save_vore()
if(!path) return FALSE
if(!slot) return FALSE
var/savefile/S = new /savefile(path)
if(!S) return FALSE
S.cd = "/character[slot]"
WRITE_FILE(S["digestable"], digestable)
WRITE_FILE(S["devourable"], devourable)
WRITE_FILE(S["belly_prefs"], belly_prefs)
WRITE_FILE(S["vore_taste"], vore_taste)
return TRUE
#ifdef TESTING
//DEBUG
//Some crude tools for testing savefiles
//path is the savefile path
/client/verb/vore_savefile_export(path as text)
var/savefile/S = new /savefile(path)
S.ExportText("/",file("[path].txt"))
//path is the savefile path
/client/verb/vore_savefile_import(path as text)
var/savefile/S = new /savefile(path)
S.ImportText("/",file("[path].txt"))
#endif