X-Git-Url: https://de.git.xonotic.org/?p=voretournament%2Fvoretournament.git;a=blobdiff_plain;f=data%2Fqcsrc%2Fserver%2Fvore.qc;h=6c787ca3fa5ab3f6d222aedcea7f38fd7d1530e5;hp=23e66d44d40350809a0ca25928145d4551225e86;hb=bc3e4294ed33bfc89b9b50ccd93d54c0fb64dee2;hpb=5d8cde51e02dac8539d6a63fb0b5ff1329ce122b diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index 23e66d44..6c787ca3 100644 --- a/data/qcsrc/server/vore.qc +++ b/data/qcsrc/server/vore.qc @@ -1,5 +1,5 @@ .float regurgitate_prepare; -.float system_delay, swallow_delay, digest_button_delay_time, regurgitate_button_delay_time; +.float stomachkick_delay, system_delay, action_delay, digest_button_delay_time, regurgitate_button_delay_time; .float complain_vore; .float vore_oldmovetype, vore_oldsolid, vore_oldstomachload; @@ -12,11 +12,16 @@ 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; + float swallow_range; + vector vore_w_shotorg, vore_w_shotdir; - WarpZone_traceline_antilag(self, w_shotorg, w_shotorg + w_shotdir * cvar("g_balance_vore_swallow_range"), FALSE, self, ANTILAG_LATENCY(self)); + swallow_range = cvar("g_balance_vore_swallow_range"); + if(self.scale) // we can swallow from further or closer based on our size + swallow_range *= self.scale; + vore_w_shotorg = self.origin; + vore_w_shotdir = v_forward; + + WarpZone_traceline_antilag(self, vore_w_shotorg, vore_w_shotorg + vore_w_shotdir * swallow_range, FALSE, self, ANTILAG_LATENCY(self)); if(trace_fraction < 1) if(trace_ent.classname == "player") return trace_ent; @@ -28,53 +33,57 @@ float Swallow_condition_check(entity prey) // 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(prey.classname == "player" && !prey.stat_eaten && prey.deadflag == DEAD_NO) // we can't swallow someone who's already in someone else's stomach + if(self.classname == "player" && !self.stat_eaten && self.deadflag == DEAD_NO) // we can't swallow players while inside someone's stomach ourselves + if(!self.BUTTON_REGURGITATE && time > self.action_delay) if not(vlen(self.velocity) > cvar("g_balance_vore_regurgitate_speedcap")) { + string swallow_complain; if(teams_matter && prey.team == self.team && !cvar("g_vore_teamvore")) + swallow_complain = "You cannot swallow your team mates\n"; + else if(!cvar("g_vore_spawnshield") && prey.spawnshieldtime > time) + swallow_complain = "You cannot swallow someone protected by the spawn shield\n"; + else if(self.stomach_load >= g_balance_vore_swallow_limit) + swallow_complain = strcat("You cannot swallow more than ^2", ftos(g_balance_vore_swallow_limit), "^7 players at a time\n"); + else if(cvar("g_vore_biggergut") && prey.stomach_load > self.stomach_load) + swallow_complain = "You cannot swallow someone with a bigger stomach than yours\n"; + else if(cvar("g_vore_biggersize") && prey.scale > self.scale) + swallow_complain = "You cannot swallow someone larger than you\n"; + + if(swallow_complain != "") { - if(time > self.complain_vore) + if(time > self.complain_vore && self.BUTTON_ATCK) { - play2(self, "misc/unavailable.wav"); - sprint(self, "You cannot swallow your team mates\n"); + play2(self, "misc/forbidden.wav"); + sprint(self, swallow_complain); self.complain_vore = time + complain_delay_time; } return FALSE; } + return TRUE; + } + return FALSE; +} - if(self.stomach_load >= cvar("g_balance_vore_swallow_limit")) - { - if(time > self.complain_vore) - { - 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_vore = time + complain_delay_time; - } - return FALSE; - } +float Stomach_TeamMates_check(entity pred) +{ + // checks if a player's stomach contains any team mates - if(cvar("g_vore_biggergut")) - if(prey.stomach_load > self.stomach_load) + entity head; + if(teams_matter) + { + FOR_EACH_PLAYER(head) { - if(time > self.complain_vore) - { - play2(self, "misc/unavailable.wav"); - sprint(self, "You cannot swallow someone with a bigger stomach than yours\n"); - self.complain_vore = time + complain_delay_time; - } - return FALSE; + if(head.predator == pred && head.team == pred.team) + return TRUE; } - - return TRUE; } return FALSE; } float Vore_CanLeave() { - if(self.predator.classname == "player") + if(self.stat_eaten) { if(!cvar("g_vore_kick")) // you are defenseless in the stomach if you can't kick, so allow leaving return TRUE; @@ -86,38 +95,72 @@ float Vore_CanLeave() 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) +// position the camera properly for prey +void Vore_SetPreyPositions() { - e.cameraeffect_current = 1; - e.cameraeffect_target = 2; -} -void Vore_CameraEffect_Apply() -{ - if(self.predator.classname != "player") - return; + // self is the predator and head is the prey + + local entity head; + local vector origin_apply; + local float position_counter; - if(self.cvar_cl_vore_cameraspeed) + // In order to allow prey to see each other in the stomach, we must position each occupant differently, + // else all players overlap in the center. To do this, we run a loop on all players in the same stomach. + // For each player, the origin is updated, then a new origin is used for the next player. + // This requires that no more than 9 players may be in the stomach at a time! + FOR_EACH_PLAYER(head) { - local float step; - step = self.cvar_cl_vore_cameraspeed * frametime; + if(head.predator == self) + { + switch(position_counter) + { + case 0: + origin_apply = '0 0 0'; // first occupant sits in the middle + break; + case 1: + origin_apply = '1 0 0'; // second occupant sits in the front + break; + case 2: + origin_apply = '-1 0 0'; // third occupant sits in the back + break; + case 3: + origin_apply = '0 1 0'; // fourth occupant sits in the right + break; + case 4: + origin_apply = '0 -1 0'; // fifth occupant sits in the left + break; + case 5: + origin_apply = '1 1 0'; // sixth occupant sits in the front-right + break; + case 6: + origin_apply = '-1 1 0'; // seventh occupant sits in the back-right + break; + case 7: + origin_apply = '1 -1 0'; // eigth occupant sits in the front-left + break; + case 8: + origin_apply = '-1 -1 0'; // ninth occupant sits in the back-left + break; + default: + break; + } - // 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; + // since prey have their predators set as an aiment, view_ofs will specify the real origin of prey, not just the view offset + head.view_ofs = PL_PREY_VIEW_OFS + origin_apply * cvar("g_vore_neighborprey_distance"); + head.view_ofs_z *= self.scale; // stomach center depends on predator scale + + // change prey height based on scale + float prey_height; + prey_height = (head.scale - self.scale) * cvar("g_healthsize_vore_pos"); + head.view_ofs_z += prey_height; - self.view_ofs_z = PL_VIEW_OFS_z / self.cameraeffect_current; + position_counter += 1; + } + } } .float gurgle_oldstomachload; -void Vore_Gurglesound() +void Vore_GurgleSound() { if(time > self.gurglesound_finished || self.gurgle_oldstomachload != self.stomach_load) { @@ -128,7 +171,7 @@ void Vore_Gurglesound() } } -void Vore_Weight_apply(entity e) +void Vore_WeightApply(entity e) { // apply stomach weight that makes you heavier the more you eat // slowing the player is done in cl_physics.qc @@ -140,6 +183,22 @@ void Vore_Weight_apply(entity e) 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) @@ -154,7 +213,6 @@ void Vore_Swallow(entity e) e.velocity = '0 0 0'; e.movetype = MOVETYPE_FOLLOW; e.solid = SOLID_NOT; - 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 @@ -162,29 +220,52 @@ void Vore_Swallow(entity e) if(e.flagcarried) DropFlag(e.flagcarried, world, e.predator); - Vore_CameraEffect_Set(e); - 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!"); + if(cvar("g_vore_kick")) + centerprint(e, "^3You have been swallowed by a team mate, don't kick!"); + if(cvar("g_vore_digestion")) + centerprint(e.predator, "^3You have swallowed a team mate, don't digest!"); } - PlayerSound(e.predator, playersound_swallow, CHAN_PAIN, VOICETYPE_PLAYERSOUND); + 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 -= e.predator.cvar_cl_vore_punchangle; + e.predator.punchangle_x -= cvar("g_balance_vore_swallow_punchangle"); e.predator.stomach_load += 1; e.predator.regurgitate_prepare = 0; e.predator.spawnshieldtime = 0; // lose spawn shield when we vore - Vore_Weight_apply(e.predator); + 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.predator.action_delay = time + cvar("g_balance_vore_action_delay"); e.system_delay = e.predator.system_delay = time + system_delay_time; + e.stomachkick_delay = time + cvar("g_balance_vore_kick_delay"); // don't kick immediately after being swallowed +} + +void Vore_SwallowStep(entity e) +{ + if(!cvar("g_balance_vore_swallow_speed_fill")) + { + Vore_Swallow(e); + return; + } + + // increase the progress value until it reaches 1, then swallow the player + if(e.swallow_progress_prey < 1) + e.swallow_progress_prey += cvar("g_balance_vore_swallow_speed_fill") * frametime; + else + { + Vore_Swallow(e); + e.swallow_progress_prey = 0; + } + + // the predator's progress is how much the prey got swallowed + self.swallow_progress_pred = e.swallow_progress_prey; } void Vore_Regurgitate(entity e) @@ -195,7 +276,6 @@ void Vore_Regurgitate(entity e) if(e.health > 0) // leave SOLID_NOT for dead bodies e.solid = e.vore_oldsolid; e.view_ofs_z = PL_VIEW_OFS_z; - e.alpha = default_player_alpha; // apply velocities local vector oldforward, oldright, oldup; @@ -212,14 +292,14 @@ void Vore_Regurgitate(entity e) 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); + PlayerSound(e.predator, playersound_regurgitate, CHAN_VOICE, 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.punchangle_x += cvar("g_balance_vore_regurgitate_punchangle"); e.predator.stomach_load -= 1; e.predator.regurgitate_prepare = 0; - e.predator.swallow_delay = time + cvar("g_balance_vore_swallow_delay"); - Vore_Weight_apply(e.predator); + 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; @@ -229,61 +309,60 @@ void Vore_Regurgitate(entity e) void Vore_DeadPrey_Configure(entity e) { - // ran when the fulldigest feature is enabled and prey stays inside the stomach after dying + // ran when the keepdeadprey feature is enabled and prey stays inside the stomach after dying - if(e.fakepredator.classname == "player" || e.predator.classname != "player") + if(e.fakeprey || !e.stat_eaten) // we already configured everything return; - // this entity is pretty much like e.predator but for dead prey, to avoid some conflicts + // this entity is like e.predator but for dead prey, to avoid conflicts e.fakepredator = e.predator; + e.fakeprey = TRUE; - // first release the prey from the predator, as dead prey needs to be attached to predators differently - // the predator's stomach load is also decreased, as our dead prey doesn't count as actual prey any more + // 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_Weight_apply(e.predator); + Vore_WeightApply(e.predator); e.predator = world; - // now, keep our dead prey inside the predator's stomach + // 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 hide the dead body - e.alpha = -1; - setmodel(e, ""); } void Vore_DeadPrey_Detach(entity e) { // ran when dead prey must be detached from the stomach (eg: they are respawning) + // should only execute after Vore_DeadPrey_Configure has ran first - if(e.fakepredator.classname != "player") + if not(cvar("g_vore_keepdeadprey")) return; - e.movetype = e.vore_oldmovetype; - e.view_ofs_z = PL_VIEW_OFS_z; - e.alpha = default_player_alpha; - - // if we disconnect dead prey from the predator, gib it's body - if(e.health <= 0) - e.health = -1000; - e.fakepredator = world; + e.fakeprey = TRUE; // keep fakeprey status + e.stat_eaten = 0; + e.aiment = world; + e.movetype = MOVETYPE_TOSS; } -void Vore_ChoosePreyRelease(entity e) +void Vore_PreyRelease(entity e, float pred_disconnect) { - // if the fulldigest feature is on, we don't spit a dead prey's carcass out - if(e.health <= 0 && cvar("g_vore_fulldigest")) + if(pred_disconnect) { - Vore_DeadPrey_Configure(e); - - // if the predator's dead, we detach the dead prey from him - if(e.fakepredator.deadflag != DEAD_NO) + if(e.fakeprey) Vore_DeadPrey_Detach(e); + else + Vore_Regurgitate(e); + } + else if(self.stat_eaten && !self.fakeprey) + { + // if the keepdeadprey feature is on, don't spit a dead prey's carcass out + if(e.deadflag != DEAD_NO && random() < cvar("g_vore_keepdeadprey")) + Vore_DeadPrey_Configure(e); + else + Vore_Regurgitate(e); } - else - Vore_Regurgitate(e); } void Vore_Disconnect() @@ -291,20 +370,17 @@ void Vore_Disconnect() // frees prey from their predators when someone disconnects or goes spectating, or in other circumstances // prey disconnects or goes spectating while inside someone's belly - if(self.predator.classname == "player") - Vore_ChoosePreyRelease(self); + if(self.stat_eaten) + Vore_PreyRelease(self, TRUE); // pred disconnects or goes spectating with players in their belly - else if(self.stomach_load > 0) + entity head; + FOR_EACH_PLAYER(head) { - entity head; - FOR_EACH_PLAYER(head) - { - if(head.predator == self) - Vore_ChoosePreyRelease(head); - } - Vore_Gurglesound(); // stop the gurgling sound + if(head.predator == self || head.fakepredator == self) + Vore_PreyRelease(head, TRUE); } + Vore_GurgleSound(); // stop the gurgling sound self.stomach_load = self.gravity = 0; // prevents a bug } @@ -314,21 +390,35 @@ void Vore_Digest() { // apply digestion to prey - if(time > self.predator.digestion_step) + if(time > self.digestion_step) { - Damage(self, self.predator, self.predator, cvar("g_balance_vore_digestion_damage"), DEATH_DIGESTION, self.origin, '0 0 0'); + // if distributed digestion is enabled, reduce digestion strength by the number of prey in our stomach + float reduce; + if(cvar("g_balance_vore_digestion_distribute")) + reduce = self.predator.stomach_load; + else + reduce = 1; + + float damage; + damage = cvar("g_balance_vore_digestion_damage") / reduce; + + // apply player scale to digestion damage + if(cvar("g_balance_vore_digestion_playerscale")) + damage *= self.predator.scale; + + Damage(self, self.predator, self.predator, 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"); + self.predator.health += cvar("g_balance_vore_digestion_vampire") / reduce; if (self.predator.digestsound_finished < time) { PlayerSound (self.predator, playersound_digest, CHAN_PLAYER, VOICETYPE_PLAYERSOUND); self.predator.digestsound_finished = time + 0.5; } - self.predator.digestion_step = time + steptime; + self.digestion_step = time + steptime; } - if(self.health <= 0) + if(self.deadflag != DEAD_NO) if(stov(cvar_string("g_vore_regurgitatecolor_digest"))) self.colormod = stov(cvar_string("g_vore_regurgitatecolor_digest")); } @@ -343,10 +433,16 @@ void Vore_Teamheal() { self.health += cvar("g_balance_vore_teamheal"); self.teamheal_step = time + steptime; + + // play beep sound when a team mate was healed to the maximum amount, to both the prey and the predator + if(self.health >= cvar("g_balance_vore_teamheal_stable")) + { + play2(self, "misc/beep.wav"); + play2(self.predator, "misc/beep.wav"); + } } } -.float stomachkick_delay; void Vore_StomachKick() { // allows prey to kick the predator's stomach and do some damage or attempt to escape @@ -354,12 +450,25 @@ void Vore_StomachKick() if(time > self.stomachkick_delay) { float damage; + vector force; 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.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); + force = v_forward * cvar("g_balance_vore_kick_force"); + + // apply player scale to the damage / force of the kick + if(cvar("g_balance_vore_kick_playerscale")) + { + damage *= self.scale; + force *= self.scale; + } - if(random() < cvar("g_balance_vore_kick_escapeprobability")) - Vore_Regurgitate(self); + Damage(self.predator, self, self, damage, DEATH_STOMACHKICK, self.predator.origin, force); + sound(self.predator, CHAN_PROJECTILE, strcat("weapons/hit", ftos(floor(random() * 8)), ".wav"), VOL_BASE, ATTN_NORM); + self.predator.punchangle_x -= cvar("g_balance_vore_kick_predator_punchangle"); + self.punchangle_x += cvar("g_balance_vore_kick_prey_punchangle"); + + // abort the predator's scheduled regurgitation + if(random() < cvar("g_balance_vore_kick_cutregurgitate")) + self.predator.regurgitate_prepare = 0; self.stomachkick_delay = time + cvar("g_balance_vore_kick_delay"); } @@ -373,12 +482,89 @@ void Vore_StomachLeave() Vore_Regurgitate(self); else if(time > self.complain_vore) { - play2(self, "misc/unavailable.wav"); + play2(self, "misc/forbidden.wav"); sprint(self, strcat("You cannot get out of ", self.predator.netname, "\n")); self.complain_vore = time + complain_delay_time; } } +void Vore_AutoTaunt() +{ + // triggers ambient vore taunts, for both pred and prey + + float taunt_time; + + // predator taunts + if(self.stomach_load && !Stomach_TeamMates_check(self)) + { + 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); + } + + // prey taunts + if(self.stat_eaten && !(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_SetSbarRings() +{ + // first clear the ring stats, then configure them if needed + self.stat_sbring1_type = self.stat_sbring1_clip = 0; + self.stat_sbring2_type = self.stat_sbring2_clip = 0; + + if(self.stat_eaten) + { + if(time <= self.stomachkick_delay) + { + self.stat_sbring1_type = 3; // ring shows stomach kick delay, empties with progress + self.stat_sbring1_clip = bound(0, (time / self.stomachkick_delay - 1) / ((self.stomachkick_delay - cvar("g_balance_vore_kick_delay")) / self.stomachkick_delay - 1), 1); + } + } + else + { + if(self.swallow_progress_pred) + { + self.stat_sbring1_type = 1; // ring shows predator swallow progress, fills with progress + self.stat_sbring1_clip = bound(0, self.swallow_progress_pred, 1); + } + else if(time <= self.action_delay) + { + self.stat_sbring1_type = 2; // ring shows vore action delay, empties with progress + self.stat_sbring1_clip = bound(0, (time / self.action_delay - 1) / ((self.action_delay - cvar("g_balance_vore_action_delay")) / self.action_delay - 1), 1); + } + + if(self.swallow_progress_prey) + { + self.stat_sbring2_type = 1; // ring shows prey swallow progress, fills with progress + self.stat_sbring2_clip = bound(0, self.swallow_progress_prey, 1); + } + else if(time <= self.regurgitate_prepare) + { + self.stat_sbring2_type = 2; // ring shows regurgitation preparing, fills with progress + self.stat_sbring2_clip = 1 - bound(0, (time / self.regurgitate_prepare - 1) / ((self.regurgitate_prepare - cvar("g_balance_vore_regurgitate_delay")) / self.regurgitate_prepare - 1), 1); + } + } +} + void Vore() { // main vore code, this is where it all happens @@ -389,8 +575,10 @@ void Vore() return; } + Vore_AutoTaunt(); + // wash the goo away from players once they leave the stomach - if(self.predator.classname != "player") + if(!self.stat_eaten) if(stov(cvar_string("g_vore_regurgitatecolor_release"))) if(self.colormod) if(cvar("g_vore_regurgitatecolor_release_fade")) @@ -406,8 +594,11 @@ void Vore() self.colormod_z = 1; } - // set all vore related stats - if(self.predator.classname == "player") + // set all vore stats + Vore_SetSbarRings(); + if(self.fakepredator.classname == "player") + self.stat_eaten = num_for_edict(self.fakepredator); + else 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 @@ -424,7 +615,7 @@ void Vore() // 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") + if(self.predator.stat_eaten) { entity target_predator, target_predator_predator, oldself; target_predator = self.predator; @@ -445,6 +636,20 @@ void Vore() } } + // the swallow progress of prey and preds idly decrease by this amount + if(self.swallow_progress_pred) + { + self.swallow_progress_pred -= cvar("g_balance_vore_swallow_speed_decrease") * frametime; + if(self.swallow_progress_pred < 0) + self.swallow_progress_pred = 0; + } + if(self.swallow_progress_prey) + { + self.swallow_progress_prey -= cvar("g_balance_vore_swallow_speed_decrease") * frametime; + if(self.swallow_progress_prey < 0) + self.swallow_progress_prey = 0; + } + // 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 { @@ -464,9 +669,20 @@ void Vore() prey = Swallow_player_check(); // attempt to swallow our new prey if we pressed the attack button, and there's any in range - if(self.BUTTON_ATCK) + self.stat_canswallow = 0; if(Swallow_condition_check(prey)) - Vore_Swallow(prey); + { + // 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_SwallowStep(prey); + } + else if(prey != world) + self.stat_canswallow = -1; // toggle digestion, if the player has someone in their stomach if(self.BUTTON_DIGEST && cvar("g_vore_digestion")) @@ -481,7 +697,7 @@ void Vore() } else if(time > self.complain_vore) { - play2(self, "misc/unavailable.wav"); + play2(self, "misc/forbidden.wav"); sprint(self, "There is nothing to digest\n"); self.complain_vore = time + complain_delay_time; } @@ -490,7 +706,7 @@ void Vore() self.digesting = FALSE; // predator wishes to regurgitate his prey - if(self.BUTTON_REGURGITATE) + if(self.BUTTON_REGURGITATE && time > self.action_delay) { if(self.stomach_load) { @@ -503,27 +719,36 @@ void Vore() } else if(time > self.complain_vore) { - play2(self, "misc/unavailable.wav"); + play2(self, "misc/forbidden.wav"); sprint(self, "There is nothing to regurgitate\n"); self.complain_vore = time + complain_delay_time; } } if(cvar("g_vore_gurglesound")) - Vore_Gurglesound(); + Vore_GurgleSound(); // -------------------------------- // Code that addresses the prey: // -------------------------------- - if(self.deadflag) + Vore_SetPreyPositions(); + + // keepdeadprey - detach dead prey if their predator died or got swallowed + if(self.fakeprey) + if(self.fakepredator.deadflag != DEAD_NO || self.fakepredator.stat_eaten) + Vore_DeadPrey_Detach(self); + + if(!self.stat_eaten) + return; + + if(self.deadflag != DEAD_NO) { - Vore_ChoosePreyRelease(self); + Vore_PreyRelease(self, FALSE); return; } - if(self.predator.classname != "player") - return; - if(self.predator.deadflag) + + if(self.predator.deadflag != DEAD_NO) Vore_Regurgitate(self); else if(vlen(self.predator.velocity) > cvar("g_balance_vore_regurgitate_speedcap")) Vore_Regurgitate(self); @@ -549,5 +774,7 @@ void Vore() if(self.BUTTON_JUMP) Vore_StomachLeave(); - Vore_CameraEffect_Apply(); + // Ugly workaround for a Keyhunt issue. Your team's key can still be given to you while in the stomach + // (at round start), which is pretty ugly and wrong. So attempt to drop keys each frame for prey + kh_Key_DropAll(self, FALSE); } \ No newline at end of file