From dc61ee2ffeae8291985b46b07d5472affbc5eb05 Mon Sep 17 00:00:00 2001 From: ShadowLarkens Date: Thu, 30 Apr 2020 16:37:41 -0700 Subject: [PATCH 1/3] Vore Datums implemented, awaiting integration&testing --- code/_helpers/global_lists.dm | 7 + .../vore/eating/bellymodes_datum_vr.dm | 249 ++++++++++++++++++ code/modules/vore/eating/bellymodes_tf_vr.dm | 92 ------- code/modules/vore/eating/bellymodes_vr.dm | 181 +++++++------ 4 files changed, 346 insertions(+), 183 deletions(-) create mode 100644 code/modules/vore/eating/bellymodes_datum_vr.dm delete mode 100644 code/modules/vore/eating/bellymodes_tf_vr.dm diff --git a/code/_helpers/global_lists.dm b/code/_helpers/global_lists.dm index 33b50af54b..31e19b3082 100644 --- a/code/_helpers/global_lists.dm +++ b/code/_helpers/global_lists.dm @@ -203,6 +203,13 @@ var/global/list/string_slot_flags = list( var/datum/poster/P = new T NT_poster_designs += P + // VOREStation Add - Vore Modes! + paths = typesof(/datum/digest_mode) - /datum/digest_mode/transform + for(var/T in paths) + var/datum/digest_mode/DM = new T + GLOB.digest_modes[DM.id] = DM + // VOREStation Add End + return 1 /* // Uncomment to debug chemical reaction list. diff --git a/code/modules/vore/eating/bellymodes_datum_vr.dm b/code/modules/vore/eating/bellymodes_datum_vr.dm new file mode 100644 index 0000000000..591d106db4 --- /dev/null +++ b/code/modules/vore/eating/bellymodes_datum_vr.dm @@ -0,0 +1,249 @@ +GLOBAL_LIST_INIT(digest_modes, list()) + +/datum/digest_mode + var/id = DM_HOLD + var/noise_chance = 0 + +/datum/digest_mode/process_mob(obj/belly/B, mob/living/L) + return + +/datum/digest_mode/digest + id = DM_DIGEST + noise_chance = 50 + +/datum/digest_mode/digest/process_mob(obj/belly/B, mob/living/L) + //Pref protection! + if(!L.digestable || L.absorbed) + return + + //Person just died in guts! + if(L.stat == DEAD) + if(L.is_preference_enabled(/datum/client_preference/digestion_noises)) + if(!B.fancy_vore) + SEND_SOUND(L, sound(get_sfx("classic_death_sounds"))) + else + SEND_SOUND(L, sound(get_sfx("fancy_death_prey"))) + B.handle_digestion_death(L) + to_update = TRUE + if(!B.fancy_vore) + return sound(get_sfx("classic_death_sounds")) + return sound(get_sfx("fancy_death_pred")) + + // Deal digestion damage (and feed the pred) + var/old_brute = L.getBruteLoss() + var/old_burn = L.getFireLoss() + L.adjustBruteLoss(digest_brute) + L.adjustFireLoss(digest_burn) + var/actual_brute = L.getBruteLoss() - old_brute + var/actual_burn = L.getFireLoss() - old_burn + var/damage_gain = actual_brute + actual_burn + + var/offset = (1 + ((L.weight - 137) / 137)) // 130 pounds = .95 140 pounds = 1.02 + var/difference = B.owner.size_multiplier / L.size_multiplier + if(isrobot(B.owner)) + var/mob/living/silicon/robot/R = B.owner + R.cell.charge += 25 * damage_gain + if(offset) // If any different than default weight, multiply the % of offset. + B.owner.adjust_nutrition(offset*((nutrition_percent / 100) * 4.5 * (damage_gain) / difference)) //4.5 nutrition points per health point. Normal same size 100+100 health prey with average weight would give 900 points if the digestion was instant. With all the size/weight offset taxes plus over time oxyloss+hunger taxes deducted with non-instant digestion, this should be enough to not leave the pred starved. + else + B.owner.adjust_nutrition((nutrition_percent / 100) * 4.5 * (damage_gain) / difference) + +/datum/digest_mode/absorb + id = DM_ABSORB + noise_chance = 10 + +/datum/digest_mode/absorb/process_mob(obj/belly/B, mob/living/L) + if(!L.absorbable || L.absorbed) + continue + digestion_noise_chance = 10 + steal_nutrition(L) + if(L.nutrition < 100) + absorb_living(L) + to_update = TRUE + +/datum/digest_mode/unabsorb + id = DM_UNABSORB + +/datum/digest_mode/unabsorb/process_mob(obj/belly/B, mob/living/L) + if(L.absorbed && B.owner.nutrition >= 100) + L.absorbed = FALSE + to_chat(L, "You suddenly feel solid again.") + to_chat(B.owner,"You feel like a part of you is missing.") + B.owner.adjust_nutrition(-100) + to_update = TRUE + +/datum/digest_mode/drain + id = DM_DRAIN + noise_chance = 10 + +/datum/digest_mode/drain/process_mob(obj/belly/B, mob/living/L) + steal_nutrition(L) + +/datum/digest_mode/drain/shrink + id = DM_SHRINK + +/datum/digest_mode/drain/shrink/process_mob(obj/belly/B, mob/living/L) + if(L.size_multiplier > B.shrink_grow_size) + L.resize(L.size_multiplier - 0.01) // Shrink by 1% per tick + . = ..() + +/datum/digest_mode/grow + id = DM_GROW + noise_chance = 10 + +/datum/digest_mode/grow/process_mob(obj/belly/B, mob/living/L) + if(L.size_multiplier < B.shrink_grow_size) + L.resize(L.size_multiplier + 0.01) // Shrink by 1% per tick + +/datum/digest_mode/drain/sizesteal + id = DM_SIZE_STEAL + +/datum/digest_mode/drain/sizesteal/process_mob(obj/belly/B, mob/living/L) + if(L.size_multiplier > B.shrink_grow_size && B.owner.size_multiplier < 2) //Grow until either pred is large or prey is small. + B.owner.resize(B.owner.size_multiplier + 0.01) //Grow by 1% per tick. + L.resize(L.size_multiplier - 0.01) //Shrink by 1% per tick + . = ..() + +/datum/digest_mode/heal + id = DM_HEAL + noise_chance = 50 //Wet heals! The secret is you can leave this on for gurgle noises for fun. + +/datum/digest_mode/heal/process_mob(obj/belly/B, mob/living/L) + if(L.stat == DEAD) + continue // Can't heal the dead with healbelly + if(B.owner.nutrition > 90 && (L.health < L.maxHealth)) + L.adjustBruteLoss(-2.5) + L.adjustFireLoss(-2.5) + L.adjustToxLoss(-5) + L.adjustOxyLoss(-5) + L.adjustCloneLoss(-1.25) + B.owner.adjust_nutrition(-2) + if(L.nutrition <= 400) + L.adjust_nutrition(1) + else if(B.owner.nutrition > 90 && (L.nutrition <= 400)) + B.owner.adjust_nutrition(-1) + L.adjust_nutrition(1) + +// TRANSFORM MODES +/datum/digest_mode/transform + var/stabilize_nutrition = FALSE + var/changes_eyes = FALSE + var/changes_hair_solo = FALSE + var/changes_hairandskin = FALSE + var/changes_gender = FALSE + var/changes_gender_to = null + var/changes_species = FALSE + var/changes_ears_tail_wing_nocolor = FALSE + var/changes_ears_tail_wing_color = FALSE + var/eggs = FALSE + +/datum/digest_mode/transform/process_mob(obj/belly/B, mob/living/carbon/human/H) + if(!istype(H) || H.stat == DEAD) + return + if(stabilize_nutrition) + if(B.owner.nutrition > 400 && H.nutrition < 400) + B.owner.adjust_nutrition(-2) + H.adjust_nutrition(1.5) + if(changes_eyes && B.check_eyes(H)) + B.change_eyes(H, 1) + return + if(changes_hair_solo && B.check_hair(H)) + B.change_hair(H) + return + if(changes_hairandskin && (B.check_hair(H) || B.check_skin(H))) + B.change_hair(H) + B.change_skin(H, 1) + return + if(changes_species) + if(changes_ears_tail_wing_nocolor && (B.check_ears(H) || B.check_tail_nocolor(H) || B.check_wing_nocolor(H) || B.check_species(H))) + B.change_ears(H) + B.change_tail_nocolor(H) + B.change_wing_nocolor(H) + B.change_species(H, 1, 1) // ,1) preserves coloring + return + if(changes_ears_tail_wing_color && (B.check_ears(H) || B.check_tail(H) || B.check_wing(H) || B.check_species(H))) + B.change_ears(H) + B.change_tail(H) + B.change_wing(H) + B.change_species(H, 1, 2) // ,2) does not preserve coloring. + return + if(changes_gender && B.check_gender(H, changes_gender_to)) + B.change_gender(H, changes_gender_to, 1) + return + if(eggs && (!H.absorbed)) + B.put_in_egg(H, 1) + return + +// Regular TF Modes +/datum/digest_mode/transform/hairandeyes + id = DM_TRANSFORM_HAIR_AND_EYES + stabilize_nutrition = TRUE + changes_eyes = TRUE + changes_hair_solo = TRUE + +/datum/digest_mode/transform/gender + id = DM_TRANSFORM_FEMALE + changes_eyes = TRUE + changes_hairandskin = TRUE + changes_gender = TRUE + changes_gender_to = FEMALE + stabilize_nutrition = TRUE + +/datum/digest_mode/transform/gender/male + id = DM_TRANSFORM_FEMALE + changes_gender_to = MALE + +/datum/digest_mode/transform/keepgender + id = DM_TRANSFORM_KEEP_GENDER + changes_eyes = TRUE + changes_hairandskin = TRUE + stabilize_nutrition = TRUE + +/datum/digest_mode/transform/speciesandtaur + id = DM_TRANSFORM_CHANGE_SPECIES_AND_TAUR + changes_species = TRUE + changes_ears_tail_wing_nocolor = TRUE + stabilize_nutrition = TRUE + +/datum/digest_mode/transform/replica + id = DM_TRANSFORM_REPLICA + changes_eyes = TRUE + changes_hairandskin = TRUE + changes_species = TRUE + changes_ears_tail_wing_color = TRUE + +// E G G +/datum/digest_mode/transform/egg + id = DM_EGG + eggs = TRUE + +/datum/digest_mode/transform/egg/gender + id = DM_TRANSFORM_FEMALE_EGG + changes_eyes = TRUE + changes_hairandskin = TRUE + changes_gender = TRUE + changes_gender_to = FEMALE + stabilize_nutrition = TRUE + +/datum/digest_mode/transform/egg/gender/male + id = DM_TRANSFORM_MALE_EGG + changes_gender_to = MALE + +/datum/digest_mode/transform/egg/nogender + id = DM_TRANSFORM_KEEP_GENDER_EGG + changes_eyes = TRUE + changes_hairandskin = TRUE + stabilize_nutrition = TRUE + +/datum/digest_mode/transform/egg/speciesandtaur + id = DM_TRANSFORM_CHANGE_SPECIES_AND_TAUR_EGG + changes_species = TRUE + changes_ears_tail_wing_nocolor = TRUE + stabilize_nutrition = TRUE + +/datum/digest_mode/transform/egg/replica + id = DM_TRANSFORM_REPLICA_EGG + changes_eyes = TRUE + changes_hairandskin = TRUE + changes_species = TRUE + changes_ears_tail_wing_color = TRUE \ No newline at end of file diff --git a/code/modules/vore/eating/bellymodes_tf_vr.dm b/code/modules/vore/eating/bellymodes_tf_vr.dm deleted file mode 100644 index 2120ea78fd..0000000000 --- a/code/modules/vore/eating/bellymodes_tf_vr.dm +++ /dev/null @@ -1,92 +0,0 @@ -/obj/belly/proc/process_tf(mode, list/touchable_mobs) //We pass mode so it's mega-ultra local. - /* May not be necessary... Transform only shows up in the panel for humans. - if(!ishuman(owner)) - return //Need DNA and junk for this. - */ - - //Cast here for reduced duplication - var/mob/living/carbon/human/O = owner - - var/stabilize_nutrition = FALSE - var/changes_eyes = FALSE - var/changes_hair_solo = FALSE - var/changes_hairandskin = FALSE - var/changes_gender = FALSE - var/changes_gender_to = null - var/changes_species = FALSE - var/changes_ears_tail_wing_nocolor = FALSE - var/changes_ears_tail_wing_color = FALSE - var/eggs = FALSE - - switch(mode) - if(DM_TRANSFORM_HAIR_AND_EYES) - stabilize_nutrition = TRUE - changes_eyes = TRUE - changes_hair_solo = TRUE - if(DM_TRANSFORM_MALE, DM_TRANSFORM_FEMALE, DM_TRANSFORM_MALE_EGG, DM_TRANSFORM_FEMALE_EGG) - changes_eyes = TRUE - changes_hairandskin = TRUE - changes_gender = TRUE - changes_gender_to = (mode == DM_TRANSFORM_MALE || mode == DM_TRANSFORM_MALE_EGG) ? MALE : FEMALE - stabilize_nutrition = TRUE - eggs = (mode == DM_TRANSFORM_MALE_EGG || mode == DM_TRANSFORM_FEMALE_EGG) - if(DM_TRANSFORM_KEEP_GENDER, DM_TRANSFORM_KEEP_GENDER_EGG) - changes_eyes = TRUE - changes_hairandskin = TRUE - stabilize_nutrition = TRUE - eggs = (mode == DM_TRANSFORM_KEEP_GENDER_EGG) - if(DM_TRANSFORM_CHANGE_SPECIES_AND_TAUR, DM_TRANSFORM_CHANGE_SPECIES_AND_TAUR_EGG) - changes_species = TRUE - changes_ears_tail_wing_nocolor = TRUE - stabilize_nutrition = TRUE - eggs = (mode == DM_TRANSFORM_CHANGE_SPECIES_AND_TAUR_EGG) - if(DM_TRANSFORM_REPLICA, DM_TRANSFORM_REPLICA_EGG) - changes_eyes = TRUE - changes_hairandskin = TRUE - changes_species = TRUE - changes_ears_tail_wing_color = TRUE - eggs = (mode == DM_TRANSFORM_REPLICA_EGG) - if(DM_EGG) - eggs = TRUE - - /* This is designed to do *gradual* transformations. - * For each human in the TF belly per cycle, they can only have one "stage" of transformation applied to them. - * Some transformation modes have different amounts of stages than others and that's okay. - * All stages in order: Eyes, Hair & Skin, Ears & Tail & Wings & Species, Gender, Egg - */ - for(var/mob/living/carbon/human/H in touchable_mobs) - if(H.stat == DEAD) - continue - if(stabilize_nutrition) - if(O.nutrition > 400 && H.nutrition < 400) - O.adjust_nutrition(-2) - H.adjust_nutrition(1.5) - if(changes_eyes && check_eyes(H)) - change_eyes(H, 1) - continue - if(changes_hair_solo && check_hair(H)) - change_hair(H) - continue - if(changes_hairandskin && (check_hair(H) || check_skin(H))) - change_hair(H) - change_skin(H, 1) - continue - if(changes_species) - if(changes_ears_tail_wing_nocolor && (check_ears(H) || check_tail_nocolor(H) || check_wing_nocolor(H) || check_species(H))) - change_ears(H) - change_tail_nocolor(H) - change_wing_nocolor(H) - change_species(H, 1, 1) // ,1) preserves coloring - continue - if(changes_ears_tail_wing_color && (check_ears(H) || check_tail(H) || check_wing(H) || check_species(H))) - change_ears(H) - change_tail(H) - change_wing(H) - change_species(H, 1, 2) // ,2) does not preserve coloring. - continue - if(changes_gender && check_gender(H, changes_gender_to)) - change_gender(H, changes_gender_to, 1) - continue - if(eggs && (!H.absorbed)) - put_in_egg(H, 1) - continue \ No newline at end of file diff --git a/code/modules/vore/eating/bellymodes_vr.dm b/code/modules/vore/eating/bellymodes_vr.dm index caf75ac3c6..9c2021fac2 100644 --- a/code/modules/vore/eating/bellymodes_vr.dm +++ b/code/modules/vore/eating/bellymodes_vr.dm @@ -17,19 +17,13 @@ /////////////////////////// Sound Selections /////////////////////////// var/sound/prey_digest - var/sound/prey_death var/sound/pred_digest - var/sound/pred_death if(!fancy_vore) prey_digest = sound(get_sfx("classic_digestion_sounds")) - prey_death = sound(get_sfx("classic_death_sounds")) pred_digest = sound(get_sfx("classic_digestion_sounds")) - pred_death = sound(get_sfx("classic_death_sounds")) else prey_digest = sound(get_sfx("fancy_digest_prey")) - prey_death = sound(get_sfx("fancy_death_prey")) pred_digest = sound(get_sfx("fancy_digest_pred")) - pred_death = sound(get_sfx("fancy_death_pred")) /////////////////////////// Exit Early //////////////////////////// var/list/touchable_atoms = contents - items_preserved @@ -99,11 +93,13 @@ else if(istype(A, /obj/effect/decal/cleanable)) qdel(A) - if(digest_mode == DM_HOLD) - //We deliberately do not want any gurgly noises if the belly is in DM_HOLD - if(to_update) - updateVRPanels() - return + var/datum/digest_mode/DM = GLOB.digest_modes["[digest_mode]"] + if(!DM) + log_debug("Digest mode [digest_mode] didn't exist in the digest_modes list!!") + return FALSE + + if(!digestion_noise_chance) + digestion_noise_chance = DM.noise_chance if(digest_mode == DM_TRANSFORM) process_tf(tf_mode, touchable_mobs) @@ -112,89 +108,92 @@ var/mob/living/L = target if(!istype(L)) continue - switch(digest_mode) - if(DM_DIGEST) - digestion_noise_chance = 50 - //Pref protection! - if(!L.digestable || L.absorbed) - continue + var/sound/soundToPlay = DM.process(src, target) + if(soundToPlay && !play_sound) + play_sound = soundToPlay + //switch(digest_mode) + // if(DM_DIGEST) + // digestion_noise_chance = 50 + // //Pref protection! + // if(!L.digestable || L.absorbed) + // continue - //Person just died in guts! - if(L.stat == DEAD) - play_sound = pred_death - if(L.is_preference_enabled(/datum/client_preference/digestion_noises)) - SEND_SOUND(L, prey_death) - handle_digestion_death(L) - to_update = TRUE - continue + // //Person just died in guts! + // if(L.stat == DEAD) + // play_sound = pred_death + // if(L.is_preference_enabled(/datum/client_preference/digestion_noises)) + // SEND_SOUND(L, prey_death) + // handle_digestion_death(L) + // to_update = TRUE + // continue - // Deal digestion damage (and feed the pred) - var/old_brute = L.getBruteLoss() - var/old_burn = L.getFireLoss() - L.adjustBruteLoss(digest_brute) - L.adjustFireLoss(digest_burn) - var/actual_brute = L.getBruteLoss() - old_brute - var/actual_burn = L.getFireLoss() - old_burn - var/damage_gain = actual_brute + actual_burn + // // Deal digestion damage (and feed the pred) + // var/old_brute = L.getBruteLoss() + // var/old_burn = L.getFireLoss() + // L.adjustBruteLoss(digest_brute) + // L.adjustFireLoss(digest_burn) + // var/actual_brute = L.getBruteLoss() - old_brute + // var/actual_burn = L.getFireLoss() - old_burn + // var/damage_gain = actual_brute + actual_burn - var/offset = (1 + ((L.weight - 137) / 137)) // 130 pounds = .95 140 pounds = 1.02 - var/difference = owner.size_multiplier / L.size_multiplier - if(isrobot(owner)) - var/mob/living/silicon/robot/R = owner - R.cell.charge += 25 * damage_gain - if(offset) // If any different than default weight, multiply the % of offset. - owner.adjust_nutrition(offset*((nutrition_percent / 100) * 4.5 * (damage_gain) / difference)) //4.5 nutrition points per health point. Normal same size 100+100 health prey with average weight would give 900 points if the digestion was instant. With all the size/weight offset taxes plus over time oxyloss+hunger taxes deducted with non-instant digestion, this should be enough to not leave the pred starved. - else - owner.adjust_nutrition((nutrition_percent / 100) * 4.5 * (damage_gain) / difference) - if(DM_ABSORB) - if(!L.absorbable || L.absorbed) - continue - digestion_noise_chance = 10 - steal_nutrition(L) - if(L.nutrition < 100) - absorb_living(L) - to_update = TRUE - if(DM_UNABSORB) - if(L.absorbed && owner.nutrition >= 100) - L.absorbed = FALSE - to_chat(L, "You suddenly feel solid again.") - to_chat(owner,"You feel like a part of you is missing.") - owner.adjust_nutrition(-100) - to_update = TRUE - if(DM_DRAIN) - digestion_noise_chance = 10 - steal_nutrition(L) - if(DM_SHRINK) - digestion_noise_chance = 10 - if(L.size_multiplier > shrink_grow_size) - L.resize(L.size_multiplier - 0.01) // Shrink by 1% per tick - steal_nutrition(L) - if(DM_GROW) - digestion_noise_chance = 10 - if(L.size_multiplier < shrink_grow_size) - L.resize(L.size_multiplier - 0.01) // Grow by 1% per tick - if(DM_SIZE_STEAL) - digestion_noise_chance = 10 - if(L.size_multiplier > shrink_grow_size && owner.size_multiplier < 2) //Grow until either pred is large or prey is small. - owner.resize(owner.size_multiplier+0.01) //Grow by 1% per tick. - L.resize(L.size_multiplier-0.01) //Shrink by 1% per tick - steal_nutrition(L) - if(DM_HEAL) - digestion_noise_chance = 50 //Wet heals! The secret is you can leave this on for gurgle noises for fun. - if(L.stat == DEAD) - continue // Can't heal the dead with healbelly - if(owner.nutrition > 90 && (L.health < L.maxHealth)) - L.adjustBruteLoss(-2.5) - L.adjustFireLoss(-2.5) - L.adjustToxLoss(-5) - L.adjustOxyLoss(-5) - L.adjustCloneLoss(-1.25) - owner.adjust_nutrition(-2) - if(L.nutrition <= 400) - L.adjust_nutrition(1) - else if(owner.nutrition > 90 && (L.nutrition <= 400)) - owner.adjust_nutrition(-1) - L.adjust_nutrition(1) + // var/offset = (1 + ((L.weight - 137) / 137)) // 130 pounds = .95 140 pounds = 1.02 + // var/difference = owner.size_multiplier / L.size_multiplier + // if(isrobot(owner)) + // var/mob/living/silicon/robot/R = owner + // R.cell.charge += 25 * damage_gain + // if(offset) // If any different than default weight, multiply the % of offset. + // owner.adjust_nutrition(offset*((nutrition_percent / 100) * 4.5 * (damage_gain) / difference)) //4.5 nutrition points per health point. Normal same size 100+100 health prey with average weight would give 900 points if the digestion was instant. With all the size/weight offset taxes plus over time oxyloss+hunger taxes deducted with non-instant digestion, this should be enough to not leave the pred starved. + // else + // owner.adjust_nutrition((nutrition_percent / 100) * 4.5 * (damage_gain) / difference) + // if(DM_ABSORB) + // if(!L.absorbable || L.absorbed) + // continue + // digestion_noise_chance = 10 + // steal_nutrition(L) + // if(L.nutrition < 100) + // absorb_living(L) + // to_update = TRUE + // if(DM_UNABSORB) + // if(L.absorbed && owner.nutrition >= 100) + // L.absorbed = FALSE + // to_chat(L, "You suddenly feel solid again.") + // to_chat(owner,"You feel like a part of you is missing.") + // owner.adjust_nutrition(-100) + // to_update = TRUE + // if(DM_DRAIN) + // digestion_noise_chance = 10 + // steal_nutrition(L) + // if(DM_SHRINK) + // digestion_noise_chance = 10 + // if(L.size_multiplier > shrink_grow_size) + // L.resize(L.size_multiplier - 0.01) // Shrink by 1% per tick + // steal_nutrition(L) + // if(DM_GROW) + // digestion_noise_chance = 10 + // if(L.size_multiplier < shrink_grow_size) + // L.resize(L.size_multiplier - 0.01) // Grow by 1% per tick + // if(DM_SIZE_STEAL) + // digestion_noise_chance = 10 + // if(L.size_multiplier > shrink_grow_size && owner.size_multiplier < 2) //Grow until either pred is large or prey is small. + // owner.resize(owner.size_multiplier+0.01) //Grow by 1% per tick. + // L.resize(L.size_multiplier-0.01) //Shrink by 1% per tick + // steal_nutrition(L) + // if(DM_HEAL) + // digestion_noise_chance = 50 //Wet heals! The secret is you can leave this on for gurgle noises for fun. + // if(L.stat == DEAD) + // continue // Can't heal the dead with healbelly + // if(owner.nutrition > 90 && (L.health < L.maxHealth)) + // L.adjustBruteLoss(-2.5) + // L.adjustFireLoss(-2.5) + // L.adjustToxLoss(-5) + // L.adjustOxyLoss(-5) + // L.adjustCloneLoss(-1.25) + // owner.adjust_nutrition(-2) + // if(L.nutrition <= 400) + // L.adjust_nutrition(1) + // else if(owner.nutrition > 90 && (L.nutrition <= 400)) + // owner.adjust_nutrition(-1) + // L.adjust_nutrition(1) /////////////////////////// Make any noise /////////////////////////// if(digestion_noise_chance && prob(digestion_noise_chance)) From c76e9b24a64bfee9f4bd14e29aaba9c72e72fc0d Mon Sep 17 00:00:00 2001 From: ShadowLarkens Date: Thu, 30 Apr 2020 19:09:53 -0700 Subject: [PATCH 2/3] Datumization of vore bellymodes --- code/modules/vore/eating/belly_obj_vr.dm | 1 - .../vore/eating/bellymodes_datum_vr.dm | 50 +++-- code/modules/vore/eating/bellymodes_vr.dm | 194 ++++++------------ code/modules/vore/eating/transforming_vr.dm | 4 +- code/modules/vore/eating/vorepanel_vr.dm | 57 +++-- vorestation.dme | 2 +- 6 files changed, 118 insertions(+), 190 deletions(-) diff --git a/code/modules/vore/eating/belly_obj_vr.dm b/code/modules/vore/eating/belly_obj_vr.dm index 627934c6f3..ebde3b5eae 100644 --- a/code/modules/vore/eating/belly_obj_vr.dm +++ b/code/modules/vore/eating/belly_obj_vr.dm @@ -54,7 +54,6 @@ var/tmp/mob/living/owner // The mob whose belly this is. var/tmp/digest_mode = DM_HOLD // Current mode the belly is set to from digest_modes (+transform_modes if human) - var/tmp/tf_mode = DM_TRANSFORM_REPLICA // Current transformation mode. var/tmp/list/items_preserved = list() // Stuff that wont digest so we shouldn't process it again. var/tmp/next_emote = 0 // When we're supposed to print our next emote, as a world.time var/tmp/recent_sound = FALSE // Prevent audio spam diff --git a/code/modules/vore/eating/bellymodes_datum_vr.dm b/code/modules/vore/eating/bellymodes_datum_vr.dm index 591d106db4..213bde706a 100644 --- a/code/modules/vore/eating/bellymodes_datum_vr.dm +++ b/code/modules/vore/eating/bellymodes_datum_vr.dm @@ -4,8 +4,8 @@ GLOBAL_LIST_INIT(digest_modes, list()) var/id = DM_HOLD var/noise_chance = 0 -/datum/digest_mode/process_mob(obj/belly/B, mob/living/L) - return +/datum/digest_mode/proc/process_mob(obj/belly/B, mob/living/L) + return null /datum/digest_mode/digest id = DM_DIGEST @@ -14,7 +14,7 @@ GLOBAL_LIST_INIT(digest_modes, list()) /datum/digest_mode/digest/process_mob(obj/belly/B, mob/living/L) //Pref protection! if(!L.digestable || L.absorbed) - return + return null //Person just died in guts! if(L.stat == DEAD) @@ -24,16 +24,15 @@ GLOBAL_LIST_INIT(digest_modes, list()) else SEND_SOUND(L, sound(get_sfx("fancy_death_prey"))) B.handle_digestion_death(L) - to_update = TRUE if(!B.fancy_vore) - return sound(get_sfx("classic_death_sounds")) - return sound(get_sfx("fancy_death_pred")) + return list("to_update" = TRUE, "soundToPlay" = sound(get_sfx("classic_death_sounds"))) + return list("to_update" = TRUE, "soundToPlay" = sound(get_sfx("fancy_death_pred"))) // Deal digestion damage (and feed the pred) var/old_brute = L.getBruteLoss() var/old_burn = L.getFireLoss() - L.adjustBruteLoss(digest_brute) - L.adjustFireLoss(digest_burn) + L.adjustBruteLoss(B.digest_brute) + L.adjustFireLoss(B.digest_burn) var/actual_brute = L.getBruteLoss() - old_brute var/actual_burn = L.getFireLoss() - old_burn var/damage_gain = actual_brute + actual_burn @@ -44,9 +43,9 @@ GLOBAL_LIST_INIT(digest_modes, list()) var/mob/living/silicon/robot/R = B.owner R.cell.charge += 25 * damage_gain if(offset) // If any different than default weight, multiply the % of offset. - B.owner.adjust_nutrition(offset*((nutrition_percent / 100) * 4.5 * (damage_gain) / difference)) //4.5 nutrition points per health point. Normal same size 100+100 health prey with average weight would give 900 points if the digestion was instant. With all the size/weight offset taxes plus over time oxyloss+hunger taxes deducted with non-instant digestion, this should be enough to not leave the pred starved. + B.owner.adjust_nutrition(offset*((B.nutrition_percent / 100) * 4.5 * (damage_gain) / difference)) //4.5 nutrition points per health point. Normal same size 100+100 health prey with average weight would give 900 points if the digestion was instant. With all the size/weight offset taxes plus over time oxyloss+hunger taxes deducted with non-instant digestion, this should be enough to not leave the pred starved. else - B.owner.adjust_nutrition((nutrition_percent / 100) * 4.5 * (damage_gain) / difference) + B.owner.adjust_nutrition((B.nutrition_percent / 100) * 4.5 * (damage_gain) / difference) /datum/digest_mode/absorb id = DM_ABSORB @@ -54,12 +53,11 @@ GLOBAL_LIST_INIT(digest_modes, list()) /datum/digest_mode/absorb/process_mob(obj/belly/B, mob/living/L) if(!L.absorbable || L.absorbed) - continue - digestion_noise_chance = 10 - steal_nutrition(L) + return null + B.steal_nutrition(L) if(L.nutrition < 100) - absorb_living(L) - to_update = TRUE + B.absorb_living(L) + return list("to_update" = TRUE) /datum/digest_mode/unabsorb id = DM_UNABSORB @@ -70,14 +68,14 @@ GLOBAL_LIST_INIT(digest_modes, list()) to_chat(L, "You suddenly feel solid again.") to_chat(B.owner,"You feel like a part of you is missing.") B.owner.adjust_nutrition(-100) - to_update = TRUE + return list("to_update" = TRUE) /datum/digest_mode/drain id = DM_DRAIN noise_chance = 10 /datum/digest_mode/drain/process_mob(obj/belly/B, mob/living/L) - steal_nutrition(L) + B.steal_nutrition(L) /datum/digest_mode/drain/shrink id = DM_SHRINK @@ -110,7 +108,7 @@ GLOBAL_LIST_INIT(digest_modes, list()) /datum/digest_mode/heal/process_mob(obj/belly/B, mob/living/L) if(L.stat == DEAD) - continue // Can't heal the dead with healbelly + return null // Can't heal the dead with healbelly if(B.owner.nutrition > 90 && (L.health < L.maxHealth)) L.adjustBruteLoss(-2.5) L.adjustFireLoss(-2.5) @@ -139,40 +137,40 @@ GLOBAL_LIST_INIT(digest_modes, list()) /datum/digest_mode/transform/process_mob(obj/belly/B, mob/living/carbon/human/H) if(!istype(H) || H.stat == DEAD) - return + return null if(stabilize_nutrition) if(B.owner.nutrition > 400 && H.nutrition < 400) B.owner.adjust_nutrition(-2) H.adjust_nutrition(1.5) if(changes_eyes && B.check_eyes(H)) B.change_eyes(H, 1) - return + return null if(changes_hair_solo && B.check_hair(H)) B.change_hair(H) - return + return null if(changes_hairandskin && (B.check_hair(H) || B.check_skin(H))) B.change_hair(H) B.change_skin(H, 1) - return + return null if(changes_species) if(changes_ears_tail_wing_nocolor && (B.check_ears(H) || B.check_tail_nocolor(H) || B.check_wing_nocolor(H) || B.check_species(H))) B.change_ears(H) B.change_tail_nocolor(H) B.change_wing_nocolor(H) B.change_species(H, 1, 1) // ,1) preserves coloring - return + return null if(changes_ears_tail_wing_color && (B.check_ears(H) || B.check_tail(H) || B.check_wing(H) || B.check_species(H))) B.change_ears(H) B.change_tail(H) B.change_wing(H) B.change_species(H, 1, 2) // ,2) does not preserve coloring. - return + return null if(changes_gender && B.check_gender(H, changes_gender_to)) B.change_gender(H, changes_gender_to, 1) - return + return null if(eggs && (!H.absorbed)) B.put_in_egg(H, 1) - return + return null // Regular TF Modes /datum/digest_mode/transform/hairandeyes diff --git a/code/modules/vore/eating/bellymodes_vr.dm b/code/modules/vore/eating/bellymodes_vr.dm index 9c2021fac2..d11af09376 100644 --- a/code/modules/vore/eating/bellymodes_vr.dm +++ b/code/modules/vore/eating/bellymodes_vr.dm @@ -16,6 +16,7 @@ prey_loop() /////////////////////////// Sound Selections /////////////////////////// + var/digestion_noise_chance = 0 var/sound/prey_digest var/sound/pred_digest if(!fancy_vore) @@ -30,19 +31,73 @@ if(!length(touchable_atoms)) return - var/list/touchable_mobs = list() + var/list/touchable_mobs = null + + var/list/hta_returns = handle_touchable_atoms(touchable_atoms) + if(islist(hta_returns)) + if(hta_returns["digestion_noise_chance"]) + digestion_noise_chance = hta_returns["digestion_noise_chance"] + if(hta_returns["touchable_mobs"]) + touchable_mobs = hta_returns["touchable_mobs"] + if(hta_returns["to_update"]) + to_update = hta_returns["to_update"] + + if(!islist(touchable_mobs)) + return ///////////////////// Early Non-Mode Handling ///////////////////// - if(contents.len && next_emote <= world.time) + var/list/EL = emote_lists[digest_mode] + if(LAZYLEN(EL) && touchable_mobs && next_emote <= world.time) next_emote = world.time + emote_time - var/list/EL = emote_lists[digest_mode] - if(LAZYLEN(EL)) - for(var/mob/living/M in contents) - if(M.digestable || digest_mode != DM_DIGEST) // don't give digesty messages to indigestible people - to_chat(M, "[pick(EL)]") + for(var/mob/living/M in contents) + if(digest_mode == DM_DIGEST && !M.digestable) + continue // don't give digesty messages to indigestible people + to_chat(M, "[pick(EL)]") + var/datum/digest_mode/DM = GLOB.digest_modes["[digest_mode]"] + if(!DM) + log_debug("Digest mode [digest_mode] didn't exist in the digest_modes list!!") + return FALSE + + if(!digestion_noise_chance) + digestion_noise_chance = DM.noise_chance + + for(var/target in touchable_mobs) + var/mob/living/L = target + if(!istype(L)) + continue + var/list/returns = DM.process_mob(src, target) + if(istype(returns) && returns["to_update"]) + to_update = TRUE + if(istype(returns) && returns["soundToPlay"] && !play_sound) + play_sound = returns["soundToPlay"] + +/////////////////////////// Make any noise /////////////////////////// + if(digestion_noise_chance && prob(digestion_noise_chance)) + for(var/mob/M in contents) + if(M && M.is_preference_enabled(/datum/client_preference/digestion_noises)) + SEND_SOUND(M, prey_digest) + play_sound = pred_digest + + if(play_sound) + for(var/mob/M in hearers(VORE_SOUND_RANGE, owner)) //so we don't fill the whole room with the sound effect + if(!M.is_preference_enabled(/datum/client_preference/digestion_noises)) + continue + if(isturf(M.loc) || (M.loc != src)) //to avoid people on the inside getting the outside sounds and their direct sounds + built in sound pref check + if(fancy_vore) + M.playsound_local(owner.loc, play_sound, vol = 75, vary = 1, falloff = VORE_SOUND_FALLOFF) + else + M.playsound_local(owner.loc, play_sound, vol = 100, vary = 1, falloff = VORE_SOUND_FALLOFF) + //these are all external sound triggers now, so it's ok. + + if(to_update) + updateVRPanels() + +/obj/belly/proc/handle_touchable_atoms(list/touchable_atoms) var/did_an_item = FALSE // Only do one item per cycle. + var/to_update = FALSE var/digestion_noise_chance = 0 + var/list/touchable_mobs = list() for(var/A in touchable_atoms) //Handle stray items @@ -93,130 +148,7 @@ else if(istype(A, /obj/effect/decal/cleanable)) qdel(A) - var/datum/digest_mode/DM = GLOB.digest_modes["[digest_mode]"] - if(!DM) - log_debug("Digest mode [digest_mode] didn't exist in the digest_modes list!!") - return FALSE - - if(!digestion_noise_chance) - digestion_noise_chance = DM.noise_chance - - if(digest_mode == DM_TRANSFORM) - process_tf(tf_mode, touchable_mobs) - - for(var/target in touchable_mobs) - var/mob/living/L = target - if(!istype(L)) - continue - var/sound/soundToPlay = DM.process(src, target) - if(soundToPlay && !play_sound) - play_sound = soundToPlay - //switch(digest_mode) - // if(DM_DIGEST) - // digestion_noise_chance = 50 - // //Pref protection! - // if(!L.digestable || L.absorbed) - // continue - - // //Person just died in guts! - // if(L.stat == DEAD) - // play_sound = pred_death - // if(L.is_preference_enabled(/datum/client_preference/digestion_noises)) - // SEND_SOUND(L, prey_death) - // handle_digestion_death(L) - // to_update = TRUE - // continue - - // // Deal digestion damage (and feed the pred) - // var/old_brute = L.getBruteLoss() - // var/old_burn = L.getFireLoss() - // L.adjustBruteLoss(digest_brute) - // L.adjustFireLoss(digest_burn) - // var/actual_brute = L.getBruteLoss() - old_brute - // var/actual_burn = L.getFireLoss() - old_burn - // var/damage_gain = actual_brute + actual_burn - - // var/offset = (1 + ((L.weight - 137) / 137)) // 130 pounds = .95 140 pounds = 1.02 - // var/difference = owner.size_multiplier / L.size_multiplier - // if(isrobot(owner)) - // var/mob/living/silicon/robot/R = owner - // R.cell.charge += 25 * damage_gain - // if(offset) // If any different than default weight, multiply the % of offset. - // owner.adjust_nutrition(offset*((nutrition_percent / 100) * 4.5 * (damage_gain) / difference)) //4.5 nutrition points per health point. Normal same size 100+100 health prey with average weight would give 900 points if the digestion was instant. With all the size/weight offset taxes plus over time oxyloss+hunger taxes deducted with non-instant digestion, this should be enough to not leave the pred starved. - // else - // owner.adjust_nutrition((nutrition_percent / 100) * 4.5 * (damage_gain) / difference) - // if(DM_ABSORB) - // if(!L.absorbable || L.absorbed) - // continue - // digestion_noise_chance = 10 - // steal_nutrition(L) - // if(L.nutrition < 100) - // absorb_living(L) - // to_update = TRUE - // if(DM_UNABSORB) - // if(L.absorbed && owner.nutrition >= 100) - // L.absorbed = FALSE - // to_chat(L, "You suddenly feel solid again.") - // to_chat(owner,"You feel like a part of you is missing.") - // owner.adjust_nutrition(-100) - // to_update = TRUE - // if(DM_DRAIN) - // digestion_noise_chance = 10 - // steal_nutrition(L) - // if(DM_SHRINK) - // digestion_noise_chance = 10 - // if(L.size_multiplier > shrink_grow_size) - // L.resize(L.size_multiplier - 0.01) // Shrink by 1% per tick - // steal_nutrition(L) - // if(DM_GROW) - // digestion_noise_chance = 10 - // if(L.size_multiplier < shrink_grow_size) - // L.resize(L.size_multiplier - 0.01) // Grow by 1% per tick - // if(DM_SIZE_STEAL) - // digestion_noise_chance = 10 - // if(L.size_multiplier > shrink_grow_size && owner.size_multiplier < 2) //Grow until either pred is large or prey is small. - // owner.resize(owner.size_multiplier+0.01) //Grow by 1% per tick. - // L.resize(L.size_multiplier-0.01) //Shrink by 1% per tick - // steal_nutrition(L) - // if(DM_HEAL) - // digestion_noise_chance = 50 //Wet heals! The secret is you can leave this on for gurgle noises for fun. - // if(L.stat == DEAD) - // continue // Can't heal the dead with healbelly - // if(owner.nutrition > 90 && (L.health < L.maxHealth)) - // L.adjustBruteLoss(-2.5) - // L.adjustFireLoss(-2.5) - // L.adjustToxLoss(-5) - // L.adjustOxyLoss(-5) - // L.adjustCloneLoss(-1.25) - // owner.adjust_nutrition(-2) - // if(L.nutrition <= 400) - // L.adjust_nutrition(1) - // else if(owner.nutrition > 90 && (L.nutrition <= 400)) - // owner.adjust_nutrition(-1) - // L.adjust_nutrition(1) - -/////////////////////////// Make any noise /////////////////////////// - if(digestion_noise_chance && prob(digestion_noise_chance)) - for(var/mob/M in contents) - if(M && M.is_preference_enabled(/datum/client_preference/digestion_noises)) - SEND_SOUND(M, prey_digest) - play_sound = pred_digest - - if(play_sound) - for(var/mob/M in hearers(VORE_SOUND_RANGE, owner)) //so we don't fill the whole room with the sound effect - if(!M.is_preference_enabled(/datum/client_preference/digestion_noises)) - continue - if(isturf(M.loc) || (M.loc != src)) //to avoid people on the inside getting the outside sounds and their direct sounds + built in sound pref check - if(fancy_vore) - M.playsound_local(owner.loc, play_sound, vol = 75, vary = 1, falloff = VORE_SOUND_FALLOFF) - else - M.playsound_local(owner.loc, play_sound, vol = 100, vary = 1, falloff = VORE_SOUND_FALLOFF) - //these are all external sound triggers now, so it's ok. - - if(to_update) - updateVRPanels() - - return + return list("to_update" = to_update, "touchable_mobs" = touchable_mobs, "digestion_noise_chance" = digestion_noise_chance) /obj/belly/proc/prey_loop() for(var/mob/living/M in contents) diff --git a/code/modules/vore/eating/transforming_vr.dm b/code/modules/vore/eating/transforming_vr.dm index 3e78920419..8f9eea2371 100644 --- a/code/modules/vore/eating/transforming_vr.dm +++ b/code/modules/vore/eating/transforming_vr.dm @@ -206,7 +206,7 @@ if(!istype(M) || !istype(O)) return 0 - if(M.species != O.species || M.custom_species != O.custom_species) + if(M.species.name != O.species.name || M.custom_species != O.custom_species) return 1 return 0 @@ -227,7 +227,7 @@ if(color_action == 1) M.set_species(O.species.name,0,1,M) else if(color_action == 2) - M.set_species(O.species.name,0,1,O) + M.species = O.species else M.set_species(O.species.name) M.custom_species = O.custom_species diff --git a/code/modules/vore/eating/vorepanel_vr.dm b/code/modules/vore/eating/vorepanel_vr.dm index 02421f8298..357345d273 100644 --- a/code/modules/vore/eating/vorepanel_vr.dm +++ b/code/modules/vore/eating/vorepanel_vr.dm @@ -125,32 +125,30 @@ spanstyle = "color:purple;" if(DM_SIZE_STEAL) spanstyle = "color:purple;" - if(DM_TRANSFORM) - switch(B.tf_mode) - if(DM_TRANSFORM_MALE) - spanstyle = "color:purple;" - if(DM_TRANSFORM_HAIR_AND_EYES) - spanstyle = "color:purple;" - if(DM_TRANSFORM_FEMALE) - spanstyle = "color:purple;" - if(DM_TRANSFORM_KEEP_GENDER) - spanstyle = "color:purple;" - if(DM_TRANSFORM_CHANGE_SPECIES_AND_TAUR) - spanstyle = "color:purple;" - if(DM_TRANSFORM_CHANGE_SPECIES_AND_TAUR_EGG) - spanstyle = "color:purple;" - if(DM_TRANSFORM_REPLICA) - spanstyle = "color:purple;" - if(DM_TRANSFORM_REPLICA_EGG) - spanstyle = "color:purple;" - if(DM_TRANSFORM_KEEP_GENDER_EGG) - spanstyle = "color:purple;" - if(DM_TRANSFORM_MALE_EGG) - spanstyle = "color:purple;" - if(DM_TRANSFORM_FEMALE_EGG) - spanstyle = "color:purple;" - if(DM_EGG) - spanstyle = "color:purple;" + if(DM_TRANSFORM_MALE) + spanstyle = "color:purple;" + if(DM_TRANSFORM_HAIR_AND_EYES) + spanstyle = "color:purple;" + if(DM_TRANSFORM_FEMALE) + spanstyle = "color:purple;" + if(DM_TRANSFORM_KEEP_GENDER) + spanstyle = "color:purple;" + if(DM_TRANSFORM_CHANGE_SPECIES_AND_TAUR) + spanstyle = "color:purple;" + if(DM_TRANSFORM_CHANGE_SPECIES_AND_TAUR_EGG) + spanstyle = "color:purple;" + if(DM_TRANSFORM_REPLICA) + spanstyle = "color:purple;" + if(DM_TRANSFORM_REPLICA_EGG) + spanstyle = "color:purple;" + if(DM_TRANSFORM_KEEP_GENDER_EGG) + spanstyle = "color:purple;" + if(DM_TRANSFORM_MALE_EGG) + spanstyle = "color:purple;" + if(DM_TRANSFORM_FEMALE_EGG) + spanstyle = "color:purple;" + if(DM_EGG) + spanstyle = "color:purple;" belly_list += " ([B.contents.len])" @@ -203,7 +201,7 @@ //Digest Mode Button var/mode = selected.digest_mode - dat += "
Belly Mode: [mode == DM_TRANSFORM ? selected.tf_mode : mode]" + dat += "
Belly Mode: [mode]" //Mode addons button var/list/flag_list = list() @@ -581,10 +579,11 @@ if(new_mode == DM_TRANSFORM) //Snowflek submenu var/list/tf_list = selected.transform_modes - var/new_tf_mode = input("Choose TF Mode (currently [selected.tf_mode])") as null|anything in tf_list + var/new_tf_mode = input("Choose TF Mode (currently [selected.digest_mode])") as null|anything in tf_list if(!new_tf_mode) return FALSE - selected.tf_mode = new_tf_mode + selected.digest_mode = new_tf_mode + return selected.digest_mode = new_mode //selected.items_preserved.Cut() //Re-evaltuate all items in belly on belly-mode change //Handled with item modes now diff --git a/vorestation.dme b/vorestation.dme index 0f2cb48d5d..65788808c0 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -3427,7 +3427,7 @@ #include "code\modules\vore\appearance\update_icons_vr.dm" #include "code\modules\vore\eating\belly_dat_vr.dm" #include "code\modules\vore\eating\belly_obj_vr.dm" -#include "code\modules\vore\eating\bellymodes_tf_vr.dm" +#include "code\modules\vore\eating\bellymodes_datum_vr.dm" #include "code\modules\vore\eating\bellymodes_vr.dm" #include "code\modules\vore\eating\contaminate_vr.dm" #include "code\modules\vore\eating\digest_act_vr.dm" From d063058994efbf61b85d0a1ac6c14504f35b7317 Mon Sep 17 00:00:00 2001 From: ShadowLarkens Date: Fri, 1 May 2020 20:53:15 -0700 Subject: [PATCH 3/3] Add a description to the process_mob proc --- code/modules/vore/eating/bellymodes_datum_vr.dm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/code/modules/vore/eating/bellymodes_datum_vr.dm b/code/modules/vore/eating/bellymodes_datum_vr.dm index 213bde706a..19deb66621 100644 --- a/code/modules/vore/eating/bellymodes_datum_vr.dm +++ b/code/modules/vore/eating/bellymodes_datum_vr.dm @@ -4,6 +4,13 @@ GLOBAL_LIST_INIT(digest_modes, list()) var/id = DM_HOLD var/noise_chance = 0 +/** + * This proc has all the behavior for the given digestion mode. + * It returns either null, or an associative list in the following format: + * list("to_update" = TRUE/FALSE, "soundToPlay" = sound()) + * where to_update is whether or not a updateVorePanel() call is necessary, + * and soundToPlay will play the given sound at the end of the process tick. + */ /datum/digest_mode/proc/process_mob(obj/belly/B, mob/living/L) return null