X-Git-Url: https://de.git.xonotic.org/?p=voretournament%2Fvoretournament.git;a=blobdiff_plain;f=data%2Fqcsrc%2Fserver%2Fvore.qc;h=b824895ee2a36019ff7824b0b14fdac3a0a8f599;hp=ae7a55f27207965449f495499dab00b294856501;hb=63a785ce32f31ab72c814565cde1523cab0232cd;hpb=c57df944f03551c2b7a20ae651c5b48c02d845dd diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index ae7a55f2..b824895e 100644 --- a/data/qcsrc/server/vore.qc +++ b/data/qcsrc/server/vore.qc @@ -12,11 +12,11 @@ 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; + vector vore_w_shotorg, vore_w_shotdir; + vore_w_shotorg = self.origin + self.view_ofs; + vore_w_shotdir = v_forward; - WarpZone_traceline_antilag(self, w_shotorg, w_shotorg + w_shotdir * cvar("g_balance_vore_swallow_range"), FALSE, self, ANTILAG_LATENCY(self)); + WarpZone_traceline_antilag(self, vore_w_shotorg, vore_w_shotorg + vore_w_shotdir * cvar("g_balance_vore_swallow_range"), FALSE, self, ANTILAG_LATENCY(self)); if(trace_fraction < 1) if(trace_ent.classname == "player") return trace_ent; @@ -35,9 +35,9 @@ float Swallow_condition_check(entity prey) { if(teams_matter && prey.team == self.team && !cvar("g_vore_teamvore")) { - if(time > self.complain_vore) + if(time > self.complain_vore && self.BUTTON_ATCK) { - play2(self, "misc/unavailable.wav"); + play2(self, "misc/forbidden.wav"); sprint(self, "You cannot swallow your team mates\n"); self.complain_vore = time + complain_delay_time; } @@ -46,9 +46,9 @@ float Swallow_condition_check(entity prey) if(self.stomach_load >= cvar("g_balance_vore_swallow_limit")) { - if(time > self.complain_vore) + if(time > self.complain_vore && self.BUTTON_ATCK) { - play2(self, "misc/unavailable.wav"); + play2(self, "misc/forbidden.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; } @@ -58,9 +58,9 @@ float Swallow_condition_check(entity prey) if(cvar("g_vore_biggergut")) if(prey.stomach_load > self.stomach_load) { - if(time > self.complain_vore) + if(time > self.complain_vore && self.BUTTON_ATCK) { - play2(self, "misc/unavailable.wav"); + play2(self, "misc/forbidden.wav"); sprint(self, "You cannot swallow someone with a bigger stomach than yours\n"); self.complain_vore = time + complain_delay_time; } @@ -72,6 +72,22 @@ float Swallow_condition_check(entity prey) return FALSE; } +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") @@ -144,23 +160,14 @@ void Vore_AutoDigest(entity e) { // if the predator has the autodigest preference enabled, begin digesting new prey automatically - if not(cvar("g_vore_digestion")) + if(!cvar("g_vore_digestion") || e.digesting) return; - if not(e.cvar_cl_vore_autodigest) - return; - if(clienttype(e) != CLIENTTYPE_REAL) - return; // this feature is only for players - - entity head; - if(teams_matter) - { - FOR_EACH_PLAYER(head) - { - // never begin automatic digestion if we've swallowed a team mate - if(head.team == e.team) - 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; } @@ -194,8 +201,10 @@ void Vore_Swallow(entity e) 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); @@ -277,7 +286,7 @@ void Vore_DeadPrey_Configure(entity e) e.aiment = e.fakepredator; // completely remove the dead body - e.alpha = -1; + e.modelindex = 0; } void Vore_DeadPrey_Detach(entity e) @@ -289,22 +298,24 @@ void Vore_DeadPrey_Detach(entity e) return; e.fakepredator = world; + e.fakeprey = FALSE; e.aiment = world; - - if(!e.deadflag) - e.fakeprey = FALSE; + e.movetype = MOVETYPE_TOSS; } -void Vore_PreyRelease(entity e) +void Vore_PreyRelease(entity e, float pred_disconnect) { // if the keepdeadprey feature is on, don't spit a dead prey's carcass out if(e.health <= 0 && cvar("g_vore_keepdeadprey")) { - 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); + if(pred_disconnect) + { + if(e.fakeprey) + Vore_DeadPrey_Detach(e); + } + else + Vore_DeadPrey_Configure(e); } else Vore_Regurgitate(e); @@ -316,19 +327,16 @@ void Vore_Disconnect() // prey disconnects or goes spectating while inside someone's belly if(self.predator.classname == "player") - Vore_PreyRelease(self); + 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_PreyRelease(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 } @@ -367,6 +375,13 @@ 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"); + } } } @@ -377,15 +392,35 @@ void Vore_StomachKick() if(time > self.stomachkick_delay) { - float damage; + float damage, force, rekick; + entity e; + 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 = cvar("g_balance_vore_kick_force"); + rekick = time + cvar("g_balance_vore_kick_delay"); + + // if we still have a weapon, we use that to kick for more damage + // stomach kicking with a weapon does nothing more than boosting existing damage + if(self.weapon) + { + e = get_weaponinfo(self.weapon); + damage += cvar(strcat("g_balance_", e.netname, "_kick_damage")); + force += cvar(strcat("g_balance_", e.netname, "_kick_force")); + rekick += cvar(strcat("g_balance_", e.netname, "_kick_refire")); + if (!g_norecoil) + self.punchangle_x -= cvar(strcat("g_balance_", e.netname, "_kick_recoil")); + sound (self, CHAN_WEAPON2, "weapons/grabber_swing.wav", VOL_BASE, ATTN_NORM); + weapon_thinkf(WFRAME_FIRE2, rekick, w_ready); // only intended to animate the gun, as damage is calculated above + } + + Damage(self.predator, self, self, damage, DEATH_STOMACHKICK, self.predator.origin, v_forward * force); + sound(self.predator, CHAN_PROJECTILE, "weapons/stomachkick.wav", VOL_BASE, ATTN_NORM); + self.predator.punchangle_x -= self.predator.cvar_cl_vore_kick_punchangle; if(random() < cvar("g_balance_vore_kick_escapeprobability")) Vore_Regurgitate(self); - self.stomachkick_delay = time + cvar("g_balance_vore_kick_delay"); + self.stomachkick_delay = rekick; } } @@ -397,12 +432,49 @@ 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.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() { // main vore code, this is where it all happens @@ -413,6 +485,8 @@ void Vore() 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"))) @@ -488,9 +562,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_Swallow(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")) @@ -505,7 +590,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; } @@ -527,7 +612,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 regurgitate\n"); self.complain_vore = time + complain_delay_time; } @@ -550,7 +635,7 @@ void Vore() if(self.deadflag) { - Vore_PreyRelease(self); + Vore_PreyRelease(self, FALSE); return; }