From: MirceaKitsune Date: Sat, 19 Nov 2011 17:43:24 +0000 (+0200) Subject: As usual, there's always a bug to any change. Fix how the autodigest feature is activated X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b32948c837ab9e300202b54165068c7b25aab62b;p=voretournament%2Fvoretournament.git As usual, there's always a bug to any change. Fix how the autodigest feature is activated --- diff --git a/data/qcsrc/server/t_items.qc b/data/qcsrc/server/t_items.qc index 54af0c60..559fa572 100644 --- a/data/qcsrc/server/t_items.qc +++ b/data/qcsrc/server/t_items.qc @@ -351,8 +351,6 @@ void Item_Consumable_Spawn(entity e, entity pl) pl.punchangle_x -= cvar("g_balance_vore_swallow_predator_punchangle_item"); pl.regurgitate_prepare = 0; pl.action_delay = time + cvar("g_balance_vore_action_delay"); - if(pl.cvar_cl_vore_autodigest > 0) - Vore_AutoDigest(pl); } void Item_DroppedConsumable_Touch() diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index b6e40b95..c690955f 100644 --- a/data/qcsrc/server/vore.qc +++ b/data/qcsrc/server/vore.qc @@ -146,6 +146,22 @@ void Vore_GurgleSound() } } +void Vore_AutoDigest(entity e) +{ + // if the predator has the autodigest preference enabled, begin digesting new prey automatically + + if(!cvar("g_vore_digestion") || e.digesting) + return; + if(clienttype(e) != CLIENTTYPE_REAL) + return; // this feature is only for players, not bots + if(e.stomach_load) + 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 + if(Stomach_TeamMates_check(e)) + return; // never begin automatic digestion if we've swallowed a team mate + + e.digesting = TRUE; +} + void Vore_StomachLoad_Apply() { // apply stomach weight that makes you heavier and larger the more you eat @@ -171,12 +187,18 @@ void Vore_StomachLoad_Apply() if(cvar("g_healthsize")) prey_mass *= e.scale; self.stomach_load += ceil(prey_mass); + if(self.cvar_cl_vore_autodigest > 1) + Vore_AutoDigest(self); } } for(e = world; (e = find(e, classname, "consumable")); ) { if(e.predator == self) + { self.stomach_load += ceil(e.dmg); + if(self.cvar_cl_vore_autodigest > 0) + Vore_AutoDigest(self); + } } // apply weight @@ -185,22 +207,6 @@ void Vore_StomachLoad_Apply() self.gravity = 0.00001; // 0 becomes 1 for gravity, so do this to allow 0 gravity } -void Vore_AutoDigest(entity e) -{ - // if the predator has the autodigest preference enabled, begin digesting new prey automatically - - if(!cvar("g_vore_digestion") || e.digesting) - return; - if(!e.cvar_cl_vore_autodigest || clienttype(e) != CLIENTTYPE_REAL) - return; // this feature is only for players, not bots - if(e.stomach_load) - 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 - if(Stomach_TeamMates_check(e)) - return; // never begin automatic digestion if we've swallowed a team mate - - e.digesting = TRUE; -} - .entity swallow_model; float Vore_SwallowModel_CustomizeEntityForClient() { @@ -313,8 +319,6 @@ void Vore_Swallow(entity e) e.predator.spawnshieldtime = 0; // lose spawn shield when we vore e.predator.hitsound += 1; // play this for team mates too, as we could be swallowing them to heal them Vore_SetPreyPositions(e.predator); - if(e.predator.cvar_cl_vore_autodigest > 1) - Vore_AutoDigest(e.predator); // block firing for a small amount of time, or we'll be firing the next frame after we swallow e.predator.weapon_delay = time + button_delay_time;