From bb42f4e51d099ad0a75761f53aa523b271768a0a Mon Sep 17 00:00:00 2001 From: Arokha Sieyes Date: Fri, 10 Jun 2016 21:02:01 -0400 Subject: [PATCH] Fixes bellies overwritng each other Now you can have more than one slot. Fair warning, if you load another character then save bellies, it overwrites those. Like if you do that AFTER spawning. Like you're playing a mob from slot 1, you go into preferences > character set up, load slot 2, then open vore panel and click save, it will overwrite slot 2. On the one hand, an easy way to copy bellies between characters! On the other, perhaps unexpected. This prooooooooooobably doesn't delete everyone's bellies? Probably. Maybe you should copy the data folder, just in case. ;o Skip the logs. --- code/modules/client/preferences.dm | 2 + code/modules/vore/eating/belly_vr.dm | 79 ++++++++++++++++++++++++--- code/modules/vore/eating/living_vr.dm | 13 ++--- 3 files changed, 77 insertions(+), 17 deletions(-) diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 8064479e6e..c26bde7fa0 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -235,12 +235,14 @@ datum/preferences else if(href_list["reload"]) load_preferences() load_character() + attempt_vr(client.prefs_vr,"load_vore","") //VOREStation Edit else if(href_list["load"]) if(!IsGuestKey(usr.key)) open_load_dialog(usr) return 1 else if(href_list["changeslot"]) load_character(text2num(href_list["changeslot"])) + attempt_vr(client.prefs_vr,"load_vore","") //VOREStation Edit close_load_dialog(usr) else return 0 diff --git a/code/modules/vore/eating/belly_vr.dm b/code/modules/vore/eating/belly_vr.dm index dac057428a..95c5348790 100644 --- a/code/modules/vore/eating/belly_vr.dm +++ b/code/modules/vore/eating/belly_vr.dm @@ -1,9 +1,10 @@ // // The belly object is what holds onto a mob while they're inside a predator. // It takes care of altering the pred's decription, digesting the prey, relaying struggles etc. -// It is not, however, for printing messages about entering/exiting the belly. That is done in voretype etc. // +// If you change what variables are on this, then you need to update the copy() proc. + // // Parent type of all the various "belly" varieties. // @@ -28,7 +29,6 @@ var/tmp/mob/living/owner // The mob whose belly this is. var/tmp/list/internal_contents = list() // People/Things you've eaten into this belly! var/tmp/is_full // Flag for if digested remeans are present. (for disposal messages) - var/tmp/recent_struggle = 0 // Flag to prevent struggle emote spam var/tmp/emotePend = 0 // If there's already a spawned thing counting for the next emote // Don't forget to watch your commas at the end of each line if you change these. @@ -82,6 +82,7 @@ //Mostly for being overridden on precreated bellies on mobs. Could be VV'd into //a carbon's belly if someone really wanted. No UI for carbons to adjust this. + //List has indexes that are the digestion mode strings, and keys that are lists of strings. var/list/emote_lists = list() // Constructor that sets the owning mob @@ -283,7 +284,7 @@ if(brain) brain.forceMove(owner) internal_contents += brain - + else if(!_is_digestable(W)) W.forceMove(owner) @@ -329,7 +330,7 @@ //Handle a mob struggling // Called from /mob/living/carbon/relaymove() /datum/belly/proc/relay_resist(var/mob/living/R) - if (!(R in internal_contents) || recent_struggle) + if (!(R in internal_contents)) return // User is not in this belly, or struggle too soon. R.setClickCooldown(50) @@ -350,11 +351,6 @@ return return -/* POLARISTODO - If this is made unnecessary by setClickCooldown, remove it and the var on bellies - recent_struggle = 1 - spawn(30) - recent_struggle = 0 -*/ var/struggle_outer_message = pick(struggle_messages_outside) var/struggle_user_message = pick(struggle_messages_inside) @@ -376,3 +372,68 @@ var/strpick = pick(struggle_sounds) var/strsound = struggle_sounds[strpick] playsound(R.loc, strsound, 50, 1) + +// Belly copies and then returns the copy +// Needs to be updated for any var changes +/datum/belly/proc/copy() + var/datum/belly/dupe = new /datum/belly() + + //// Non-object variables + dupe.name = name + dupe.inside_flavor = inside_flavor + dupe.vore_sound = vore_sound + dupe.vore_verb = vore_verb + dupe.human_prey_swallow_time = human_prey_swallow_time + dupe.nonhuman_prey_swallow_time = nonhuman_prey_swallow_time + dupe.emoteTime = emoteTime + dupe.digest_brute = digest_brute + dupe.digest_burn = digest_burn + dupe.digest_tickrate = digest_tickrate + dupe.immutable = immutable + dupe.escapable = escapable + dupe.escapetime = escapetime + + //// Object-holding variables + //digest_modes - just constants + dupe.digest_modes.Cut() + for(var/I in digest_modes) + dupe.digest_modes += I + + //transform_modes - just constants + dupe.transform_modes.Cut() + for(var/I in transform_modes) + dupe.transform_modes += I + + //struggle_messages_outside - strings + dupe.struggle_messages_outside.Cut() + for(var/I in struggle_messages_outside) + dupe.struggle_messages_outside += I + + //struggle_messages_inside - strings + dupe.struggle_messages_inside.Cut() + for(var/I in struggle_messages_inside) + dupe.struggle_messages_inside += I + + //digest_messages_owner - strings + dupe.digest_messages_owner.Cut() + for(var/I in digest_messages_owner) + dupe.digest_messages_owner += I + + //digest_messages_prey - strings + dupe.digest_messages_prey.Cut() + for(var/I in digest_messages_prey) + dupe.digest_messages_prey += I + + //examine_messages - strings + dupe.examine_messages.Cut() + for(var/I in examine_messages) + dupe.examine_messages += I + + //emote_lists - index: digest mode, key: list of strings + dupe.emote_lists.Cut() + for(var/K in emote_lists) + dupe.emote_lists[K] = list() + for(var/I in emote_lists[K]) + dupe.emote_lists[K] += I + + return dupe diff --git a/code/modules/vore/eating/living_vr.dm b/code/modules/vore/eating/living_vr.dm index 1bc4917ab7..f4feb230f0 100644 --- a/code/modules/vore/eating/living_vr.dm +++ b/code/modules/vore/eating/living_vr.dm @@ -216,7 +216,7 @@ // // Proc for applying vore preferences, given bellies // -/mob/living/proc/copy_from_prefs_vr(var/list/bellies) +/mob/living/proc/copy_from_prefs_vr() if(!client || !client.prefs_vr) src << "You attempted to apply your vore prefs but somehow you're in this character without a client.prefs_vr variable. Tell a dev." return 0 @@ -224,14 +224,11 @@ var/datum/vore_preferences/P = client.prefs_vr src.digestable = P.digestable - src.vore_organs = P.belly_prefs + src.vore_organs = list() - if(!src.vore_organs) //Emergency double-backup to stop runtimes from doing .len on this. - vore_organs = list() - - for(var/I in vore_organs) //Set the owner at runtime since... yanno. - var/datum/belly/B = vore_organs[I] - B.owner = src + for(var/I in P.belly_prefs) + var/datum/belly/Bp = P.belly_prefs[I] + src.vore_organs[Bp.name] = Bp.copy() return 1