mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
[MIRROR] Vore preference helpers (#11893)
Co-authored-by: Guti <32563288+TheCaramelion@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
dcd92a466f
commit
179d800bc7
80
code/_helpers/vore.dm
Normal file
80
code/_helpers/vore.dm
Normal file
@@ -0,0 +1,80 @@
|
||||
// Grew a little tired of having to juggle with preference checks
|
||||
// So instead of having multiple checks all over the code
|
||||
// Let's get some helper procs so that we don't have to do it ALL OVER
|
||||
|
||||
/// Most basic check of them all.
|
||||
/// Checks if PRED can eat PREY.
|
||||
/proc/CanVore(mob/living/pred, mob/living/prey)
|
||||
if(!istype(pred) || !istype(prey))
|
||||
return FALSE
|
||||
if(!prey.devourable)
|
||||
return FALSE
|
||||
if(!is_vore_predator(pred))
|
||||
return FALSE
|
||||
if(prey.is_incorporeal() || pred.is_incorporeal())
|
||||
return FALSE
|
||||
if(!pred.vore_selected)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/// Basic spont vore check.
|
||||
/// Checks if both have spont vore enable
|
||||
/proc/CanSpontaneousVore(mob/living/pred, mob/living/prey)
|
||||
if(!CanVore(pred, prey))
|
||||
return FALSE
|
||||
if(!pred.can_be_drop_pred || !prey.can_be_drop_prey)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/proc/CanStumbleVore(mob/living/pred, mob/living/prey)
|
||||
if(!CanSpontaneousVore(pred, prey))
|
||||
return FALSE
|
||||
if(!pred.stumble_vore || !prey.stumble_vore)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/proc/CanDropVore(mob/living/pred, mob/living/prey)
|
||||
if(!CanSpontaneousVore(pred, prey))
|
||||
return FALSE
|
||||
if(!pred.drop_vore || !prey.stumble_vore)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/proc/CanThrowVore(mob/living/pred, mob/living/prey)
|
||||
if(!CanSpontaneousVore(pred, prey))
|
||||
return FALSE
|
||||
if(!pred.throw_vore || !prey.throw_vore)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/proc/CanFoodVore(mob/living/pred, mob/living/prey)
|
||||
if(!CanSpontaneousVore(pred, prey))
|
||||
return FALSE
|
||||
if(!pred.food_vore || !prey.food_vore)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/proc/CanPhaseVore(mob/living/pred, mob/living/prey)
|
||||
if(!CanSpontaneousVore(pred, prey))
|
||||
return FALSE
|
||||
if(!pred.phase_vore || !prey.phase_vore)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/proc/CanSlipVore(mob/living/pred, mob/living/prey)
|
||||
if(!CanSpontaneousVore(pred, prey))
|
||||
return FALSE
|
||||
if(!pred.slip_vore && !prey.slip_vore)
|
||||
return FALSE
|
||||
if(!pred.is_slipping || !prey.is_slipping)
|
||||
return FALSE
|
||||
if(world.time <= prey.slip_protect)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/proc/CanAnimalVore(mob/living/pred, mob/living/prey)
|
||||
if(!CanVore(pred, prey))
|
||||
return FALSE
|
||||
if(!prey.allowmobvore && isanimal(pred) && !pred.ckey || (!pred.allowmobvore && isanimal(prey) && !prey.ckey))
|
||||
return FALSE
|
||||
return TRUE
|
||||
@@ -156,7 +156,7 @@
|
||||
/obj/effect/abstract/dark_maw/proc/do_trigger(var/mob/living/L)
|
||||
var/will_vore = 1
|
||||
|
||||
if(!owner || !(target in owner) || !L.devourable || !L.can_be_drop_prey || !owner.can_be_drop_pred || !L.phase_vore)
|
||||
if(!(target in owner) || CanPhaseVore(owner, L))
|
||||
will_vore = 0
|
||||
|
||||
if(!src || src.gc_destroyed)
|
||||
|
||||
@@ -169,12 +169,12 @@
|
||||
var/mob/living/our_prey
|
||||
if(potentials.len)
|
||||
var/mob/living/target = pick(potentials)
|
||||
if(can_be_drop_pred && istype(target) && target.devourable && target.can_be_drop_prey && target.phase_vore && vore_selected && phase_vore)
|
||||
if(CanPhaseVore(src, target))
|
||||
target.forceMove(vore_selected)
|
||||
to_chat(target, span_vwarning("\The [src] phases in around you, [vore_selected.vore_verb]ing you into their [vore_selected.get_belly_name()]!"))
|
||||
to_chat(src, span_vwarning("You phase around [target], [vore_selected.vore_verb]ing them into your [vore_selected.get_belly_name()]!"))
|
||||
our_prey = target
|
||||
else if(can_be_drop_prey && istype(target) && devourable && target.can_be_drop_pred && target.phase_vore && target.vore_selected && phase_vore)
|
||||
else if(CanPhaseVore(target, src))
|
||||
our_prey = src
|
||||
forceMove(target.vore_selected)
|
||||
to_chat(target, span_vwarning("\The [src] phases into you, [target.vore_selected.vore_verb]ing them into your [target.vore_selected.get_belly_name()]!"))
|
||||
|
||||
@@ -108,7 +108,7 @@ Bonus
|
||||
var/place
|
||||
|
||||
for(var/mob/living/carbon/human/B in range(A.stage, mob))
|
||||
if(B.can_be_drop_pred && mob.can_be_drop_prey && mob.devourable)
|
||||
if(CanSpontaneousVore(B, mob))
|
||||
destination += B.vore_selected
|
||||
|
||||
for(var/turf/T in range(A.stage, mob))
|
||||
@@ -124,10 +124,10 @@ Bonus
|
||||
|
||||
var/mob/living/unlucky = locate() in place
|
||||
|
||||
if(unlucky && !unlucky.is_incorporeal())
|
||||
if(unlucky.can_be_drop_pred && mob.can_be_drop_prey && mob.devourable)
|
||||
if(unlucky)
|
||||
if(CanSpontaneousVore(unlucky, mob))
|
||||
place = unlucky.vore_selected
|
||||
else if(unlucky.devourable && unlucky.can_be_drop_prey && mob.can_be_drop_pred)
|
||||
else if(CanSpontaneousVore(mob, unlucky))
|
||||
unlucky.forceMove(mob.vore_selected)
|
||||
|
||||
mob.emote("sneeze")
|
||||
|
||||
@@ -125,64 +125,11 @@
|
||||
return
|
||||
|
||||
//Person being slipped into eats the person slipping
|
||||
if(can_slip_vore(pred = source, prey = crossed)) //If we can vore them go for it
|
||||
if(CanSlipVore(pred = source, prey = crossed)) //If we can vore them go for it
|
||||
source.begin_instant_nom(source, prey = crossed, pred = source, belly = source.vore_selected)
|
||||
return COMPONENT_BLOCK_CROSS
|
||||
|
||||
//The person slipping eats the person being slipped into
|
||||
else if(can_slip_vore(pred = crossed, prey = source))
|
||||
else if(CanSlipVore(pred = crossed, prey = source))
|
||||
source.begin_instant_nom(crossed, prey = source, pred = crossed, belly = crossed.vore_selected) //Must be
|
||||
return //We DON'T block it here. Pred can slip onto the prey's tile, no problem.
|
||||
|
||||
|
||||
///Helper Procs
|
||||
/proc/CanStumbleVore(mob/living/prey, mob/living/pred)
|
||||
if(!can_spontaneous_vore(pred, prey))
|
||||
return FALSE
|
||||
if(!prey.stumble_vore || !pred.stumble_vore)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/proc/CanDropVore(mob/living/prey, mob/living/pred)
|
||||
if(!can_spontaneous_vore(pred, prey))
|
||||
return FALSE
|
||||
if(!pred.drop_vore || !prey.drop_vore)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/proc/CanThrowVore(mob/living/prey, mob/living/pred)
|
||||
if(!can_spontaneous_vore(pred, prey))
|
||||
return FALSE
|
||||
if(!pred.throw_vore || !prey.throw_vore)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/proc/can_slip_vore(mob/living/pred, mob/living/prey)
|
||||
if(!can_spontaneous_vore(pred, prey))
|
||||
return FALSE
|
||||
if(!prey.is_slipping && !pred.is_slipping) //Obviously they have to be slipping to get slip vored
|
||||
return FALSE
|
||||
if(world.time <= prey.slip_protect)
|
||||
return FALSE
|
||||
if(!pred.slip_vore || !prey.slip_vore)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
///This is a general 'do we have the mechanical ability to do any type of spontaneous vore' without specialties.
|
||||
/proc/can_spontaneous_vore(mob/living/pred, mob/living/prey)
|
||||
if(!istype(pred) || !istype(prey))
|
||||
return FALSE
|
||||
//Unfortunately, can_be_drop_prey is 'spontanous prey' var and can_be_drop_pred is 'spontaneous pred' var...horribly named imo.
|
||||
if(!prey.can_be_drop_prey || !pred.can_be_drop_pred)
|
||||
return FALSE
|
||||
if(prey.is_incorporeal() || pred.is_incorporeal())
|
||||
return FALSE
|
||||
if(!prey.devourable)
|
||||
return FALSE
|
||||
if(!is_vore_predator(pred)) //Check their bellies and stuff
|
||||
return FALSE
|
||||
if(!pred.vore_selected) //Gotta have one selected as well.
|
||||
return FALSE
|
||||
if(!prey.allowmobvore && isanimal(pred) && !pred.ckey || (!pred.allowmobvore && isanimal(prey) && !prey.ckey))
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
@@ -34,11 +34,10 @@
|
||||
/atom/movable/proc/end_fall(var/crushing = FALSE)
|
||||
if(isliving(src))
|
||||
var/mob/living/L = src
|
||||
if(L.vore_selected && L.can_be_drop_pred && L.drop_vore)
|
||||
for(var/mob/living/P in loc)
|
||||
if(P.can_be_drop_prey && P.drop_vore)
|
||||
L.feed_grabbed_to_self_falling_nom(L,P)
|
||||
L.visible_message(span_vdanger("\The [L] falls right onto \the [P]!"))
|
||||
for(var/mob/living/P in loc)
|
||||
if(CanDropVore(L, P))
|
||||
L.feed_grabbed_to_self_falling_nom(L,P)
|
||||
L.visible_message(span_vdanger("\The [L] falls right onto \the [P]!"))
|
||||
|
||||
if(crushing)
|
||||
for(var/atom/movable/AM in loc)
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
if(food_inserted_micros && food_inserted_micros.len)
|
||||
for(var/mob/living/F in food_inserted_micros)
|
||||
food_inserted_micros -= F
|
||||
if(!F.can_be_drop_prey || !F.food_vore)
|
||||
if(!CanFoodVore(M, F))
|
||||
F.forceMove(get_turf(src))
|
||||
else
|
||||
F.forceMove(M.vore_selected)
|
||||
|
||||
@@ -296,7 +296,7 @@
|
||||
return
|
||||
else if(isliving(source))
|
||||
var/mob/living/L = source
|
||||
if(gargoyle.throw_vore && L.throw_vore && gargoyle.can_be_drop_pred && L.can_be_drop_prey)
|
||||
if(CanThrowVore(gargoyle, L))
|
||||
var/drop_prey_temp = FALSE
|
||||
if(gargoyle.can_be_drop_prey)
|
||||
drop_prey_temp = TRUE
|
||||
|
||||
@@ -91,26 +91,22 @@
|
||||
user = M
|
||||
|
||||
if(food_inserted_micros && food_inserted_micros.len)
|
||||
if(M.can_be_drop_pred && M.food_vore && M.vore_selected)
|
||||
for(var/mob/living/F in food_inserted_micros)
|
||||
if(!F.can_be_drop_prey || !F.food_vore)
|
||||
continue
|
||||
for(var/mob/living/F in food_inserted_micros)
|
||||
var/do_nom = FALSE
|
||||
if(!reagents.total_volume)
|
||||
do_nom = TRUE
|
||||
else
|
||||
var/nom_chance = (1 - (reagents.total_volume / volume))*100
|
||||
if(prob(nom_chance))
|
||||
do_nom = TRUE
|
||||
|
||||
if(do_nom)
|
||||
if(!CanFoodVore(M, F))
|
||||
continue
|
||||
if(isanimal(M) && !F.allowmobvore && !M.ckey) //If the one doing the eating is a simple mob controlled by AI, check mob vore prefs
|
||||
continue
|
||||
|
||||
var/do_nom = FALSE
|
||||
|
||||
if(!reagents.total_volume)
|
||||
do_nom = TRUE
|
||||
else
|
||||
var/nom_chance = (1 - (reagents.total_volume / volume))*100
|
||||
if(prob(nom_chance))
|
||||
do_nom = TRUE
|
||||
|
||||
if(do_nom)
|
||||
F.forceMove(M.vore_selected)
|
||||
food_inserted_micros -= F
|
||||
F.forceMove(M.vore_selected)
|
||||
food_inserted_micros -= F
|
||||
|
||||
if(!reagents.total_volume && changed)
|
||||
M.visible_message(span_notice("[M] finishes drinking from \the [src]."),span_notice("You finish drinking from \the [src]."))
|
||||
|
||||
@@ -59,23 +59,21 @@
|
||||
//Placeholder for effect that trigger on eating that aren't tied to reagents.
|
||||
/obj/item/reagent_containers/food/snacks/proc/On_Consume(var/mob/living/M)
|
||||
if(food_inserted_micros && food_inserted_micros.len)
|
||||
if(M.can_be_drop_pred && M.food_vore && M.vore_selected)
|
||||
for(var/mob/living/F in food_inserted_micros)
|
||||
if(!F.can_be_drop_prey || !F.food_vore)
|
||||
continue
|
||||
for(var/mob/living/F in food_inserted_micros)
|
||||
var/do_nom = FALSE
|
||||
|
||||
var/do_nom = FALSE
|
||||
|
||||
if(!reagents.total_volume)
|
||||
if(!reagents.total_volume)
|
||||
do_nom = TRUE
|
||||
else
|
||||
var/nom_chance = (bitecount/(bitecount + (bitesize / reagents.total_volume) + 1))*100
|
||||
if(prob(nom_chance))
|
||||
do_nom = TRUE
|
||||
else
|
||||
var/nom_chance = (bitecount/(bitecount + (bitesize / reagents.total_volume) + 1))*100
|
||||
if(prob(nom_chance))
|
||||
do_nom = TRUE
|
||||
|
||||
if(do_nom)
|
||||
F.forceMove(M.vore_selected)
|
||||
food_inserted_micros -= F
|
||||
if(do_nom)
|
||||
if(!CanFoodVore(M, F))
|
||||
continue
|
||||
F.forceMove(M.vore_selected)
|
||||
food_inserted_micros -= F
|
||||
|
||||
if(!reagents.total_volume)
|
||||
M.balloon_alert_visible("eats \the [src].","finishes eating \the [src].")
|
||||
|
||||
@@ -404,7 +404,7 @@ emp_act
|
||||
return
|
||||
// PERSON BEING HIT: CAN BE DROP PRED, ALLOWS THROW VORE.
|
||||
// PERSON BEING THROWN: DEVOURABLE, ALLOWS THROW VORE, CAN BE DROP PREY.
|
||||
if((can_be_drop_pred && throw_vore && vore_selected) && (thrown_mob.devourable && thrown_mob.throw_vore && thrown_mob.can_be_drop_prey)) //Prey thrown into pred.
|
||||
if(CanThrowVore(src, thrown_mob))
|
||||
vore_selected.nom_mob(thrown_mob) //Eat them!!!
|
||||
visible_message(span_vwarning("[thrown_mob] is thrown right into [src]'s [lowertext(vore_selected.name)]!"))
|
||||
if(thrown_mob.loc != vore_selected)
|
||||
@@ -414,7 +414,7 @@ emp_act
|
||||
|
||||
// PERSON BEING HIT: CAN BE DROP PREY, ALLOWS THROW VORE, AND IS DEVOURABLE.
|
||||
// PERSON BEING THROWN: CAN BE DROP PRED, ALLOWS THROW VORE.
|
||||
else if((can_be_drop_prey && throw_vore && devourable) && (thrown_mob.can_be_drop_pred && thrown_mob.throw_vore && thrown_mob.vore_selected)) //Pred thrown into prey.
|
||||
else if(CanThrowVore(thrown_mob, src)) //Pred thrown into prey.
|
||||
visible_message(span_vwarning("[src] suddenly slips inside of [thrown_mob]'s [lowertext(thrown_mob.vore_selected.name)] as [thrown_mob] flies into them!"))
|
||||
thrown_mob.vore_selected.nom_mob(src) //Eat them!!!
|
||||
if(src.loc != thrown_mob.vore_selected)
|
||||
|
||||
@@ -385,7 +385,7 @@
|
||||
var/list/potentials = living_mobs(0)
|
||||
if(potentials.len)
|
||||
var/mob/living/target = pick(potentials)
|
||||
if(istype(target) && target.devourable && target.can_be_drop_prey && vore_selected)
|
||||
if(CanSpontaneousVore(src, target))
|
||||
if(target.buckled)
|
||||
target.buckled.unbuckle_mob(target, force = TRUE)
|
||||
target.forceMove(vore_selected)
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
var/list/potentials = living_mobs(0)
|
||||
if(potentials.len)
|
||||
var/mob/living/target = pick(potentials)
|
||||
if(istype(target) && target.devourable && target.can_be_drop_prey && vore_selected)
|
||||
if(CanPhaseVore(src, target))
|
||||
target.forceMove(vore_selected)
|
||||
to_chat(target,span_vwarning("\The [src] phases in around you, [vore_selected.vore_verb]ing you into their [vore_selected.get_belly_name()]!"))
|
||||
|
||||
@@ -203,7 +203,7 @@
|
||||
var/list/potentials = living_mobs(0)
|
||||
if(potentials.len)
|
||||
var/mob/living/target = pick(potentials)
|
||||
if(istype(target) && target.devourable && target.can_be_drop_prey && vore_selected)
|
||||
if(CanPhaseVore(src, target))
|
||||
target.forceMove(vore_selected)
|
||||
to_chat(target,span_vwarning("\The [src] phases in around you, [vore_selected.vore_verb]ing you into their [vore_selected.get_belly_name()]!"))
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@
|
||||
var/list/potentials = living_mobs(0)
|
||||
if(potentials.len)
|
||||
var/mob/living/target = pick(potentials)
|
||||
if(istype(target) && target.devourable && target.can_be_drop_prey && vore_selected)
|
||||
if(CanSpontaneousVore(src, target))
|
||||
if(target.buckled)
|
||||
target.buckled.unbuckle_mob(target, force = TRUE)
|
||||
target.forceMove(vore_selected)
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
return ..()
|
||||
if(istype(A, /mob/living)) //Swoopie gonn swoop
|
||||
var/mob/living/M = A //typecast
|
||||
if(!M.devourable || !M.can_be_drop_prey)
|
||||
if(CanSpontaneousVore(src, A))
|
||||
return ..()
|
||||
Vac.afterattack(M, src, 1)
|
||||
return
|
||||
@@ -246,7 +246,7 @@
|
||||
for(var/atom/movable/AM in D)
|
||||
if(istype(AM, /mob/living))
|
||||
var/mob/living/M = AM
|
||||
if(!M.devourable || !M.can_be_drop_prey)
|
||||
if(!CanSpontaneousVore(src, M))
|
||||
to_chat(M, span_warning("[src] plunges their head into \the [D], while you narrowly avoid being sucked up!"))
|
||||
continue
|
||||
to_chat(M, span_warning("[src] plunges their head into \the [D], sucking up everything inside- Including you!"))
|
||||
|
||||
@@ -141,7 +141,7 @@
|
||||
belly_dest = pick(living_user.vore_organs)
|
||||
if(belly_dest)
|
||||
for(var/mob/living/prey in ToTurf)
|
||||
if(prey != user && prey.can_be_drop_prey)
|
||||
if(CanDropVore(user, prey))
|
||||
prey.forceMove(belly_dest)
|
||||
vore_happened = TRUE
|
||||
to_chat(prey, span_vdanger("[living_user] materializes around you, as you end up in their [belly_dest]!"))
|
||||
|
||||
@@ -119,18 +119,17 @@
|
||||
winner.visible_message(span_bold("\The [winner]") + " is suddenly knocked to the ground.")
|
||||
winner.SetWeakened(max(winner.weakened,50))
|
||||
if(TELEPORTING_CRACKER)
|
||||
if(loser.can_be_drop_pred && loser.vore_selected)
|
||||
if(winner.devourable && winner.can_be_drop_prey)
|
||||
winner.visible_message(span_bold("\The [winner]") + " is teleported to somewhere nearby...")
|
||||
var/datum/effect/effect/system/spark_spread/spk
|
||||
spk = new(winner)
|
||||
if(CanSpontaneousVore(loser, winner))
|
||||
winner.visible_message(span_bold("\The [winner]") + " is teleported to somewhere nearby...")
|
||||
var/datum/effect/effect/system/spark_spread/spk
|
||||
spk = new(winner)
|
||||
|
||||
var/T = get_turf(winner)
|
||||
spk.set_up(5, 0, winner)
|
||||
spk.attach(winner)
|
||||
playsound(T, "sparks", 50, 1)
|
||||
anim(T,winner,'icons/mob/mob.dmi',,"phaseout",,winner.dir)
|
||||
winner.forceMove(loser.vore_selected)
|
||||
var/T = get_turf(winner)
|
||||
spk.set_up(5, 0, winner)
|
||||
spk.attach(winner)
|
||||
playsound(T, "sparks", 50, 1)
|
||||
anim(T,winner,'icons/mob/mob.dmi',,"phaseout",,winner.dir)
|
||||
winner.forceMove(loser.vore_selected)
|
||||
if(WEALTHY_CRACKER)
|
||||
new /obj/random/cash/huge(spawnloc)
|
||||
new /obj/random/cash/huge(spawnloc)
|
||||
|
||||
@@ -316,6 +316,7 @@
|
||||
#include "code\_helpers\unsorted_vr.dm"
|
||||
#include "code\_helpers\verbs.dm"
|
||||
#include "code\_helpers\view.dm"
|
||||
#include "code\_helpers\vore.dm"
|
||||
#include "code\_helpers\weakref.dm"
|
||||
#include "code\_helpers\widelists_ch.dm"
|
||||
#include "code\_helpers\graphs\astar_ch.dm"
|
||||
|
||||
Reference in New Issue
Block a user