X-Git-Url: http://de.git.xonotic.org/?p=voretournament%2Fvoretournament.git;a=blobdiff_plain;f=data%2Fqcsrc%2Fserver%2Fvore.qc;h=2c83a711ef7ef71df258eb91646832cde296d55d;hp=23e66d44d40350809a0ca25928145d4551225e86;hb=283c9901e0b84d6f4729cababf5e9f44acda6a14;hpb=5d8cde51e02dac8539d6a63fb0b5ff1329ce122b diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index 23e66d44..2c83a711 100644 --- a/data/qcsrc/server/vore.qc +++ b/data/qcsrc/server/vore.qc @@ -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") @@ -117,7 +133,7 @@ void Vore_CameraEffect_Apply() } .float gurgle_oldstomachload; -void Vore_Gurglesound() +void Vore_GurgleSound() { if(time > self.gurglesound_finished || self.gurgle_oldstomachload != self.stomach_load) { @@ -128,7 +144,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 +156,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) @@ -169,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); @@ -179,7 +213,8 @@ void Vore_Swallow(entity e) 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; @@ -219,7 +254,7 @@ void Vore_Regurgitate(entity e) 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); + 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,57 +264,55 @@ 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.predator.classname != "player") // already configured 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 + + // completely remove 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.aiment = world; + + if(!e.deadflag) + e.fakeprey = FALSE; } -void Vore_ChoosePreyRelease(entity e) +void Vore_PreyRelease(entity e) { - // 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 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 the predator's dead, we detach the dead prey from him - if(e.fakepredator.deadflag != DEAD_NO) + // if keepdeadprey is enabled and the predator disconnected, detach the dead prey + if(e.fakepredator.classname != "player") Vore_DeadPrey_Detach(e); } else @@ -292,7 +325,7 @@ void Vore_Disconnect() // prey disconnects or goes spectating while inside someone's belly if(self.predator.classname == "player") - Vore_ChoosePreyRelease(self); + Vore_PreyRelease(self); // pred disconnects or goes spectating with players in their belly else if(self.stomach_load > 0) @@ -301,9 +334,9 @@ void Vore_Disconnect() FOR_EACH_PLAYER(head) { if(head.predator == self) - Vore_ChoosePreyRelease(head); + Vore_PreyRelease(head); } - Vore_Gurglesound(); // stop the gurgling sound + Vore_GurgleSound(); // stop the gurgling sound } self.stomach_load = self.gravity = 0; // prevents a bug @@ -343,6 +376,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.ogg"); + play2(self.predator, "misc/beep.ogg"); + } } } @@ -357,6 +397,7 @@ void Vore_StomachKick() 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); + self.predator.punchangle_x -= self.predator.cvar_cl_vore_kick_punchangle; if(random() < cvar("g_balance_vore_kick_escapeprobability")) Vore_Regurgitate(self); @@ -373,12 +414,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 @@ -389,6 +467,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"))) @@ -464,9 +544,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")) @@ -481,7 +572,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; } @@ -503,26 +594,33 @@ 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: // -------------------------------- + // 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.deadflag) { - Vore_ChoosePreyRelease(self); + Vore_PreyRelease(self); return; } - if(self.predator.classname != "player") - return; + if(self.predator.deadflag) Vore_Regurgitate(self); else if(vlen(self.predator.velocity) > cvar("g_balance_vore_regurgitate_speedcap"))