Deletes the preferences_vore datum and migrates its contents to preferences.

This commit is contained in:
Ghommie
2020-02-29 15:07:44 +01:00
parent 879032c52f
commit bd87d46ce6
12 changed files with 136 additions and 292 deletions
+28 -52
View File
@@ -41,7 +41,7 @@
return TRUE
//We'll load our client's organs if we have one
if(client && client.prefs_vr)
if(client?.prefs)
if(!copy_from_prefs_vr())
to_chat(src,"<span class='warning'>ERROR: You seem to have saved vore prefs, but they couldn't be loaded.</span>")
return FALSE
@@ -262,47 +262,22 @@
else
to_chat(src,"<span class='alert'>You aren't inside anyone, though, is the thing.</span>")
//
// Verb for saving vore preferences to save file
//
/mob/living/proc/save_vore_prefs()
if(!client || !client.prefs_vr)
return FALSE
if(!copy_to_prefs_vr())
return FALSE
if(!client.prefs_vr.save_vore())
return FALSE
return TRUE
/mob/living/proc/apply_vore_prefs()
if(!client || !client.prefs_vr)
return FALSE
if(!client.prefs_vr.load_vore())
return FALSE
if(!copy_from_prefs_vr())
return FALSE
return TRUE
/mob/living/proc/copy_to_prefs_vr()
if(!client || !client.prefs_vr)
to_chat(src,"<span class='warning'>You attempted to save your vore prefs but somehow you're in this character without a client.prefs_vr variable. Tell a dev.</span>")
if(!client || !client.prefs)
to_chat(src,"<span class='warning'>You attempted to save your vore prefs but somehow you're in this character without a client.prefs variable. Tell a dev.</span>")
return FALSE
var/datum/vore_preferences/P = client.prefs_vr
P.digestable = src.digestable
P.devourable = src.devourable
P.feeding = src.feeding
P.vore_taste = src.vore_taste
client.prefs.digestable = digestable
client.prefs.devourable = devourable
client.prefs.feeding = feeding
client.prefs.vore_taste = vore_taste
var/list/serialized = list()
for(var/belly in src.vore_organs)
for(var/belly in vore_organs)
var/obj/belly/B = belly
serialized += list(B.serialize()) //Can't add a list as an object to another list in Byond. Thanks.
P.belly_prefs = serialized
client.prefs.belly_prefs = serialized
return TRUE
@@ -310,21 +285,20 @@
// Proc for applying vore preferences, given bellies
//
/mob/living/proc/copy_from_prefs_vr()
if(!client || !client.prefs_vr)
to_chat(src,"<span class='warning'>You attempted to apply your vore prefs but somehow you're in this character without a client.prefs_vr variable. Tell a dev.</span>")
if(!client || !client.prefs)
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
vorepref_init = TRUE
var/datum/vore_preferences/P = client.prefs_vr
digestable = P.digestable
devourable = P.devourable
feeding = P.feeding
vore_taste = P.vore_taste
digestable = client.prefs.digestable
devourable = client.prefs.devourable
feeding = client.prefs.feeding
vore_taste = client.prefs.vore_taste
release_vore_contents(silent = TRUE)
vore_organs.Cut()
for(var/entry in P.belly_prefs)
QDEL_LIST(vore_organs)
for(var/entry in client.prefs.belly_prefs)
list_to_object(entry,src)
return TRUE
@@ -381,18 +355,12 @@
set category = "Vore"
set desc = "Lick someone nearby!"
if(!istype(tasted))
if(!istype(tasted) || !(tasted.client?.prefs.lickable))
return
if(!tasted.client?.prefs_vr.lickable)
return
setClickCooldown(100)
if(src == stat)
return
src.setClickCooldown(100)
src.visible_message("<span class='warning'>[src] licks [tasted]!</span>","<span class='notice'>You lick [tasted]. They taste rather like [tasted.get_taste_message()].</span>","<b>Slurp!</b>")
visible_message("<span class='warning'>[src] licks [tasted]!</span>","<span class='notice'>You lick [tasted]. They taste rather like [tasted.get_taste_message()].</span>","<b>Slurp!</b>")
/mob/living/proc/get_taste_message(allow_generic = TRUE, datum/species/mrace)
@@ -408,3 +376,11 @@
else
taste_message += "a plain old normal [src]"
return taste_message
// Check if an object is capable of eating things, based on vore_organs
//
/proc/is_vore_predator(var/mob/living/O)
if(istype(O))
if(O.vore_organs.len > 0)
return TRUE
return FALSE