From b01a23e3f7aaf3bd15aeb7e10dd65e4c3fcd1b4c Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Mon, 18 Jul 2011 17:42:42 +0300 Subject: [PATCH] Properly prevent swallowing more players than your maximum capacity --- data/qcsrc/server/vore.qc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index fa499430..4870d465 100644 --- a/data/qcsrc/server/vore.qc +++ b/data/qcsrc/server/vore.qc @@ -41,13 +41,18 @@ float Swallow_condition_check(entity prey) if(self.classname == "player" && !self.stat_eaten && self.deadflag == DEAD_NO) // we can't swallow players while inside someone's stomach ourselves if(!self.BUTTON_REGURGITATE && time > self.action_delay) { + float prey_mass; + prey_mass = cvar("g_balance_vore_load_prey_mass"); + if(cvar("g_healthsize")) + prey_mass *= prey.scale; + string swallow_complain; if(teams_matter && prey.team == self.team && !cvar("g_vore_teamvore")) swallow_complain = "You cannot swallow your team mates\n"; else if(!cvar("g_vore_spawnshield") && prey.spawnshieldtime > time) swallow_complain = "You cannot swallow someone protected by the spawn shield\n"; - else if(self.stomach_load >= self.stomach_maxload) - swallow_complain = "You do not have any more room to swallow this player.\n"; + else if(self.stomach_load + prey_mass > self.stomach_maxload) + swallow_complain = "You don't have any more room to swallow this player.\n"; else if(cvar("g_vore_biggergut") && prey.stomach_load > self.stomach_load) swallow_complain = "You cannot swallow someone with a bigger stomach than yours\n"; else if(cvar("g_vore_biggersize") && prey.scale > self.scale) @@ -146,7 +151,7 @@ void Vore_StomachLoad_Apply() // slowing the player is done in cl_physics.qc entity e; - float vore_mass; + float prey_mass; // apply the stomach capacity of the predator self.stomach_maxload = cvar("g_balance_vore_load_pred_capacity"); @@ -159,10 +164,10 @@ void Vore_StomachLoad_Apply() { if(e.predator == self && e.classname == "player") { - vore_mass = cvar("g_balance_vore_load_prey_mass"); + prey_mass = cvar("g_balance_vore_load_prey_mass"); if(cvar("g_healthsize")) - vore_mass *= e.scale; - self.stomach_load += floor(vore_mass); + prey_mass *= e.scale; + self.stomach_load += floor(prey_mass); } } -- 2.39.2