X-Git-Url: https://de.git.xonotic.org/?p=voretournament%2Fvoretournament.git;a=blobdiff_plain;f=data%2Fqcsrc%2Fserver%2Fvore.qc;h=e5452e6a739c3775376955e8438afe1241da7d68;hp=3a7982db82dddd0393b31c0851c3dc3faa9d4fbc;hb=9f40eda7868f8c3998f417e39cc2f29d9554b6b3;hpb=581d320e29b70e646c11196aaeb14316ea014305 diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index 3a7982db..e5452e6a 100644 --- a/data/qcsrc/server/vore.qc +++ b/data/qcsrc/server/vore.qc @@ -1,16 +1,17 @@ .float regurgitate_prepare; -.float system_delay, swallow_delay, digest_button_delay, regurgitate_button_delay; -.float complain_swallow; -const float complain_delay = 1; -const float button_delay = 0.5; -const float steptime = 0.1; -const float system_delay_time = 0.1; - +.float system_delay, swallow_delay, digest_button_delay_time, regurgitate_button_delay_time; +.float complain_vore; .float vore_oldmovetype, vore_oldsolid, vore_oldstomachload; -entity Swallow_distance_check() +const float system_delay_time = 0.1; +const float complain_delay_time = 1; +const float button_delay_time = 0.5; +const float steptime = 0.1; + +entity Swallow_player_check() { // check if we can swallow a player instead of firing our weapon + vector w_shotorg, w_shotdir; w_shotorg = self.origin + self.view_ofs; w_shotdir = v_forward; @@ -24,18 +25,32 @@ entity Swallow_distance_check() float Swallow_condition_check(entity prey) { - // checks the necessary conditions for swallowing another player - if(prey.classname == "player" && prey.eater.classname != "player" && prey.deadflag == DEAD_NO) // we can't swallow someone who's already in someone else's stomach - if not(vlen(self.velocity) > cvar("g_balance_vore_regurgitate_velocitylimit")) - if(self.eater.classname != "player") // we can't swallow players while inside someone's stomach ourselves + // checks the necessary conditions for swallowing a player + + if(prey != self) + 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 + if(self.classname == "player" && self.predator.classname != "player" && self.deadflag == DEAD_NO) // we can't swallow players while inside someone's stomach ourselves + if(!self.BUTTON_REGURGITATE && self.swallow_delay < time) + if not(vlen(self.velocity) > cvar("g_balance_vore_regurgitate_speedcap")) { + if(teams_matter && prey.team == self.team && !cvar("g_vore_teamvore")) + { + if(time > self.complain_vore) + { + play2(self, "misc/unavailable.wav"); + sprint(self, "You cannot swallow your team mates\n"); + self.complain_vore = time + complain_delay_time; + } + return FALSE; + } + if(self.stomach_load >= cvar("g_balance_vore_swallow_limit")) { - if(time > self.complain_swallow) + if(time > self.complain_vore) { - play2(self, "weapons/unavailable.wav"); + play2(self, "misc/unavailable.wav"); sprint(self, strcat("You cannot swallow more than ^2", cvar_string("g_balance_vore_swallow_limit"), "^7 players at a time\n")); - self.complain_swallow = time + complain_delay; + self.complain_vore = time + complain_delay_time; } return FALSE; } @@ -43,203 +58,431 @@ float Swallow_condition_check(entity prey) if(cvar("g_vore_biggergut")) if(prey.stomach_load > self.stomach_load) { - if(time > self.complain_swallow) + if(time > self.complain_vore) { - play2(self, "weapons/unavailable.wav"); + play2(self, "misc/unavailable.wav"); sprint(self, "You cannot swallow someone with a bigger stomach than yours\n"); - self.complain_swallow = time + complain_delay; + self.complain_vore = time + complain_delay_time; } return FALSE; } + return TRUE; } return FALSE; } -void Vore_Weight_apply(entity e) +float Stomach_TeamMates_check(entity pred) +{ + // checks if a player's stomach contains any team mates + + entity head; + if(teams_matter) + { + FOR_EACH_PLAYER(head) + { + if(head.predator == pred && head.team == pred.team) + return TRUE; + } + } + return FALSE; +} + +float Vore_CanLeave() +{ + if(self.predator.classname == "player") + { + if(!cvar("g_vore_kick")) // you are defenseless in the stomach if you can't kick, so allow leaving + return TRUE; + if(teams_matter && self.team == self.predator.team) + return TRUE; + if(g_rpg && cvar("g_rpg_canleave")) + return TRUE; + } + return FALSE; +} + +// make the camera smoothly lower itself when we get swallowed +// 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) +.float cameraeffect_current, cameraeffect_target; +void Vore_CameraEffect_Set(entity e) +{ + e.cameraeffect_current = 1; + e.cameraeffect_target = 2; +} +void Vore_CameraEffect_Apply() +{ + if(self.predator.classname != "player") + return; + + if(self.cvar_cl_vore_cameraspeed) + { + local float step; + step = self.cvar_cl_vore_cameraspeed * frametime; + + // not sure if these maths are good, as the effect should be smoother + if(self.cameraeffect_current >= self.cameraeffect_target + step) + self.cameraeffect_current -= step; + else if(self.cameraeffect_current <= self.cameraeffect_target - step) + self.cameraeffect_current += step; + } + else + self.cameraeffect_current = self.cameraeffect_target; + + self.view_ofs_z = PL_VIEW_OFS_z / self.cameraeffect_current; +} + +.float gurgle_oldstomachload; +void Vore_GurgleSound() +{ + if(time > self.gurglesound_finished || self.gurgle_oldstomachload != self.stomach_load) + { + GlobalSound(self.playersound_gurgle, CHAN_TRIGGER, VOICETYPE_GURGLE); + + self.gurglesound_finished = time + 11; // yes, hard coded sound length. I know it's bad but what can I do? + self.gurgle_oldstomachload = self.stomach_load; + } +} + +void Vore_WeightApply(entity e) { // apply stomach weight that makes you heavier the more you eat - // slowing the player is applied in cl_physics.qc + // slowing the player is done in cl_physics.qc + if(e.stomach_load != e.vore_oldstomachload) e.gravity += 1 + (e.stomach_load * cvar("g_balance_vore_weight_gravity") - e.vore_oldstomachload); if(e.gravity == 0) - e.gravity = 0.00001; // 0 becomes 1 for .gravity, so do this to allow 0 gravity + e.gravity = 0.00001; // 0 becomes 1 for gravity, so do this to allow 0 gravity e.vore_oldstomachload = e.stomach_load; } +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 > 1) + 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 pusher; +.float pushltime; void Vore_Swallow(entity e) { - // this player is beening swallowed by another player, apply the proper changes + // this player is being swallowed by another player, apply the proper changes + e.vore_oldmovetype = e.movetype; e.vore_oldsolid = e.solid; - setorigin(e, e.eater.origin); + e.predator = self; + setorigin(e, e.predator.origin); e.velocity = '0 0 0'; e.movetype = MOVETYPE_FOLLOW; e.solid = SOLID_NOT; - e.alpha = -1; // best way of hiding / showing the eaten player - e.aiment = e.eater; // follow the predator. Is automatically unset - e.view_ofs_z /= 2; // best positioning for the stomach model + e.alpha = -1; // best way of hiding the eaten player + e.aiment = e.predator; // follow the predator, automatically unset when regurgitated // drop keys (KH) and flags (CTF) when we get swallowed kh_Key_DropAll(e, FALSE); if(e.flagcarried) - DropFlag(e.flagcarried, world, e.eater); + DropFlag(e.flagcarried, world, e.predator); - if(stov(cvar_string("g_vore_regurgitatecolor_released"))) - e.colormod = stov(cvar_string("g_vore_regurgitatecolor_released")); + Vore_CameraEffect_Set(e); - PlayerSound(e.eater, playersound_swallow, CHAN_PAIN, VOICETYPE_PLAYERSOUND); - setanim(e.eater, e.eater.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing \ regurgitating - e.eater.stomach_load += 1; - e.eater.regurgitate_prepare = 0; - Vore_Weight_apply(e.eater); + if(stov(cvar_string("g_vore_regurgitatecolor_release"))) + e.colormod = stov(cvar_string("g_vore_regurgitatecolor_release")); + + if(teams_matter && e.team == e.predator.team) + { + centerprint(e, "^3You have been swallowed by a team mate, don't kick!"); + centerprint(e.predator, "^3You have swallowed a team mate, use caution!"); + } - e.system_delay = e.eater.system_delay = time + system_delay_time; + PlayerSound(e.predator, playersound_swallow, CHAN_PAIN, VOICETYPE_PLAYERSOUND); + setanim(e.predator, e.predator.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing / regurgitating + e.predator.punchangle_x -= e.predator.cvar_cl_vore_punchangle; + e.predator.stomach_load += 1; + e.predator.regurgitate_prepare = 0; + e.predator.spawnshieldtime = 0; // lose spawn shield when we vore + 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 + e.predator.weapon_delay = time + button_delay_time; + e.predator.swallow_delay = time + cvar("g_balance_vore_swallow_delay"); + e.system_delay = e.predator.system_delay = time + system_delay_time; } void Vore_Regurgitate(entity e) { - // this player is being released from their predator, apply the proper changes + // this player is being regurgitated by their predator, apply the proper changes + e.movetype = e.vore_oldmovetype; if(e.health > 0) // leave SOLID_NOT for dead bodies e.solid = e.vore_oldsolid; - e.alpha = default_player_alpha; // best way of hiding / showing the eaten player - e.view_ofs_z *= 2; // best positioning for the stomach model + e.view_ofs_z = PL_VIEW_OFS_z; + e.alpha = default_player_alpha; - // velocities + // apply velocities local vector oldforward, oldright, oldup; oldforward = v_forward; oldright = v_right; oldup = v_up; - makevectors(e.eater.v_angle); + makevectors(e.predator.v_angle); e.velocity = v_forward * cvar("g_balance_vore_regurgitate_force"); - e.eater.velocity += -v_forward * cvar("g_balance_vore_regurgitate_eaterforce"); + e.predator.velocity += -v_forward * cvar("g_balance_vore_regurgitate_predatorforce"); v_forward = oldforward; v_right = oldright; v_up = oldup; - PlayerSound(e.eater, playersound_regurgitate, CHAN_PAIN, VOICETYPE_PLAYERSOUND); - setanim(e.eater, e.eater.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing \ regurgitating - pointparticles(particleeffectnum("regurgitate"), e.eater.origin, '0 0 0', 1); - e.eater.stomach_load -= 1; - e.eater.regurgitate_prepare = 0; - e.eater.swallow_delay = time + cvar("g_balance_vore_swallow_delay"); - Vore_Weight_apply(e.eater); + e.pusher = e.predator; // allows us to frag players by regurgitating them in deadly pits + e.pushltime = time + cvar("g_maxpushtime"); + + PlayerSound(e.predator, playersound_regurgitate, CHAN_PAIN, VOICETYPE_PLAYERSOUND); + setanim(e.predator, e.predator.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing / regurgitating + pointparticles(particleeffectnum("regurgitate"), e.predator.origin, '0 0 0', 1); + e.predator.punchangle_x += e.predator.cvar_cl_vore_punchangle; + e.predator.stomach_load -= 1; + e.predator.regurgitate_prepare = 0; + e.predator.swallow_delay = time + cvar("g_balance_vore_swallow_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; + e.system_delay = e.predator.system_delay = time + system_delay_time; + e.predator = world; +} + +void Vore_DeadPrey_Configure(entity e) +{ + // ran when the keepdeadprey feature is enabled and prey stays inside the stomach after dying + + if(e.fakeprey || e.predator.classname != "player") // already configured + return; + + // this entity is like e.predator but for dead prey, to avoid conflicts + e.fakepredator = e.predator; + e.fakeprey = TRUE; - e.system_delay = e.eater.system_delay = time + system_delay_time; - e.eater = world; + // 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 -= 1; + Vore_WeightApply(e.predator); + e.predator = world; + + // now put our dead prey inside the predator's stomach, but only as an effect + e.movetype = MOVETYPE_FOLLOW; + e.takedamage = DAMAGE_NO; + e.solid = SOLID_NOT; + e.aiment = e.fakepredator; + + // completely remove the dead body + e.alpha = -1; } -void Vore_Disconnect() +void Vore_DeadPrey_Detach(entity e) { - // frees prey from their predators when someone disconnects or goes spectating + // ran when dead prey must be detached from the stomach (eg: they are respawning) + // should only execute after Vore_DeadPrey_Configure has ran first - // prey disconnects or goes spectating while inside someone's belly: - if(self.eater.classname == "player") + if not(cvar("g_vore_keepdeadprey")) + return; + + e.fakepredator = world; + e.aiment = world; + + if(!e.deadflag) + e.fakeprey = FALSE; +} + +void Vore_PreyRelease(entity e) +{ + // if the keepdeadprey feature is on, don't spit a dead prey's carcass out + if(e.health <= 0 && cvar("g_vore_keepdeadprey")) { - self.view_ofs_z += 25; - self.eater.stomach_load -= 1; - Vore_Weight_apply(self.eater); - self.eater = world; + Vore_DeadPrey_Configure(e); + + // if keepdeadprey is enabled and the predator disconnected, detach the dead prey + if(e.fakepredator.classname != "player") + Vore_DeadPrey_Detach(e); } + else + Vore_Regurgitate(e); +} + +void Vore_Disconnect() +{ + // frees prey from their predators when someone disconnects or goes spectating, or in other circumstances - // pred disconnects or goes spectating with players in their belly: + // prey disconnects or goes spectating while inside someone's belly + if(self.predator.classname == "player") + Vore_PreyRelease(self); + + // pred disconnects or goes spectating with players in their belly else if(self.stomach_load > 0) { entity head; FOR_EACH_PLAYER(head) { - if(head.eater == self) - Vore_Regurgitate(head); + if(head.predator == self) + Vore_PreyRelease(head); } + Vore_GurgleSound(); // stop the gurgling sound } + + self.stomach_load = self.gravity = 0; // prevents a bug } .float digestion_step; void Vore_Digest() { // apply digestion to prey - if(time > self.eater.digestion_step + steptime) + + if(time > self.predator.digestion_step) { - Damage(self, self.eater, self.eater, cvar("g_balance_vore_digestion_damage"), DEATH_DIGESTION, self.origin, '0 0 0'); - if(cvar("g_balance_vore_digestion_vampire") && self.eater.health < cvar("g_balance_vore_digestion_vampire_stable")) - self.eater.health += cvar("g_balance_vore_digestion_vampire"); + Damage(self, self.predator, self.predator, cvar("g_balance_vore_digestion_damage"), DEATH_DIGESTION, self.origin, '0 0 0'); + if(cvar("g_balance_vore_digestion_vampire") && self.predator.health < cvar("g_balance_vore_digestion_vampire_stable")) + self.predator.health += cvar("g_balance_vore_digestion_vampire"); - if (self.eater.digestsound_finished < time) + if (self.predator.digestsound_finished < time) { - self.eater.digestsound_finished = time + 0.5; - PlayerSound (self.eater, playersound_digest, CHAN_PLAYER, VOICETYPE_PLAYERSOUND); + PlayerSound (self.predator, playersound_digest, CHAN_PLAYER, VOICETYPE_PLAYERSOUND); + self.predator.digestsound_finished = time + 0.5; } - self.eater.digestion_step = time; + self.predator.digestion_step = time + steptime; } if(self.health <= 0) - if(stov(cvar_string("g_vore_regurgitatecolor_digested"))) - self.colormod = stov(cvar_string("g_vore_regurgitatecolor_digested")); + if(stov(cvar_string("g_vore_regurgitatecolor_digest"))) + self.colormod = stov(cvar_string("g_vore_regurgitatecolor_digest")); } .float teamheal_step; void Vore_Teamheal() { + // apply teamheal + if(cvar("g_balance_vore_teamheal") && self.health < cvar("g_balance_vore_teamheal_stable")) - if(time > self.teamheal_step + steptime) + if(time > self.teamheal_step) { self.health += cvar("g_balance_vore_teamheal"); - self.teamheal_step = time; + self.teamheal_step = time + steptime; } } .float stomachkick_delay; void Vore_StomachKick() { - // allows prey to kick the predator's stomach and do some damage / attempt to escape, or bring the predator's digestion upon their self when there's no other option - if(self.eater.classname != "player") - return; + // allows prey to kick the predator's stomach and do some damage or attempt to escape - // kick the predator's stomach and do damage, or escape if we are lucky - if(self.BUTTON_ATCK) if(time > self.stomachkick_delay) { float damage; damage = ceil(random() * (cvar("g_balance_vore_kick_damage_max") - cvar("g_balance_vore_kick_damage_min")) + cvar("g_balance_vore_kick_damage_min")); - Damage(self.eater, self, self, damage, DEATH_STOMACHKICK, self.eater.origin, '0 0 0'); - sound(self.eater, CHAN_PROJECTILE, "weapons/stomachkick.ogg", VOL_BASE, ATTN_NORM); + Damage(self.predator, self, self, damage, DEATH_STOMACHKICK, self.predator.origin, v_forward * cvar("g_balance_vore_kick_force")); + sound(self.predator, CHAN_PROJECTILE, "weapons/stomachkick.ogg", VOL_BASE, ATTN_NORM); + self.predator.punchangle_x -= self.predator.cvar_cl_vore_kick_punchangle; - if(cvar("g_balance_vore_kick_escapeprobability") >= random()) + if(random() < cvar("g_balance_vore_kick_escapeprobability")) Vore_Regurgitate(self); self.stomachkick_delay = time + cvar("g_balance_vore_kick_delay"); } +} + +void Vore_StomachLeave() +{ + // allows players to get out of their predator at will in some circumstances, such as team mates - // start the predator's digestion - if(self.BUTTON_ATCK2) + if(Vore_CanLeave()) + Vore_Regurgitate(self); + else if(time > self.complain_vore) { - centerprint(self.eater, strcat(self.netname, " has triggered your digestion")); - self.eater.digesting = TRUE; + play2(self, "misc/unavailable.wav"); + sprint(self, strcat("You cannot get out of ", self.predator.netname, "\n")); + self.complain_vore = time + complain_delay_time; } } -.float gurglesound_finished, gurglesound_oldstomachload; -void Vore_Gurglesound() +void Vore_AutoTaunt() { - if(time > self.gurglesound_finished || self.gurglesound_oldstomachload != self.stomach_load) + // triggers ambient vore taunts, for both pred and prey + + float taunt_time; + + // predator taunts + if(self.stomach_load && !Stomach_TeamMates_check(self)) { - GlobalSound(self.playersound_gurgle, CHAN_TRIGGER, VOICETYPE_GURGLE); + if(!self.taunt_soundtime) // taunt_soundtime becomes 0 once the taunt has played + { + taunt_time = random() * (cvar("sv_vore_autotaunt_repeat_max") - cvar("sv_vore_autotaunt_repeat_min")) + cvar("sv_vore_autotaunt_repeat_min"); + SetAutoTaunt(self, time + taunt_time, TAUNTTYPE_VOREPRED); + } + } + else if(self.taunt_soundtype == TAUNTTYPE_VOREPRED) + { + // we have a predator taunt scheduled, but are no longer a (suitable) predator, so remove it + SetAutoTaunt(self, 0, 0); + } - self.gurglesound_finished = time + 11; // yes, hard coded sound length. I know it's bad but what can I do? - self.gurglesound_oldstomachload = self.stomach_load; + // prey taunts + if(self.predator.classname == "player" && !(teams_matter && self.team == self.predator.team)) + { + if(!self.taunt_soundtime) // taunt_soundtime becomes 0 once the taunt has played + { + taunt_time = random() * (cvar("sv_vore_autotaunt_repeat_max") - cvar("sv_vore_autotaunt_repeat_min")) + cvar("sv_vore_autotaunt_repeat_min"); + SetAutoTaunt(self, time + taunt_time, TAUNTTYPE_VOREPREY); + } + } + else if(self.taunt_soundtype == TAUNTTYPE_VOREPREY) + { + // we have a prey taunt scheduled, but are no longer a (suitable) prey, so remove it + SetAutoTaunt(self, 0, 0); } } void Vore() { - // if we are free, show our stomach load on the HUD. Otherwise, show the predator's - if(self.eater.classname == "player") + // main vore code, this is where it all happens + + if(!cvar("g_vore")) // the vore system is disabled { - self.stat_stomachload = self.eater.stomach_load; - self.stat_digesting = self.eater.digesting; - self.stat_eaten = num_for_edict(self.eater); + Vore_Disconnect(); + return; + } + + Vore_AutoTaunt(); + + // wash the goo away from players once they leave the stomach + if(self.predator.classname != "player") + if(stov(cvar_string("g_vore_regurgitatecolor_release"))) + if(self.colormod) + if(cvar("g_vore_regurgitatecolor_release_fade")) + { + self.colormod_x += cvar("g_vore_regurgitatecolor_release_fade") * frametime; + if(self.colormod_x > 1) + self.colormod_x = 1; + self.colormod_y += cvar("g_vore_regurgitatecolor_release_fade") * frametime; + if(self.colormod_y > 1) + self.colormod_y = 1; + self.colormod_z += cvar("g_vore_regurgitatecolor_release_fade") * frametime; + if(self.colormod_z > 1) + self.colormod_z = 1; + } + + // set all vore related stats + if(self.predator.classname == "player") + { + self.stat_stomachload = self.predator.stomach_load; // necessary for the stomach board + self.stat_digesting = self.predator.digesting; // necessary for the stomach board + self.stat_eaten = num_for_edict(self.predator); } else { @@ -247,9 +490,34 @@ void Vore() self.stat_digesting = self.digesting; self.stat_eaten = 0; } + self.stat_canleave = Vore_CanLeave(); - // skip the vore system under some circumstances - if(time < game_starttime) + // don't allow a player inside a player inside another player :) + // prevent this by checking if such has happened, and taking the proper measures + // this code has a high priority and must not be stopped by any delay, so run it here + if(self.predator.predator.classname == "player") + { + entity target_predator, target_predator_predator, oldself; + target_predator = self.predator; + target_predator_predator = self.predator.predator; + + Vore_Regurgitate(self); + + // now steal our prey's prey if this probability applies + if(random() < cvar("g_balance_vore_swallow_stealprey")) + { + oldself = self; + self = target_predator_predator; + if(Swallow_condition_check(oldself)) + if not(teams_matter && self.team == target_predator.team) // don't steal a team mate's prey + if not(teams_matter && self.team == oldself.team) // if the prey we would be stealing is a team mate, don't do it + Vore_Swallow(oldself); + self = oldself; + } + } + + // apply delays and skip the vore system under some circumstances + if(time < game_starttime || (time < warmup && !inWarmupStage)) // don't allow vore before a round begins { Vore_Disconnect(); return; @@ -264,93 +532,109 @@ void Vore() // -------------------------------- entity prey; - prey = Swallow_distance_check(); + prey = Swallow_player_check(); - // attempt to swallow our new prey if there's any in range - if(self.BUTTON_ATCK && !self.BUTTON_REGURGITATE && self.swallow_delay < time) + // attempt to swallow our new prey if we pressed the attack button, and there's any in range + self.stat_canswallow = 0; if(Swallow_condition_check(prey)) { - prey.eater = self; - Vore_Swallow(prey); - self.swallow_delay = time + cvar("g_balance_vore_swallow_delay"); - - if(self.team == prey.team && teamplay) - centerprint(self, "You have swallowed a team mate, use caution!"); - - // block firing for a small amount of time when voring, or we'll be firing the next frame after we swallow - self.weapon_delay = time + 0.25; + // canswallow stat, used by the HUD + if(teams_matter && prey.team == self.team) + self.stat_canswallow = 2; + else + self.stat_canswallow = 1; + + if(self.BUTTON_ATCK) + Vore_Swallow(prey); } - // start / stop digestion on command, if the player has someone in their stomach - if(self.BUTTON_DIGEST) + // toggle digestion, if the player has someone in their stomach + if(self.BUTTON_DIGEST && cvar("g_vore_digestion")) { if(self.stomach_load) { - if(time > self.digest_button_delay) + if(time > self.digest_button_delay_time) { self.digesting = !self.digesting; - self.digest_button_delay = time + button_delay; + self.digest_button_delay_time = time + button_delay_time; } } - else if(time > self.complain_swallow) + else if(time > self.complain_vore) { - play2(self, "weapons/unavailable.wav"); + play2(self, "misc/unavailable.wav"); sprint(self, "There is nothing to digest\n"); - self.complain_swallow = time + complain_delay; + self.complain_vore = time + complain_delay_time; } } - if(!self.stomach_load) + if(!self.stomach_load || !cvar("g_vore_digestion")) self.digesting = FALSE; - // release players from this player's stomach on command + // predator wishes to regurgitate his prey if(self.BUTTON_REGURGITATE) { if(self.stomach_load) { - if(time > self.regurgitate_button_delay) + if(time > self.regurgitate_button_delay_time) { self.regurgitate_prepare = time + cvar("g_balance_vore_regurgitate_delay"); - PlayerSound(self, playersound_regurgitate_prepare, CHAN_PAIN, VOICETYPE_PLAYERSOUND); - self.regurgitate_button_delay = time + button_delay; + PlayerSound(self, playersound_regurgitate_prepare, CHAN_VOICE, VOICETYPE_PLAYERSOUND); + self.regurgitate_button_delay_time = time + button_delay_time; } } - else if(time > self.complain_swallow) + else if(time > self.complain_vore) { - play2(self, "weapons/unavailable.wav"); + play2(self, "misc/unavailable.wav"); sprint(self, "There is nothing to regurgitate\n"); - self.complain_swallow = time + complain_delay; + self.complain_vore = time + complain_delay_time; } } if(cvar("g_vore_gurglesound")) - Vore_Gurglesound(); + Vore_GurgleSound(); // -------------------------------- // Code that addresses the prey: // -------------------------------- - if(self.eater.classname != "player") + // keepdeadprey - detach dead prey if their predator died or got swallowed + if(self.fakepredator.classname == "player") + if(self.fakepredator.deadflag != DEAD_NO || self.fakepredator.predator.classname == "player") + Vore_DeadPrey_Detach(self); + + if(self.predator.classname != "player") return; - if(self.eater.deadflag || self.deadflag) - Vore_Regurgitate(self); - else if(self.eater.eater.classname == "player") // don't allow a player inside a player inside another player :) + if(self.deadflag) + { + Vore_PreyRelease(self); + return; + } + + if(self.predator.deadflag) Vore_Regurgitate(self); - else if(vlen(self.eater.velocity) > cvar("g_balance_vore_regurgitate_velocitylimit")) + else if(vlen(self.predator.velocity) > cvar("g_balance_vore_regurgitate_speedcap")) Vore_Regurgitate(self); - // apply delayed regurgitating - if(self.eater.regurgitate_prepare && time > self.eater.regurgitate_prepare) + // apply delayed regurgitating if it was scheduled + if(self.predator.regurgitate_prepare && time > self.predator.regurgitate_prepare) { - self.eater.regurgitate_prepare = 0; - self.eater.complain_swallow = time + complain_delay; + self.predator.regurgitate_prepare = 0; + self.predator.complain_vore = time + complain_delay_time; // prevent complaining the next frame if this empties our stomach Vore_Regurgitate(self); } - if(self.eater.digesting == TRUE) + // execute digesting and team healing + if(self.predator.digesting == TRUE) Vore_Digest(); - if(teams_matter && self.team == self.eater.team) + if(teams_matter && self.team == self.predator.team) + if(cvar("g_balance_vore_teamheal") && cvar("g_vore_teamvore")) Vore_Teamheal(); - Vore_StomachKick(); + // execute prey commands + if(self.BUTTON_ATCK && cvar("g_vore_kick")) + Vore_StomachKick(); + if(self.BUTTON_JUMP) + Vore_StomachLeave(); + + Vore_CameraEffect_Apply(); } \ No newline at end of file