return FALSE;\r
}\r
\r
+float Stomach_TeamMates_check(entity pred)\r
+{\r
+ // checks if a player's stomach contains any team mates\r
+\r
+ entity head;\r
+ if(teams_matter)\r
+ {\r
+ FOR_EACH_PLAYER(head)\r
+ {\r
+ if(head.predator == pred && head.team == pred.team)\r
+ return TRUE;\r
+ }\r
+ }\r
+ return FALSE;\r
+}\r
+\r
float Vore_CanLeave()\r
{\r
if(self.predator.classname == "player")\r
}\r
\r
.float gurgle_oldstomachload;\r
-void Vore_Gurglesound()\r
+void Vore_GurgleSound()\r
{\r
if(time > self.gurglesound_finished || self.gurgle_oldstomachload != self.stomach_load)\r
{\r
}\r
}\r
\r
-void Vore_Weight_apply(entity e)\r
+void Vore_WeightApply(entity e)\r
{\r
// apply stomach weight that makes you heavier the more you eat\r
// slowing the player is done in cl_physics.qc\r
e.vore_oldstomachload = e.stomach_load;\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 > 1)\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 pusher;\r
.float pushltime;\r
void Vore_Swallow(entity e)\r
e.predator.stomach_load += 1;\r
e.predator.regurgitate_prepare = 0;\r
e.predator.spawnshieldtime = 0; // lose spawn shield when we vore\r
- Vore_Weight_apply(e.predator);\r
+ Vore_WeightApply(e.predator);\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
e.predator.stomach_load -= 1;\r
e.predator.regurgitate_prepare = 0;\r
e.predator.swallow_delay = time + cvar("g_balance_vore_swallow_delay");\r
- Vore_Weight_apply(e.predator);\r
+ Vore_WeightApply(e.predator);\r
\r
// block firing for a small amount of time, or we'll be firing the next frame\r
e.weapon_delay = time + button_delay_time;\r
\r
void Vore_DeadPrey_Configure(entity e)\r
{\r
- // ran when the fulldigest feature is enabled and prey stays inside the stomach after dying\r
+ // ran when the keepdeadprey feature is enabled and prey stays inside the stomach after dying\r
\r
- if(e.fakepredator.classname == "player")\r
+ if(e.fakeprey || e.predator.classname != "player") // already configured\r
return;\r
\r
- // this entity is pretty much like e.predator but for dead prey, to avoid some conflicts\r
+ // this entity is like e.predator but for dead prey, to avoid conflicts\r
e.fakepredator = e.predator;\r
+ e.fakeprey = TRUE;\r
\r
- // first release the prey from the predator, as dead prey needs to be attached to predators differently\r
- // the predator's stomach load is also decreased, as our dead prey doesn't count as actual prey any more\r
+ // first release the prey from the predator, as dead prey needs to be attached differently\r
+ // the predator's stomach load is also decreased, as dead prey doesn't count any more\r
e.predator.stomach_load -= 1;\r
- Vore_Weight_apply(e.predator);\r
+ Vore_WeightApply(e.predator);\r
e.predator = world;\r
\r
- // now, keep our dead prey inside the predator's stomach\r
+ // now put our dead prey inside the predator's stomach, but only as an effect\r
e.movetype = MOVETYPE_FOLLOW;\r
+ e.takedamage = DAMAGE_NO;\r
+ e.solid = SOLID_NOT;\r
e.aiment = e.fakepredator;\r
+\r
+ // completely remove the dead body\r
e.alpha = -1;\r
}\r
\r
void Vore_DeadPrey_Detach(entity e)\r
{\r
// ran when dead prey must be detached from the stomach (eg: they are respawning)\r
+ // should only execute after Vore_DeadPrey_Configure has ran first\r
\r
- if(e.fakepredator.classname != "player")\r
+ if not(cvar("g_vore_keepdeadprey"))\r
return;\r
\r
- e.movetype = e.vore_oldmovetype;\r
- e.view_ofs_z = PL_VIEW_OFS_z;\r
- e.alpha = default_player_alpha;\r
-\r
- // if we disconnect dead prey from the predator, gib it's body\r
- if(e.health <= 0)\r
- e.health = -1000;\r
-\r
e.fakepredator = world;\r
+ e.aiment = world;\r
+\r
+ if(!e.deadflag)\r
+ e.fakeprey = FALSE;\r
}\r
\r
-void Vore_ChoosePreyRelease(entity e)\r
+void Vore_PreyRelease(entity e)\r
{\r
- // if the fulldigest feature is on, we don't spit a dead prey's carcass out\r
- if(e.health <= 0 && cvar("g_vore_fulldigest"))\r
+ // if the keepdeadprey feature is on, don't spit a dead prey's carcass out\r
+ if(e.health <= 0 && cvar("g_vore_keepdeadprey"))\r
{\r
Vore_DeadPrey_Configure(e);\r
\r
- // if the predator's dead, we detach the dead prey from him\r
- if(e.fakepredator.deadflag != DEAD_NO)\r
+ // if keepdeadprey is enabled and the predator disconnected, detach the dead prey\r
+ if(e.fakepredator.classname != "player")\r
Vore_DeadPrey_Detach(e);\r
}\r
else\r
\r
// prey disconnects or goes spectating while inside someone's belly\r
if(self.predator.classname == "player")\r
- Vore_ChoosePreyRelease(self);\r
+ Vore_PreyRelease(self);\r
\r
// pred disconnects or goes spectating with players in their belly\r
else if(self.stomach_load > 0)\r
FOR_EACH_PLAYER(head)\r
{\r
if(head.predator == self)\r
- Vore_ChoosePreyRelease(head);\r
+ Vore_PreyRelease(head);\r
}\r
- Vore_Gurglesound(); // stop the gurgling sound\r
+ Vore_GurgleSound(); // stop the gurgling sound\r
}\r
\r
self.stomach_load = self.gravity = 0; // prevents a bug\r
damage = ceil(random() * (cvar("g_balance_vore_kick_damage_max") - cvar("g_balance_vore_kick_damage_min")) + cvar("g_balance_vore_kick_damage_min"));\r
Damage(self.predator, self, self, damage, DEATH_STOMACHKICK, self.predator.origin, v_forward * cvar("g_balance_vore_kick_force"));\r
sound(self.predator, CHAN_PROJECTILE, "weapons/stomachkick.ogg", VOL_BASE, ATTN_NORM);\r
+ self.predator.punchangle_x -= self.predator.cvar_cl_vore_kick_punchangle;\r
\r
if(random() < cvar("g_balance_vore_kick_escapeprobability"))\r
Vore_Regurgitate(self);\r
}\r
}\r
\r
+void Vore_AutoTaunt()\r
+{\r
+ // triggers ambient vore taunts, for both pred and prey\r
+\r
+ float taunt_time;\r
+\r
+ // predator taunts\r
+ if(self.stomach_load && !Stomach_TeamMates_check(self))\r
+ {\r
+ if(!self.taunt_soundtime) // taunt_soundtime becomes 0 once the taunt has played\r
+ {\r
+ taunt_time = random() * (cvar("sv_vore_autotaunt_repeat_max") - cvar("sv_vore_autotaunt_repeat_min")) + cvar("sv_vore_autotaunt_repeat_min");\r
+ SetAutoTaunt(self, time + taunt_time, TAUNTTYPE_VOREPRED);\r
+ }\r
+ }\r
+ else if(self.taunt_soundtype == TAUNTTYPE_VOREPRED)\r
+ {\r
+ // we have a predator taunt scheduled, but are no longer a (suitable) predator, so remove it\r
+ SetAutoTaunt(self, 0, 0);\r
+ }\r
+\r
+ // prey taunts\r
+ if(self.predator.classname == "player" && !(teams_matter && self.team == self.predator.team))\r
+ {\r
+ if(!self.taunt_soundtime) // taunt_soundtime becomes 0 once the taunt has played\r
+ {\r
+ taunt_time = random() * (cvar("sv_vore_autotaunt_repeat_max") - cvar("sv_vore_autotaunt_repeat_min")) + cvar("sv_vore_autotaunt_repeat_min");\r
+ SetAutoTaunt(self, time + taunt_time, TAUNTTYPE_VOREPREY);\r
+ }\r
+ }\r
+ else if(self.taunt_soundtype == TAUNTTYPE_VOREPREY)\r
+ {\r
+ // we have a prey taunt scheduled, but are no longer a (suitable) prey, so remove it\r
+ SetAutoTaunt(self, 0, 0);\r
+ }\r
+}\r
+\r
void Vore()\r
{\r
// main vore code, this is where it all happens\r
return;\r
}\r
\r
+ Vore_AutoTaunt();\r
+\r
// wash the goo away from players once they leave the stomach\r
if(self.predator.classname != "player")\r
if(stov(cvar_string("g_vore_regurgitatecolor_release")))\r
prey = Swallow_player_check();\r
\r
// attempt to swallow our new prey if we pressed the attack button, and there's any in range\r
- if(self.BUTTON_ATCK)\r
+ self.stat_canswallow = 0;\r
if(Swallow_condition_check(prey))\r
- Vore_Swallow(prey);\r
+ {\r
+ // canswallow stat, used by the HUD\r
+ if(teams_matter && prey.team == self.team)\r
+ self.stat_canswallow = 2;\r
+ else\r
+ self.stat_canswallow = 1;\r
+\r
+ if(self.BUTTON_ATCK)\r
+ Vore_Swallow(prey);\r
+ }\r
\r
// toggle digestion, if the player has someone in their stomach\r
if(self.BUTTON_DIGEST && cvar("g_vore_digestion"))\r
}\r
\r
if(cvar("g_vore_gurglesound"))\r
- Vore_Gurglesound();\r
+ Vore_GurgleSound();\r
\r
// --------------------------------\r
// Code that addresses the prey:\r
// --------------------------------\r
\r
+ // keepdeadprey - detach dead prey if their predator died or got swallowed\r
+ if(self.fakepredator.classname == "player")\r
+ if(self.fakepredator.deadflag != DEAD_NO || self.fakepredator.predator.classname == "player")\r
+ Vore_DeadPrey_Detach(self);\r
+\r
+ if(self.predator.classname != "player")\r
+ return;\r
+\r
if(self.deadflag)\r
{\r
- Vore_ChoosePreyRelease(self);\r
+ Vore_PreyRelease(self);\r
return;\r
}\r
- if(self.predator.classname != "player")\r
- return;\r
+\r
if(self.predator.deadflag)\r
Vore_Regurgitate(self);\r
else if(vlen(self.predator.velocity) > cvar("g_balance_vore_regurgitate_speedcap"))\r