From: MirceaKitsune Date: Mon, 18 Jul 2011 11:28:42 +0000 (+0300) Subject: New system for applying stomach load and weight X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f079ab19316f936dcd5a208068ab0a18c9968c3c;p=voretournament%2Fvoretournament.git New system for applying stomach load and weight --- diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index 9b8c85dd..548e19b6 100644 --- a/data/qcsrc/server/vore.qc +++ b/data/qcsrc/server/vore.qc @@ -69,16 +69,6 @@ float Swallow_condition_check(entity prey) return FALSE; } -float Prey_Mass(entity prey) -{ - float vore_mass; - vore_mass = cvar("g_balance_vore_load_prey_mass"); - if(cvar("g_healthsize")) - vore_mass *= prey.scale; - vore_mass = ceil(vore_mass); - return vore_mass; -} - float Stomach_TeamMates_check(entity pred) { // checks if a player's stomach contains any team mates @@ -185,16 +175,37 @@ void Vore_GurgleSound() } } -void Vore_WeightApply(entity e) +void Vore_StomachLoad_Apply() { - // apply stomach weight that makes you heavier the more you eat + // apply stomach weight that makes you heavier and larger the more you eat // slowing the player is done in cl_physics.qc - if(e.stomach_load != e.vore_oldstomachload) - e.gravity += 1 + (e.stomach_load / e.stomach_maxload * cvar("g_balance_vore_load_pred_weight") - e.vore_oldstomachload); - if(e.gravity == 0) - e.gravity = 0.00001; // 0 becomes 1 for gravity, so do this to allow 0 gravity - e.vore_oldstomachload = e.stomach_load; + entity e; + float vore_mass; + + self.stomach_load = 0; // start from zero + FOR_EACH_PLAYER(e) + { + if(e.predator == self && e.classname == "player") + { + vore_mass = cvar("g_balance_vore_load_prey_mass"); + if(cvar("g_healthsize")) + vore_mass *= self.scale; + self.stomach_load += floor(vore_mass); + } + } + + if(self.stomach_load != self.vore_oldstomachload) + self.gravity += 1 + (self.stomach_load / self.stomach_maxload * cvar("g_balance_vore_load_pred_weight") - self.vore_oldstomachload); + if(self.gravity == 0) + self.gravity = 0.00001; // 0 becomes 1 for gravity, so do this to allow 0 gravity + self.vore_oldstomachload = self.stomach_load; + + // apply the stomach capacity of the predator + self.stomach_maxload = cvar("g_balance_vore_load_pred_capacity"); + if(cvar("g_healthsize")) + self.stomach_maxload *= self.scale; + self.stomach_maxload = floor(self.stomach_maxload); } void Vore_AutoDigest(entity e) @@ -320,11 +331,9 @@ void Vore_Swallow(entity e) PlayerSound(e.predator, playersound_swallow, CHAN_VOICE, VOICETYPE_PLAYERSOUND); setanim(e.predator, e.predator.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing / regurgitating e.predator.punchangle_x -= cvar("g_balance_vore_swallow_punchangle"); - e.predator.stomach_load += Prey_Mass(e); e.predator.regurgitate_prepare = 0; 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_WeightApply(e.predator); Vore_AutoDigest(e.predator); // block firing for a small amount of time, or we'll be firing the next frame after we swallow @@ -411,10 +420,8 @@ void Vore_Regurgitate(entity e) setanim(e.predator, e.predator.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing / regurgitating pointparticles(particleeffectnum("vore_regurgitate"), e.predator.origin, '0 0 0', 1); e.predator.punchangle_x += cvar("g_balance_vore_regurgitate_punchangle"); - e.predator.stomach_load -= Prey_Mass(e); e.predator.regurgitate_prepare = 0; e.predator.action_delay = time + cvar("g_balance_vore_action_delay"); - Vore_WeightApply(e.predator); // block firing for a small amount of time, or we'll be firing the next frame e.weapon_delay = time + button_delay_time; @@ -435,8 +442,6 @@ void Vore_DeadPrey_Configure(entity e) // first release the prey from the predator, as dead prey needs to be attached differently // the predator's stomach load is also decreased, as dead prey doesn't count any more - e.predator.stomach_load -= Prey_Mass(e); - Vore_WeightApply(e.predator); e.predator = world; // now put our dead prey inside the predator's stomach, but only as an effect @@ -794,11 +799,8 @@ void Vore() entity prey; prey = Swallow_player_check(); - // set the predator's stomach capacity - self.stomach_maxload = cvar("g_balance_vore_load_pred_capacity"); - if(cvar("g_healthsize")) - self.stomach_maxload *= self.scale; - self.stomach_maxload = floor(self.stomach_maxload); + // set the predator's stomach load and capacity + Vore_StomachLoad_Apply(); // attempt to swallow our new prey if we pressed the attack button, and there's any in range self.stat_canswallow = 0;