X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=data%2Fqcsrc%2Fserver%2Fvore.qc;h=7dd8017661d3a70b5aec4da5f932d2f35b5c0c0b;hb=d542937738d8cf6e06c891b89b054de8cbf482bb;hp=2429326b16f27201a30e3b64501e923cbb51bfd4;hpb=19b2166e669ed5315d9ff526c091c552bb741a37;p=voretournament%2Fvoretournament.git diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index 2429326b..7dd80176 100644 --- a/data/qcsrc/server/vore.qc +++ b/data/qcsrc/server/vore.qc @@ -1,5 +1,5 @@ .float regurgitate_prepare; -.float system_delay, swallow_delay, digest_button_delay_time, regurgitate_button_delay_time; +.float stomachkick_delay, system_delay, action_delay, digest_button_delay_time, regurgitate_button_delay_time; .float complain_vore; .float vore_oldmovetype, vore_oldsolid, vore_oldstomachload; @@ -33,57 +33,33 @@ float Swallow_condition_check(entity prey) // checks the necessary conditions for swallowing a player 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(prey.classname == "player" && !prey.stat_eaten && prey.deadflag == DEAD_NO) // we can't swallow someone who's already in someone else's stomach + if(self.classname == "player" && !self.stat_eaten && self.deadflag == DEAD_NO) // we can't swallow players while inside someone's stomach ourselves + if(!self.BUTTON_REGURGITATE && self.action_delay < time) if not(vlen(self.velocity) > cvar("g_balance_vore_regurgitate_speedcap")) { + string swallow_complain; if(teams_matter && prey.team == self.team && !cvar("g_vore_teamvore")) + swallow_complain = "You cannot swallow your team mates\n"; + else if(!cvar("g_vore_spawnshield") && prey.spawnshieldtime > time) + swallow_complain = "You cannot swallow someone protected by the spawn shield\n"; + else if(self.stomach_load >= cvar("g_balance_vore_swallow_limit")) + swallow_complain = strcat("You cannot swallow more than ^2", cvar_string("g_balance_vore_swallow_limit"), "^7 players at a time\n"); + else if(cvar("g_vore_biggergut") && prey.stomach_load > self.stomach_load) + swallow_complain = "You cannot swallow someone with a bigger stomach than yours\n"; + else if(cvar("g_vore_biggersize") && prey.scale > self.scale) + swallow_complain = "You cannot swallow someone larger than you\n"; + + if(swallow_complain != "") { if(time > self.complain_vore && self.BUTTON_ATCK) { play2(self, "misc/forbidden.wav"); - sprint(self, "You cannot swallow your team mates\n"); + sprint(self, swallow_complain); self.complain_vore = time + complain_delay_time; } return FALSE; } - - if(self.stomach_load >= cvar("g_balance_vore_swallow_limit")) - { - if(time > self.complain_vore && self.BUTTON_ATCK) - { - 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; - } - return FALSE; - } - - if(cvar("g_vore_biggergut")) - if(prey.stomach_load > self.stomach_load) - { - if(time > self.complain_vore && self.BUTTON_ATCK) - { - 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; - } - return FALSE; - } - - if(!cvar("g_vore_spawnshield")) - if(prey.spawnshieldtime > time) - { - if(time > self.complain_vore && self.BUTTON_ATCK) - { - play2(self, "misc/forbidden.wav"); - sprint(self, "You cannot swallow someone protected by the spawn shield\n"); - self.complain_vore = time + complain_delay_time; - } - return FALSE; - } - return TRUE; } return FALSE; @@ -107,7 +83,7 @@ float Stomach_TeamMates_check(entity pred) float Vore_CanLeave() { - if(self.predator.classname == "player") + if(self.stat_eaten) { if(!cvar("g_vore_kick")) // you are defenseless in the stomach if you can't kick, so allow leaving return TRUE; @@ -119,34 +95,20 @@ float Vore_CanLeave() return FALSE; } -// make the camera smoothly lower itself when we get swallowed -// our aim is going from the normal view offset to half of the view offset (because half is the best positioning for the stomach model) -.float cameraeffect_current, cameraeffect_target; -void Vore_CameraEffect_Set(entity e) +// position the camera properly for prey +void Vore_SetCamera() { - e.cameraeffect_current = 1; - e.cameraeffect_target = 2; -} -void Vore_CameraEffect_Apply() -{ - if not(self.predator.classname == "player" || self.fakeprey) + if not(self.stat_eaten) return; - if(self.cvar_cl_vore_cameraspeed) - { - local float step; - step = self.cvar_cl_vore_cameraspeed * frametime; - - // not sure if these maths are good, as the effect should be smoother - if(self.cameraeffect_current >= self.cameraeffect_target + step) - self.cameraeffect_current -= step; - else if(self.cameraeffect_current <= self.cameraeffect_target - step) - self.cameraeffect_current += step; - } - else - self.cameraeffect_current = self.cameraeffect_target; + self.view_ofs = PL_PREY_VIEW_OFS; - self.view_ofs_z = PL_PREY_VIEW_OFS_z / self.cameraeffect_current; + float prey_height; + if(self.fakeprey) + prey_height = (self.scale - self.fakepredator.scale) * cvar("g_healthsize_vore_pos"); + else + prey_height = (self.scale - self.predator.scale) * cvar("g_healthsize_vore_pos"); + self.view_ofs_z += prey_height; } .float gurgle_oldstomachload; @@ -203,7 +165,6 @@ void Vore_Swallow(entity e) e.velocity = '0 0 0'; e.movetype = MOVETYPE_FOLLOW; e.solid = SOLID_NOT; - e.alpha = -1; // best way of hiding the eaten player e.aiment = e.predator; // follow the predator, automatically unset when regurgitated // drop keys (KH) and flags (CTF) when we get swallowed @@ -211,8 +172,6 @@ void Vore_Swallow(entity e) if(e.flagcarried) DropFlag(e.flagcarried, world, e.predator); - Vore_CameraEffect_Set(e); - if(stov(cvar_string("g_vore_regurgitatecolor_release"))) e.colormod = stov(cvar_string("g_vore_regurgitatecolor_release")); @@ -235,8 +194,9 @@ void Vore_Swallow(entity e) // 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; - e.predator.swallow_delay = time + cvar("g_balance_vore_swallow_delay"); + e.predator.action_delay = time + cvar("g_balance_vore_action_delay"); e.system_delay = e.predator.system_delay = time + system_delay_time; + e.stomachkick_delay = time + cvar("g_balance_vore_kick_delay"); // don't kick immediately after being swallowed } void Vore_Regurgitate(entity e) @@ -247,7 +207,6 @@ void Vore_Regurgitate(entity e) if(e.health > 0) // leave SOLID_NOT for dead bodies e.solid = e.vore_oldsolid; e.view_ofs_z = PL_VIEW_OFS_z; - e.alpha = default_player_alpha; // apply velocities local vector oldforward, oldright, oldup; @@ -270,7 +229,7 @@ void Vore_Regurgitate(entity e) e.predator.punchangle_x += cvar("g_balance_vore_regurgitate_punchangle"); e.predator.stomach_load -= 1; e.predator.regurgitate_prepare = 0; - e.predator.swallow_delay = time + cvar("g_balance_vore_swallow_delay"); + e.predator.action_delay = time + cvar("g_balance_vore_action_delay"); Vore_WeightApply(e.predator); // block firing for a small amount of time, or we'll be firing the next frame @@ -283,7 +242,7 @@ void Vore_DeadPrey_Configure(entity e) { // ran when the keepdeadprey feature is enabled and prey stays inside the stomach after dying - if(e.fakeprey || e.predator.classname != "player") // already configured + if(e.fakeprey || !e.stat_eaten) // we already configured everything return; // this entity is like e.predator but for dead prey, to avoid conflicts @@ -301,9 +260,6 @@ void Vore_DeadPrey_Configure(entity e) e.takedamage = DAMAGE_NO; e.solid = SOLID_NOT; e.aiment = e.fakepredator; - - // completely remove the dead body - e.modelindex = 0; } void Vore_DeadPrey_Detach(entity e) @@ -315,7 +271,8 @@ void Vore_DeadPrey_Detach(entity e) return; e.fakepredator = world; - e.fakeprey = FALSE; + e.fakeprey = TRUE; // keep fakeprey status + e.stat_eaten = 0; e.aiment = world; e.movetype = MOVETYPE_TOSS; } @@ -329,7 +286,7 @@ void Vore_PreyRelease(entity e, float pred_disconnect) else Vore_Regurgitate(e); } - else + else if(self.stat_eaten && !self.fakeprey) { // if the keepdeadprey feature is on, don't spit a dead prey's carcass out if(e.deadflag != DEAD_NO && random() < cvar("g_vore_keepdeadprey")) @@ -344,7 +301,7 @@ 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") + if(self.stat_eaten) Vore_PreyRelease(self, TRUE); // pred disconnects or goes spectating with players in their belly @@ -403,7 +360,6 @@ void Vore_Teamheal() } } -.float stomachkick_delay; void Vore_StomachKick() { // allows prey to kick the predator's stomach and do some damage or attempt to escape @@ -461,7 +417,7 @@ void Vore_AutoTaunt() } // prey taunts - if(self.predator.classname == "player" && !(teams_matter && self.team == self.predator.team)) + if(self.stat_eaten && !(teams_matter && self.team == self.predator.team)) { if(!self.taunt_soundtime) // taunt_soundtime becomes 0 once the taunt has played { @@ -476,6 +432,20 @@ void Vore_AutoTaunt() } } +void Vore_SetSbarRings() +{ + if(self.action_delay > time) + { + self.stat_sbring1_type = 1; // ring shows vore action delay + self.stat_sbring1_clip = bound(0, (time / self.action_delay - 1) / ((self.action_delay - cvar("g_balance_vore_action_delay")) / self.action_delay - 1), 1); + } + else + { + self.stat_sbring1_type = 0; + self.stat_sbring1_clip = 0; + } +} + void Vore() { // main vore code, this is where it all happens @@ -489,7 +459,7 @@ void Vore() Vore_AutoTaunt(); // wash the goo away from players once they leave the stomach - if(self.predator.classname != "player") + if(!self.stat_eaten) if(stov(cvar_string("g_vore_regurgitatecolor_release"))) if(self.colormod) if(cvar("g_vore_regurgitatecolor_release_fade")) @@ -506,7 +476,8 @@ void Vore() } // set all vore stats - if(self.fakeprey) + Vore_SetSbarRings(); + if(self.fakepredator.classname == "player") self.stat_eaten = num_for_edict(self.fakepredator); else if(self.predator.classname == "player") { @@ -525,7 +496,7 @@ void Vore() // don't allow a player inside a player inside another player :) // prevent this by checking if such has happened, and taking the proper measures // this code has a high priority and must not be stopped by any delay, so run it here - if(self.predator.predator.classname == "player") + if(self.predator.stat_eaten) { entity target_predator, target_predator_predator, oldself; target_predator = self.predator; @@ -628,14 +599,14 @@ void Vore() // Code that addresses the prey: // -------------------------------- - Vore_CameraEffect_Apply(); + Vore_SetCamera(); // 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") + if(self.fakeprey) + if(self.fakepredator.deadflag != DEAD_NO || self.fakepredator.stat_eaten) Vore_DeadPrey_Detach(self); - if(self.predator.classname != "player") + if(!self.stat_eaten) return; if(self.deadflag != DEAD_NO) @@ -651,6 +622,7 @@ void Vore() // apply delayed regurgitating if it was scheduled if(self.predator.regurgitate_prepare && time > self.predator.regurgitate_prepare) + if(time > self.predator.action_delay) { self.predator.regurgitate_prepare = 0; self.predator.complain_vore = time + complain_delay_time; // prevent complaining the next frame if this empties our stomach