X-Git-Url: https://de.git.xonotic.org/?p=voretournament%2Fvoretournament.git;a=blobdiff_plain;f=data%2Fqcsrc%2Fserver%2Fvore.qc;h=e51b0b81b887702182ce379cc030defa54faf1f7;hp=30d2840314a70905ea4966aeb34e754f2aa13525;hb=c239012d24e9339dbd990dbf50f310eda2e5d8b2;hpb=06978cd2948a6bbcb2d3bd1cae6eae5d70fcaeb6 diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index 30d28403..e51b0b81 100644 --- a/data/qcsrc/server/vore.qc +++ b/data/qcsrc/server/vore.qc @@ -30,6 +30,7 @@ float Swallow_condition_check(entity prey) 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 not(vlen(self.velocity) > cvar("g_balance_vore_regurgitate_speedcap")) { if(teams_matter && prey.team == self.team && !cvar("g_vore_teamvore")) @@ -75,6 +76,8 @@ float Vore_CanLeave() { if(self.predator.classname == "player") { + if(!cvar("g_vore_kick")) // you are defenseless in the stomach if you can't kick, so allow leaving + return TRUE; if(teams_matter && self.team == self.predator.team) return TRUE; if(g_rpg && cvar("g_rpg_canleave")) @@ -114,7 +117,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) { @@ -125,7 +128,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 @@ -175,7 +178,8 @@ void Vore_Swallow(entity e) e.predator.punchangle_x -= e.predator.cvar_cl_vore_punchangle; e.predator.stomach_load += 1; e.predator.regurgitate_prepare = 0; - Vore_Weight_apply(e.predator); + e.predator.spawnshieldtime = 0; // lose spawn shield when we vore + Vore_WeightApply(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; @@ -215,7 +219,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; @@ -223,13 +227,70 @@ void Vore_Regurgitate(entity e) e.predator = world; } +void Vore_DeadPrey_Configure(entity e) +{ + // ran when the fulldigest feature is enabled and prey stays inside the stomach after dying + + if(e.fakeprey || e.predator.classname != "player") // already configured + return; + + // 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 differently + // the predator's stomach load is also decreased, as dead prey doesn't count any more + e.predator.stomach_load -= 1; + Vore_WeightApply(e.predator); + e.predator = world; + + // 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 remove the dead body + e.alpha = -1; +} + +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")) + return; + + e.fakepredator = world; + e.aiment = world; + + if(!e.deadflag) + e.fakeprey = FALSE; +} + +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")) + { + 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); + } + else if(self.predator.classname != "player") + Vore_Regurgitate(e); +} + 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_Regurgitate(self); + Vore_PreyRelease(self); // pred disconnects or goes spectating with players in their belly else if(self.stomach_load > 0) @@ -238,9 +299,9 @@ void Vore_Disconnect() FOR_EACH_PLAYER(head) { if(head.predator == self) - Vore_Regurgitate(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 @@ -292,7 +353,7 @@ void Vore_StomachKick() { float damage; 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, '0 0 0'); + 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); if(random() < cvar("g_balance_vore_kick_escapeprobability")) @@ -326,6 +387,23 @@ void Vore() return; } + // wash the goo away from players once they leave the stomach + if(self.predator.classname != "player") + if(stov(cvar_string("g_vore_regurgitatecolor_release"))) + if(self.colormod) + if(cvar("g_vore_regurgitatecolor_release_fade")) + { + self.colormod_x += cvar("g_vore_regurgitatecolor_release_fade") * frametime; + if(self.colormod_x > 1) + self.colormod_x = 1; + self.colormod_y += cvar("g_vore_regurgitatecolor_release_fade") * frametime; + if(self.colormod_y > 1) + self.colormod_y = 1; + self.colormod_z += cvar("g_vore_regurgitatecolor_release_fade") * frametime; + if(self.colormod_z > 1) + self.colormod_z = 1; + } + // set all vore related stats if(self.predator.classname == "player") { @@ -384,12 +462,12 @@ 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.BUTTON_REGURGITATE && self.swallow_delay < time) + if(self.BUTTON_ATCK) if(Swallow_condition_check(prey)) Vore_Swallow(prey); // toggle digestion, if the player has someone in their stomach - if(self.BUTTON_DIGEST) + if(self.BUTTON_DIGEST && cvar("g_vore_digestion")) { if(self.stomach_load) { @@ -406,7 +484,7 @@ void Vore() self.complain_vore = time + complain_delay_time; } } - if(!self.stomach_load) + if(!self.stomach_load || !cvar("g_vore_digestion")) self.digesting = FALSE; // predator wishes to regurgitate his prey @@ -430,16 +508,22 @@ void Vore() } if(cvar("g_vore_gurglesound")) - Vore_Gurglesound(); + Vore_GurgleSound(); // -------------------------------- // Code that addresses the prey: // -------------------------------- + if(self.deadflag) + { + Vore_PreyRelease(self); + return; + } + if(self.predator.classname != "player") return; - if(self.deadflag || self.predator.deadflag) + if(self.predator.deadflag) Vore_Regurgitate(self); else if(vlen(self.predator.velocity) > cvar("g_balance_vore_regurgitate_speedcap")) Vore_Regurgitate(self); @@ -460,7 +544,7 @@ void Vore() Vore_Teamheal(); // execute prey commands - if(self.BUTTON_ATCK) + if(self.BUTTON_ATCK && cvar("g_vore_kick")) Vore_StomachKick(); if(self.BUTTON_JUMP) Vore_StomachLeave();