]> git.xonotic.org Git - voretournament/voretournament.git/commitdiff
As usual, there's always a bug to any change. Fix how the autodigest feature is activated
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 19 Nov 2011 17:43:24 +0000 (19:43 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 19 Nov 2011 17:43:24 +0000 (19:43 +0200)
data/qcsrc/server/t_items.qc
data/qcsrc/server/vore.qc

index 54af0c60a19db6ce9fbd8865ea44dd1d0bc46e23..559fa5728297b54f371d8c54855ff3ad9fa666c4 100644 (file)
@@ -351,8 +351,6 @@ void Item_Consumable_Spawn(entity e, entity pl)
        pl.punchangle_x -= cvar("g_balance_vore_swallow_predator_punchangle_item");\r
        pl.regurgitate_prepare = 0;\r
        pl.action_delay = time + cvar("g_balance_vore_action_delay");\r
-       if(pl.cvar_cl_vore_autodigest > 0)\r
-               Vore_AutoDigest(pl);\r
 }\r
 \r
 void Item_DroppedConsumable_Touch()\r
index b6e40b95e2ab23f40287f9f78b18c70e5c0a9733..c690955f10aa4cc2365d5cb347e3078529a2c2fe 100644 (file)
@@ -146,6 +146,22 @@ void Vore_GurgleSound()
        }\r
 }\r
 \r
+void Vore_AutoDigest(entity e)\r
+{\r
+       // if the predator has the autodigest preference enabled, begin digesting new prey automatically\r
+\r
+       if(!cvar("g_vore_digestion") || e.digesting)\r
+               return;\r
+       if(clienttype(e) != CLIENTTYPE_REAL)\r
+               return; // this feature is only for players, not bots\r
+       if(e.stomach_load)\r
+               return; // don't start digestion if we already ate someone, as that means we manually disabled it after the first prey and want it off\r
+       if(Stomach_TeamMates_check(e))\r
+               return; // never begin automatic digestion if we've swallowed a team mate\r
+\r
+       e.digesting = TRUE;\r
+}\r
+\r
 void Vore_StomachLoad_Apply()\r
 {\r
        // apply stomach weight that makes you heavier and larger the more you eat\r
@@ -171,12 +187,18 @@ void Vore_StomachLoad_Apply()
                        if(cvar("g_healthsize"))\r
                                prey_mass *= e.scale;\r
                        self.stomach_load += ceil(prey_mass);\r
+                       if(self.cvar_cl_vore_autodigest > 1)\r
+                               Vore_AutoDigest(self);\r
                }\r
        }\r
        for(e = world; (e = find(e, classname, "consumable")); )\r
        {\r
                if(e.predator == self)\r
+               {\r
                        self.stomach_load += ceil(e.dmg);\r
+                       if(self.cvar_cl_vore_autodigest > 0)\r
+                               Vore_AutoDigest(self);\r
+               }\r
        }\r
 \r
        // apply weight\r
@@ -185,22 +207,6 @@ void Vore_StomachLoad_Apply()
                self.gravity = 0.00001; // 0 becomes 1 for gravity, so do this to allow 0 gravity\r
 }\r
 \r
-void Vore_AutoDigest(entity e)\r
-{\r
-       // if the predator has the autodigest preference enabled, begin digesting new prey automatically\r
-\r
-       if(!cvar("g_vore_digestion") || e.digesting)\r
-               return;\r
-       if(!e.cvar_cl_vore_autodigest || clienttype(e) != CLIENTTYPE_REAL)\r
-               return; // this feature is only for players, not bots\r
-       if(e.stomach_load)\r
-               return; // don't start digestion if we already ate someone, as that means we manually disabled it after the first prey and want it off\r
-       if(Stomach_TeamMates_check(e))\r
-               return; // never begin automatic digestion if we've swallowed a team mate\r
-\r
-       e.digesting = TRUE;\r
-}\r
-\r
 .entity swallow_model;\r
 float Vore_SwallowModel_CustomizeEntityForClient()\r
 {\r
@@ -313,8 +319,6 @@ void Vore_Swallow(entity e)
        e.predator.spawnshieldtime = 0; // lose spawn shield when we vore\r
        e.predator.hitsound += 1; // play this for team mates too, as we could be swallowing them to heal them\r
        Vore_SetPreyPositions(e.predator);\r
-       if(e.predator.cvar_cl_vore_autodigest > 1)\r
-               Vore_AutoDigest(e.predator);\r
 \r
        // block firing for a small amount of time, or we'll be firing the next frame after we swallow\r
        e.predator.weapon_delay = time + button_delay_time;\r