X-Git-Url: https://de.git.xonotic.org/?p=voretournament%2Fvoretournament.git;a=blobdiff_plain;f=data%2Fqcsrc%2Fserver%2Fvore.qc;h=29f8dbb341c626cf28d2d41beb1ef70f6f5c2a59;hp=7e002a1aef7ecb8d1815a813c78ae60d7e4989b9;hb=4b9caeddce1cef91ece68d14cfa849fbe3fcb02b;hpb=327e3779dabc15111318aba1f5fd84b2d387bbc5 diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index 7e002a1a..29f8dbb3 100644 --- a/data/qcsrc/server/vore.qc +++ b/data/qcsrc/server/vore.qc @@ -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") @@ -140,6 +156,22 @@ void Vore_WeightApply(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) @@ -180,6 +212,7 @@ void Vore_Swallow(entity e) 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; @@ -229,7 +262,7 @@ 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.fakeprey || e.predator.classname != "player") // already configured return; @@ -259,7 +292,7 @@ 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 not(cvar("g_vore_fulldigest")) + if not(cvar("g_vore_keepdeadprey")) return; e.fakepredator = world; @@ -271,14 +304,14 @@ void Vore_DeadPrey_Detach(entity e) void Vore_PreyRelease(entity e) { - // if the fulldigest feature is on, 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 fulldigest is enabled and the predator is dead or disconnected, detach the dead prey from him - if(self.fakepredator.classname != "player" || self.fakepredator.deadflag != DEAD_NO) - Vore_DeadPrey_Detach(self); + // 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); @@ -377,6 +410,41 @@ void Vore_StomachLeave() } } +void Vore_AutoTaunt() +{ + // triggers ambient vore taunts, for both pred and prey + + // 50/50 probability for either a predator or prey to play the taunt + if(random() < 0.5) + { + // predator taunts + if(self.stomach_load && !Stomach_TeamMates_check(self)) + { + if(!self.taunt_soundtime) + SetAutoTaunt(self, time, TRUE, 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, FALSE, 0); + } + } + else + { + // prey taunts + if(self.predator.classname == "player" && !(teams_matter && self.team == self.predator.team)) + { + if(!self.taunt_soundtime) + SetAutoTaunt(self, time, TRUE, 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, FALSE, 0); + } + } +} + void Vore() { // main vore code, this is where it all happens @@ -387,6 +455,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"))) @@ -514,6 +584,11 @@ void Vore() // 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;