]> git.xonotic.org Git - voretournament/voretournament.git/commitdiff
Properly prevent swallowing more players than your maximum capacity
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 18 Jul 2011 14:42:42 +0000 (17:42 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 18 Jul 2011 14:42:42 +0000 (17:42 +0300)
data/qcsrc/server/vore.qc

index fa499430e88dc48dac6ec494188688a666af3f6a..4870d4658170f1473463249c371bfb232d2daaef 100644 (file)
@@ -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\r
        if(!self.BUTTON_REGURGITATE && time > self.action_delay)\r
        {\r
+               float prey_mass;\r
+               prey_mass = cvar("g_balance_vore_load_prey_mass");\r
+               if(cvar("g_healthsize"))\r
+                       prey_mass *= prey.scale;\r
+\r
                string swallow_complain;\r
                if(teams_matter && prey.team == self.team && !cvar("g_vore_teamvore"))\r
                        swallow_complain = "You cannot swallow your team mates\n";\r
                else if(!cvar("g_vore_spawnshield") && prey.spawnshieldtime > time)\r
                        swallow_complain = "You cannot swallow someone protected by the spawn shield\n";\r
-               else if(self.stomach_load >= self.stomach_maxload)\r
-                       swallow_complain = "You do not have any more room to swallow this player.\n";\r
+               else if(self.stomach_load + prey_mass > self.stomach_maxload)\r
+                       swallow_complain = "You don't have any more room to swallow this player.\n";\r
                else if(cvar("g_vore_biggergut") && prey.stomach_load > self.stomach_load)\r
                        swallow_complain = "You cannot swallow someone with a bigger stomach than yours\n";\r
                else if(cvar("g_vore_biggersize") && prey.scale > self.scale)\r
@@ -146,7 +151,7 @@ void Vore_StomachLoad_Apply()
        // slowing the player is done in cl_physics.qc\r
 \r
        entity e;\r
-       float vore_mass;\r
+       float prey_mass;\r
 \r
        // apply the stomach capacity of the predator\r
        self.stomach_maxload = cvar("g_balance_vore_load_pred_capacity");\r
@@ -159,10 +164,10 @@ void Vore_StomachLoad_Apply()
        {\r
                if(e.predator == self && e.classname == "player")\r
                {\r
-                       vore_mass = cvar("g_balance_vore_load_prey_mass");\r
+                       prey_mass = cvar("g_balance_vore_load_prey_mass");\r
                        if(cvar("g_healthsize"))\r
-                               vore_mass *= e.scale;\r
-                       self.stomach_load += floor(vore_mass);\r
+                               prey_mass *= e.scale;\r
+                       self.stomach_load += floor(prey_mass);\r
                }\r
        }\r
 \r