.float regurgitate_prepare;\r
-.float system_delay, swallow_delay, digest_button_delay, regurgitate_button_delay;\r
-.float complain_swallow;\r
-const float complain_delay = 1;\r
-const float button_delay = 0.5;\r
-const float steptime = 0.1;\r
-const float system_delay_time = 0.1;\r
+.float system_delay, swallow_delay, digest_button_delay_time, regurgitate_button_delay_time;\r
+.float complain_vore;\r
+.float vore_oldmovetype, vore_oldsolid, vore_oldstomachload;\r
\r
-.float vore_oldmovetype, vore_oldsolid, vore_oldstomachload, vore_oldview_ofs_z;\r
+const float system_delay_time = 0.1;\r
+const float complain_delay_time = 1;\r
+const float button_delay_time = 0.5;\r
+const float steptime = 0.1;\r
\r
-entity Swallow_distance_check()\r
+entity Swallow_player_check()\r
{\r
// check if we can swallow a player instead of firing our weapon\r
- vector w_shotorg, w_shotdir;\r
- w_shotorg = self.origin + self.view_ofs;\r
- w_shotdir = v_forward;\r
\r
- WarpZone_traceline_antilag(self, w_shotorg, w_shotorg + w_shotdir * cvar("g_balance_vore_swallow_range"), FALSE, self, ANTILAG_LATENCY(self));\r
+ vector vore_w_shotorg, vore_w_shotdir;\r
+ vore_w_shotorg = self.origin + self.view_ofs;\r
+ vore_w_shotdir = v_forward;\r
+\r
+ WarpZone_traceline_antilag(self, vore_w_shotorg, vore_w_shotorg + vore_w_shotdir * cvar("g_balance_vore_swallow_range"), FALSE, self, ANTILAG_LATENCY(self));\r
if(trace_fraction < 1)\r
if(trace_ent.classname == "player")\r
return trace_ent;\r
\r
float Swallow_condition_check(entity prey)\r
{\r
- // checks the necessary conditions for swallowing another player\r
+ // checks the necessary conditions for swallowing a player\r
+\r
+ if(prey != self)\r
if(prey.classname == "player" && prey.predator.classname != "player" && prey.deadflag == DEAD_NO) // we can't swallow someone who's already in someone else's stomach\r
if(self.classname == "player" && self.predator.classname != "player" && self.deadflag == DEAD_NO) // we can't swallow players while inside someone's stomach ourselves\r
- if not(vlen(self.velocity) > cvar("g_balance_vore_regurgitate_velocitylimit"))\r
+ if(!self.BUTTON_REGURGITATE && self.swallow_delay < time)\r
+ if not(vlen(self.velocity) > cvar("g_balance_vore_regurgitate_speedcap"))\r
{\r
+ if(teams_matter && prey.team == self.team && !cvar("g_vore_teamvore"))\r
+ {\r
+ if(time > self.complain_vore && self.BUTTON_ATCK)\r
+ {\r
+ play2(self, "misc/forbidden.wav");\r
+ sprint(self, "You cannot swallow your team mates\n");\r
+ self.complain_vore = time + complain_delay_time;\r
+ }\r
+ return FALSE;\r
+ }\r
+\r
if(self.stomach_load >= cvar("g_balance_vore_swallow_limit"))\r
{\r
- if(time > self.complain_swallow)\r
+ if(time > self.complain_vore && self.BUTTON_ATCK)\r
{\r
- play2(self, "weapons/unavailable.wav");\r
+ play2(self, "misc/forbidden.wav");\r
sprint(self, strcat("You cannot swallow more than ^2", cvar_string("g_balance_vore_swallow_limit"), "^7 players at a time\n"));\r
- self.complain_swallow = time + complain_delay;\r
+ self.complain_vore = time + complain_delay_time;\r
}\r
return FALSE;\r
}\r
if(cvar("g_vore_biggergut"))\r
if(prey.stomach_load > self.stomach_load)\r
{\r
- if(time > self.complain_swallow)\r
+ if(time > self.complain_vore && self.BUTTON_ATCK)\r
{\r
- play2(self, "weapons/unavailable.wav");\r
+ play2(self, "misc/forbidden.wav");\r
sprint(self, "You cannot swallow someone with a bigger stomach than yours\n");\r
- self.complain_swallow = time + complain_delay;\r
+ self.complain_vore = time + complain_delay_time;\r
}\r
return FALSE;\r
}\r
+\r
return TRUE;\r
}\r
return FALSE;\r
}\r
\r
-float Vore_PreyCanLeave()\r
+float Stomach_TeamMates_check(entity pred)\r
{\r
- if(teams_matter && self.team == self.predator.team)\r
- return TRUE;\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
+ if(!cvar("g_vore_kick")) // you are defenseless in the stomach if you can't kick, so allow leaving\r
+ return TRUE;\r
+ if(teams_matter && self.team == self.predator.team)\r
+ return TRUE;\r
+ if(g_rpg && cvar("g_rpg_canleave"))\r
+ return TRUE;\r
+ }\r
return FALSE;\r
}\r
\r
// make the camera smoothly lower itself when we get swallowed\r
-// the target we are going for is from normal view offset to half of the view offset (because half is the best positioning of the view for the stomach model)\r
+// our aim is going from the normal view offset to half of the view offset (because half is the best positioning for the stomach model)\r
.float cameraeffect_current, cameraeffect_target;\r
void Vore_CameraEffect_Set(entity e)\r
{\r
else\r
self.cameraeffect_current = self.cameraeffect_target;\r
\r
- self.view_ofs_z = self.vore_oldview_ofs_z / self.cameraeffect_current;\r
+ self.view_ofs_z = PL_VIEW_OFS_z / self.cameraeffect_current;\r
+}\r
+\r
+.float gurgle_oldstomachload;\r
+void Vore_GurgleSound()\r
+{\r
+ if(time > self.gurglesound_finished || self.gurgle_oldstomachload != self.stomach_load)\r
+ {\r
+ GlobalSound(self.playersound_gurgle, CHAN_TRIGGER, VOICETYPE_GURGLE);\r
+\r
+ self.gurglesound_finished = time + 11; // yes, hard coded sound length. I know it's bad but what can I do?\r
+ self.gurgle_oldstomachload = self.stomach_load;\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 applied in cl_physics.qc\r
+ // slowing the player is done in cl_physics.qc\r
+\r
if(e.stomach_load != e.vore_oldstomachload)\r
e.gravity += 1 + (e.stomach_load * cvar("g_balance_vore_weight_gravity") - e.vore_oldstomachload);\r
if(e.gravity == 0)\r
- e.gravity = 0.00001; // 0 becomes 1 for .gravity, so do this to allow 0 gravity\r
+ e.gravity = 0.00001; // 0 becomes 1 for gravity, so do this to allow 0 gravity\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
{\r
- // this player is beening swallowed by another player, apply the proper changes\r
+ // this player is being swallowed by another player, apply the proper changes\r
+\r
e.vore_oldmovetype = e.movetype;\r
e.vore_oldsolid = e.solid;\r
- e.vore_oldview_ofs_z = e.view_ofs_z;\r
\r
e.predator = self;\r
setorigin(e, e.predator.origin);\r
e.velocity = '0 0 0';\r
e.movetype = MOVETYPE_FOLLOW;\r
e.solid = SOLID_NOT;\r
- e.alpha = -1; // best way of hiding / showing the eaten player\r
- e.aiment = e.predator; // follow the predator. Is automatically unset\r
+ e.alpha = -1; // best way of hiding the eaten player\r
+ e.aiment = e.predator; // follow the predator, automatically unset when regurgitated\r
\r
// drop keys (KH) and flags (CTF) when we get swallowed\r
kh_Key_DropAll(e, FALSE);\r
if(stov(cvar_string("g_vore_regurgitatecolor_release")))\r
e.colormod = stov(cvar_string("g_vore_regurgitatecolor_release"));\r
\r
- if(e.team == e.predator.team && teamplay)\r
+ if(teams_matter && e.team == e.predator.team)\r
{\r
- centerprint(e, "^3You have been swallowed by a team mate, don't kick!");\r
- centerprint(e.predator, "^3You have swallowed a team mate, use caution!");\r
+ if(cvar("g_vore_kick"))\r
+ centerprint(e, "^3You have been swallowed by a team mate, don't kick!");\r
+ if(cvar("g_vore_digestion"))\r
+ centerprint(e.predator, "^3You have swallowed a team mate, don't digest!");\r
}\r
\r
PlayerSound(e.predator, playersound_swallow, CHAN_PAIN, VOICETYPE_PLAYERSOUND);\r
setanim(e.predator, e.predator.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing / regurgitating\r
+ e.predator.punchangle_x -= e.predator.cvar_cl_vore_punchangle;\r
e.predator.stomach_load += 1;\r
e.predator.regurgitate_prepare = 0;\r
- Vore_Weight_apply(e.predator);\r
+ e.predator.spawnshieldtime = 0; // lose spawn shield when we vore\r
+ Vore_WeightApply(e.predator);\r
+ Vore_AutoDigest(e.predator);\r
\r
- // block firing for a small amount of time when voring, or we'll be firing the next frame after we swallow\r
- e.predator.weapon_delay = time + button_delay;\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.swallow_delay = time + cvar("g_balance_vore_swallow_delay");\r
e.system_delay = e.predator.system_delay = time + system_delay_time;\r
}\r
\r
void Vore_Regurgitate(entity e)\r
{\r
- // this player is being released from their predator, apply the proper changes\r
+ // this player is being regurgitated by their predator, apply the proper changes\r
+\r
e.movetype = e.vore_oldmovetype;\r
if(e.health > 0) // leave SOLID_NOT for dead bodies\r
e.solid = e.vore_oldsolid;\r
- e.view_ofs_z = e.vore_oldview_ofs_z;\r
- e.alpha = default_player_alpha; // best way of hiding / showing the eaten player\r
+ e.view_ofs_z = PL_VIEW_OFS_z;\r
+ e.alpha = default_player_alpha;\r
\r
- // velocities\r
+ // apply velocities\r
local vector oldforward, oldright, oldup;\r
oldforward = v_forward;\r
oldright = v_right;\r
oldup = v_up;\r
makevectors(e.predator.v_angle);\r
e.velocity = v_forward * cvar("g_balance_vore_regurgitate_force");\r
- e.predator.velocity += -v_forward * cvar("g_balance_vore_regurgitate_eaterforce");\r
+ e.predator.velocity += -v_forward * cvar("g_balance_vore_regurgitate_predatorforce");\r
v_forward = oldforward;\r
v_right = oldright;\r
v_up = oldup;\r
\r
- e.pusher = e.predator; // so we can frag players by regurgitating them in deadly pits\r
+ e.pusher = e.predator; // allows us to frag players by regurgitating them in deadly pits\r
e.pushltime = time + cvar("g_maxpushtime");\r
\r
PlayerSound(e.predator, playersound_regurgitate, CHAN_PAIN, VOICETYPE_PLAYERSOUND);\r
setanim(e.predator, e.predator.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing / regurgitating\r
pointparticles(particleeffectnum("regurgitate"), e.predator.origin, '0 0 0', 1);\r
+ e.predator.punchangle_x += e.predator.cvar_cl_vore_punchangle;\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 when getting regurgitated, or we'll be firing the next frame\r
- e.weapon_delay = time + button_delay;\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
e.system_delay = e.predator.system_delay = time + system_delay_time;\r
e.predator = world;\r
}\r
\r
-void Vore_Gurglesound();\r
-void Vore_Disconnect()\r
+void Vore_DeadPrey_Configure(entity e)\r
{\r
- // frees prey from their predators when someone disconnects or goes spectating\r
+ // ran when the keepdeadprey feature is enabled and prey stays inside the stomach after dying\r
\r
- // prey disconnects or goes spectating while inside someone's belly:\r
- if(self.predator.classname == "player")\r
- {\r
- self.view_ofs_z = self.vore_oldview_ofs_z;\r
- self.predator.stomach_load -= 1;\r
- Vore_Weight_apply(self.predator);\r
- self.predator = world;\r
- }\r
+ if(e.fakeprey || e.predator.classname != "player") // already configured\r
+ return;\r
+\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 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_WeightApply(e.predator);\r
+ e.predator = world;\r
+\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.modelindex = 0;\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
- // pred disconnects or goes spectating with players in their belly:\r
- else if(self.stomach_load > 0)\r
+ if not(cvar("g_vore_keepdeadprey"))\r
+ return;\r
+\r
+ e.fakepredator = world;\r
+ e.fakeprey = FALSE;\r
+ e.aiment = world;\r
+ e.movetype = MOVETYPE_TOSS;\r
+}\r
+\r
+void Vore_PreyRelease(entity e, float pred_disconnect)\r
+{\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
- entity head;\r
- FOR_EACH_PLAYER(head)\r
+ // if keepdeadprey is enabled and the predator disconnected, detach the dead prey\r
+ if(pred_disconnect)\r
{\r
- if(head.predator == self)\r
- Vore_Regurgitate(head);\r
+ if(e.fakeprey)\r
+ Vore_DeadPrey_Detach(e);\r
}\r
- Vore_Gurglesound(); // stop the gurgling sound\r
+ else\r
+ Vore_DeadPrey_Configure(e);\r
}\r
+ else\r
+ Vore_Regurgitate(e);\r
+}\r
+\r
+void Vore_Disconnect()\r
+{\r
+ // frees prey from their predators when someone disconnects or goes spectating, or in other circumstances\r
+\r
+ // prey disconnects or goes spectating while inside someone's belly\r
+ if(self.predator.classname == "player")\r
+ Vore_PreyRelease(self, TRUE);\r
+\r
+ // pred disconnects or goes spectating with players in their belly\r
+ entity head;\r
+ FOR_EACH_PLAYER(head)\r
+ {\r
+ if(head.predator == self || head.fakepredator == self)\r
+ Vore_PreyRelease(head, TRUE);\r
+ }\r
+ Vore_GurgleSound(); // stop the gurgling sound\r
+\r
+ self.stomach_load = self.gravity = 0; // prevents a bug\r
}\r
\r
.float digestion_step;\r
void Vore_Digest()\r
{\r
// apply digestion to prey\r
- if(time > self.predator.digestion_step + steptime)\r
+\r
+ if(time > self.predator.digestion_step)\r
{\r
Damage(self, self.predator, self.predator, cvar("g_balance_vore_digestion_damage"), DEATH_DIGESTION, self.origin, '0 0 0');\r
if(cvar("g_balance_vore_digestion_vampire") && self.predator.health < cvar("g_balance_vore_digestion_vampire_stable"))\r
\r
if (self.predator.digestsound_finished < time)\r
{\r
- self.predator.digestsound_finished = time + 0.5;\r
PlayerSound (self.predator, playersound_digest, CHAN_PLAYER, VOICETYPE_PLAYERSOUND);\r
+ self.predator.digestsound_finished = time + 0.5;\r
}\r
- self.predator.digestion_step = time;\r
+ self.predator.digestion_step = time + steptime;\r
}\r
\r
if(self.health <= 0)\r
.float teamheal_step;\r
void Vore_Teamheal()\r
{\r
+ // apply teamheal\r
+\r
if(cvar("g_balance_vore_teamheal") && self.health < cvar("g_balance_vore_teamheal_stable"))\r
- if(time > self.teamheal_step + steptime)\r
+ if(time > self.teamheal_step)\r
{\r
self.health += cvar("g_balance_vore_teamheal");\r
- self.teamheal_step = time;\r
+ self.teamheal_step = time + steptime;\r
+\r
+ // play beep sound when a team mate was healed to the maximum amount, to both the prey and the predator\r
+ if(self.health >= cvar("g_balance_vore_teamheal_stable"))\r
+ {\r
+ play2(self, "misc/beep.wav");\r
+ play2(self.predator, "misc/beep.wav");\r
+ }\r
}\r
}\r
\r
void Vore_StomachKick()\r
{\r
// allows prey to kick the predator's stomach and do some damage or attempt to escape\r
- if(self.predator.classname != "player")\r
- return;\r
\r
if(time > self.stomachkick_delay)\r
{\r
float damage;\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, '0 0 0');\r
- sound(self.predator, CHAN_PROJECTILE, "weapons/stomachkick.ogg", VOL_BASE, ATTN_NORM);\r
\r
- if(cvar("g_balance_vore_kick_escapeprobability") >= random())\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.wav", 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
self.stomachkick_delay = time + cvar("g_balance_vore_kick_delay");\r
{\r
// allows players to get out of their predator at will in some circumstances, such as team mates\r
\r
- if(Vore_PreyCanLeave())\r
+ if(Vore_CanLeave())\r
Vore_Regurgitate(self);\r
- else if(time > self.complain_swallow)\r
+ else if(time > self.complain_vore)\r
{\r
- play2(self, "weapons/unavailable.wav");\r
+ play2(self, "misc/forbidden.wav");\r
sprint(self, strcat("You cannot get out of ", self.predator.netname, "\n"));\r
- self.complain_swallow = time + complain_delay;\r
+ self.complain_vore = time + complain_delay_time;\r
}\r
}\r
\r
-.float gurglesound_finished, gurglesound_oldstomachload;\r
-void Vore_Gurglesound()\r
+void Vore_AutoTaunt()\r
{\r
- if(time > self.gurglesound_finished || self.gurglesound_oldstomachload != self.stomach_load)\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
- GlobalSound(self.playersound_gurgle, CHAN_TRIGGER, VOICETYPE_GURGLE);\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
- self.gurglesound_finished = time + 11; // yes, hard coded sound length. I know it's bad but what can I do?\r
- self.gurglesound_oldstomachload = self.stomach_load;\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
- // if we are free, show our stomach load on the HUD. Otherwise, show the predator's\r
+ // main vore code, this is where it all happens\r
+\r
+ if(!cvar("g_vore")) // the vore system is disabled\r
+ {\r
+ Vore_Disconnect();\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
+ if(self.colormod)\r
+ if(cvar("g_vore_regurgitatecolor_release_fade"))\r
+ {\r
+ self.colormod_x += cvar("g_vore_regurgitatecolor_release_fade") * frametime;\r
+ if(self.colormod_x > 1)\r
+ self.colormod_x = 1;\r
+ self.colormod_y += cvar("g_vore_regurgitatecolor_release_fade") * frametime;\r
+ if(self.colormod_y > 1)\r
+ self.colormod_y = 1;\r
+ self.colormod_z += cvar("g_vore_regurgitatecolor_release_fade") * frametime;\r
+ if(self.colormod_z > 1)\r
+ self.colormod_z = 1;\r
+ }\r
+\r
+ // set all vore related stats\r
if(self.predator.classname == "player")\r
{\r
- self.stat_stomachload = self.predator.stomach_load;\r
- self.stat_digesting = self.predator.digesting;\r
+ self.stat_stomachload = self.predator.stomach_load; // necessary for the stomach board\r
+ self.stat_digesting = self.predator.digesting; // necessary for the stomach board\r
self.stat_eaten = num_for_edict(self.predator);\r
}\r
else\r
self.stat_digesting = self.digesting;\r
self.stat_eaten = 0;\r
}\r
+ self.stat_canleave = Vore_CanLeave();\r
\r
- // skip the vore system under some circumstances\r
- if(time < game_starttime)\r
+ // don't allow a player inside a player inside another player :)\r
+ // prevent this by checking if such has happened, and taking the proper measures\r
+ // this code has a high priority and must not be stopped by any delay, so run it here\r
+ if(self.predator.predator.classname == "player")\r
+ {\r
+ entity target_predator, target_predator_predator, oldself;\r
+ target_predator = self.predator;\r
+ target_predator_predator = self.predator.predator;\r
+\r
+ Vore_Regurgitate(self);\r
+\r
+ // now steal our prey's prey if this probability applies\r
+ if(random() < cvar("g_balance_vore_swallow_stealprey"))\r
+ {\r
+ oldself = self;\r
+ self = target_predator_predator;\r
+ if(Swallow_condition_check(oldself))\r
+ if not(teams_matter && self.team == target_predator.team) // don't steal a team mate's prey\r
+ if not(teams_matter && self.team == oldself.team) // if the prey we would be stealing is a team mate, don't do it\r
+ Vore_Swallow(oldself);\r
+ self = oldself;\r
+ }\r
+ }\r
+\r
+ // apply delays and skip the vore system under some circumstances\r
+ if(time < game_starttime || (time < warmup && !inWarmupStage)) // don't allow vore before a round begins\r
{\r
Vore_Disconnect();\r
return;\r
// --------------------------------\r
\r
entity prey;\r
- prey = Swallow_distance_check();\r
+ prey = Swallow_player_check();\r
\r
- // attempt to swallow our new prey if there's any in range\r
- if(self.BUTTON_ATCK && !self.BUTTON_REGURGITATE && self.swallow_delay < time)\r
+ // attempt to swallow our new prey if we pressed the attack button, and there's any in range\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
+ else if(prey != world)\r
+ self.stat_canswallow = -1;\r
\r
- // start / stop digestion on command, if the player has someone in their stomach\r
- if(self.BUTTON_DIGEST)\r
+ // toggle digestion, if the player has someone in their stomach\r
+ if(self.BUTTON_DIGEST && cvar("g_vore_digestion"))\r
{\r
if(self.stomach_load)\r
{\r
- if(time > self.digest_button_delay)\r
+ if(time > self.digest_button_delay_time)\r
{\r
self.digesting = !self.digesting;\r
- self.digest_button_delay = time + button_delay;\r
+ self.digest_button_delay_time = time + button_delay_time;\r
}\r
}\r
- else if(time > self.complain_swallow)\r
+ else if(time > self.complain_vore)\r
{\r
- play2(self, "weapons/unavailable.wav");\r
+ play2(self, "misc/forbidden.wav");\r
sprint(self, "There is nothing to digest\n");\r
- self.complain_swallow = time + complain_delay;\r
+ self.complain_vore = time + complain_delay_time;\r
}\r
}\r
- if(!self.stomach_load)\r
+ if(!self.stomach_load || !cvar("g_vore_digestion"))\r
self.digesting = FALSE;\r
\r
- // release players from this player's stomach on command\r
+ // predator wishes to regurgitate his prey\r
if(self.BUTTON_REGURGITATE)\r
{\r
if(self.stomach_load)\r
{\r
- if(time > self.regurgitate_button_delay)\r
+ if(time > self.regurgitate_button_delay_time)\r
{\r
self.regurgitate_prepare = time + cvar("g_balance_vore_regurgitate_delay");\r
PlayerSound(self, playersound_regurgitate_prepare, CHAN_VOICE, VOICETYPE_PLAYERSOUND);\r
- self.regurgitate_button_delay = time + button_delay;\r
+ self.regurgitate_button_delay_time = time + button_delay_time;\r
}\r
}\r
- else if(time > self.complain_swallow)\r
+ else if(time > self.complain_vore)\r
{\r
- play2(self, "weapons/unavailable.wav");\r
+ play2(self, "misc/forbidden.wav");\r
sprint(self, "There is nothing to regurgitate\n");\r
- self.complain_swallow = time + complain_delay;\r
+ self.complain_vore = time + complain_delay_time;\r
}\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.predator.deadflag || self.deadflag)\r
- Vore_Regurgitate(self);\r
- else if(self.predator.predator.classname == "player") // don't allow a player inside a player inside another player :)\r
+ if(self.deadflag)\r
{\r
- entity target_predator, oldself;\r
- target_predator = self.predator.predator;\r
+ Vore_PreyRelease(self, FALSE);\r
+ return;\r
+ }\r
\r
+ if(self.predator.deadflag)\r
Vore_Regurgitate(self);\r
- if(random() < cvar("g_vore_stealprey"))\r
- if not(teams_matter && self.predator.team == target_predator.team) // don't steal a team mate's prey\r
- if(Swallow_condition_check(self))\r
- {\r
- oldself = self;\r
- self = target_predator;\r
- Vore_Swallow(oldself);\r
- self = oldself;\r
- }\r
- }\r
- else if(vlen(self.predator.velocity) > cvar("g_balance_vore_regurgitate_velocitylimit"))\r
+ else if(vlen(self.predator.velocity) > cvar("g_balance_vore_regurgitate_speedcap"))\r
Vore_Regurgitate(self);\r
\r
- // apply delayed regurgitating\r
+ // apply delayed regurgitating if it was scheduled\r
if(self.predator.regurgitate_prepare && time > self.predator.regurgitate_prepare)\r
{\r
self.predator.regurgitate_prepare = 0;\r
- self.predator.complain_swallow = time + complain_delay;\r
+ self.predator.complain_vore = time + complain_delay_time; // prevent complaining the next frame if this empties our stomach\r
Vore_Regurgitate(self);\r
}\r
\r
+ // execute digesting and team healing\r
if(self.predator.digesting == TRUE)\r
Vore_Digest();\r
if(teams_matter && self.team == self.predator.team)\r
+ if(cvar("g_balance_vore_teamheal") && cvar("g_vore_teamvore"))\r
Vore_Teamheal();\r
\r
- if(self.BUTTON_ATCK)\r
+ // execute prey commands\r
+ if(self.BUTTON_ATCK && cvar("g_vore_kick"))\r
Vore_StomachKick();\r
if(self.BUTTON_JUMP)\r
Vore_StomachLeave();\r
\r
- self.stat_canleave = Vore_PreyCanLeave();\r
-\r
Vore_CameraEffect_Apply();\r
}
\ No newline at end of file