X-Git-Url: https://de.git.xonotic.org/?p=voretournament%2Fvoretournament.git;a=blobdiff_plain;f=data%2Fqcsrc%2Fserver%2Fvore.qc;h=e5452e6a739c3775376955e8438afe1241da7d68;hp=ea485cbe7c3fcd0d624854ea95a710e4310342f7;hb=9f40eda7868f8c3998f417e39cc2f29d9554b6b3;hpb=5ce84e194606e4366bd10dead6e7b17ede816c87 diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index ea485cbe..e5452e6a 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 disconnected, detach the dead prey - if(self.fakepredator.classname != "player") - 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); @@ -355,6 +388,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); @@ -377,6 +411,43 @@ void Vore_StomachLeave() } } +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 @@ -387,6 +458,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"))) @@ -462,9 +535,18 @@ 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); + } // toggle digestion, if the player has someone in their stomach if(self.BUTTON_DIGEST && cvar("g_vore_digestion")) @@ -514,7 +596,7 @@ void Vore() // Code that addresses the prey: // -------------------------------- - // fulldigest - detach dead prey if their predator died or got swallowed + // 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);