From f55f300d90edcce5e8724867c26b05020b1cd830 Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Sat, 19 Nov 2011 15:49:44 +0200 Subject: [PATCH] Use a slightly different system for forced regurgitation in some cases, which is also compatible with consumable items (so they get thrown out in the same circumstances, like damage or excessive speed) --- data/qcsrc/server/g_damage.qc | 11 ++--------- data/qcsrc/server/vore.qc | 23 +++++++++++------------ data/qcsrc/server/vore.qh | 2 +- 3 files changed, 14 insertions(+), 22 deletions(-) diff --git a/data/qcsrc/server/g_damage.qc b/data/qcsrc/server/g_damage.qc index fc12a332..31f86668 100644 --- a/data/qcsrc/server/g_damage.qc +++ b/data/qcsrc/server/g_damage.qc @@ -699,15 +699,8 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float // if a predator is taking damage, check if he should regurgitate his prey, based on the damage he took if(cvar("g_balance_vore_escapeprobability")) - { - entity e; - FOR_EACH_PLAYER(e) - { - if(e.predator != world && e.predator == targ) - if(random() < cvar("g_balance_vore_escapeprobability") * damage) - Vore_Regurgitate(e); - } - } + if(targ.stomach_load && random() < cvar("g_balance_vore_escapeprobability") * damage) + targ.regurgitate_prepare = -1; // nullify damage if teamplay is on if(deathtype != DEATH_TELEFRAG) diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index 56f60da1..678aa901 100644 --- a/data/qcsrc/server/vore.qc +++ b/data/qcsrc/server/vore.qc @@ -1,4 +1,3 @@ -.float regurgitate_prepare; .float stomachkick_delay, system_delay, action_delay, digest_button_delay_time, regurgitate_button_delay_time; .float complain_vore; .float vore_oldmovetype, vore_oldsolid; @@ -822,6 +821,17 @@ void Vore() } } + if(self.stomach_load > self.stomach_maxload) // the predator got beyond his capacity after eating, so some prey must pop out + { + self.regurgitate_prepare = -1; + return; + } + if(cvar("g_balance_vore_load_pred_speedcap") && self.stomach_load && vlen(self.velocity) >= cvar("g_balance_vore_load_pred_speedcap") / (self.stomach_load / self.stomach_maxload)) // predator's going too fast, gets sick and throws up + { + self.regurgitate_prepare = -1; + return; + } + if(cvar("g_vore_gurglesound")) Vore_GurgleSound(); @@ -855,17 +865,6 @@ void Vore() self.predator.regurgitate_prepare = 0; } - if(self.predator.stomach_load > self.predator.stomach_maxload) // the predator got beyond his capacity after eating, so some prey must pop out - { - Vore_Regurgitate(self); - return; - } - if(cvar("g_balance_vore_load_pred_speedcap") && vlen(self.predator.velocity) >= cvar("g_balance_vore_load_pred_speedcap") / (self.predator.stomach_load / self.predator.stomach_maxload)) // predator's going too fast, gets sick and throws up - { - Vore_Regurgitate(self); - return; - } - // apply delayed regurgitating if it was scheduled if(self.predator.regurgitate_prepare && time > self.predator.regurgitate_prepare) { diff --git a/data/qcsrc/server/vore.qh b/data/qcsrc/server/vore.qh index 07fde63c..baf9ffbc 100644 --- a/data/qcsrc/server/vore.qh +++ b/data/qcsrc/server/vore.qh @@ -1,6 +1,6 @@ void Vore(); -void Vore_Regurgitate(entity e); void Vore_Disconnect(); +.float regurgitate_prepare; entity Swallow_player_check(); float Swallow_condition_check(entity prey); -- 2.39.2