X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=data%2Fqcsrc%2Fserver%2Fvore.qc;h=871b199a6d09bf5c8404e30c1ecadd5faa4e5e46;hb=7d0e112313909fe2ea8ff744475d14b3bdba80ac;hp=b2fa9e6077cdcf1c8298a55a2e83c40d24a207cb;hpb=707d1eb842e207b926673310b0868cad06633777;p=voretournament%2Fvoretournament.git diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index b2fa9e60..871b199a 100644 --- a/data/qcsrc/server/vore.qc +++ b/data/qcsrc/server/vore.qc @@ -38,52 +38,26 @@ float Swallow_condition_check(entity prey) if(!self.BUTTON_REGURGITATE && self.swallow_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"; + + 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; @@ -119,39 +93,16 @@ 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) -{ - e.cameraeffect_current = 1; - e.cameraeffect_target = 2; -} -void Vore_CameraEffect_Apply() +// position the camera properly for prey +void Vore_SetCamera() { - if not(self.predator.classname == "player" || self.fakeprey) + if not(self.predator.classname == "player" || self.fakeprey > 1) 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_x = PL_PREY_VIEW_OFS_x; - self.view_ofs_y = PL_PREY_VIEW_OFS_y; - self.view_ofs_z = PL_PREY_VIEW_OFS_z / self.cameraeffect_current; + self.view_ofs = PL_PREY_VIEW_OFS; float prey_height; - if(self.fakeprey) + if(self.fakeprey > 1) 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"); @@ -212,7 +163,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 @@ -220,8 +170,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")); @@ -256,7 +204,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; @@ -297,7 +244,7 @@ void Vore_DeadPrey_Configure(entity e) // this entity is like e.predator but for dead prey, to avoid conflicts e.fakepredator = e.predator; - e.fakeprey = TRUE; + e.fakeprey = 2; // is fakeprey in a stomach // 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 @@ -310,9 +257,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) @@ -324,7 +268,7 @@ void Vore_DeadPrey_Detach(entity e) return; e.fakepredator = world; - e.fakeprey = FALSE; + e.fakeprey = 1; // was fakeprey but is now detached e.aiment = world; e.movetype = MOVETYPE_TOSS; } @@ -333,7 +277,7 @@ void Vore_PreyRelease(entity e, float pred_disconnect) { if(pred_disconnect) { - if(e.fakeprey) + if(e.fakeprey > 1) Vore_DeadPrey_Detach(e); else Vore_Regurgitate(e); @@ -515,7 +459,7 @@ void Vore() } // set all vore stats - if(self.fakeprey) + if(self.fakeprey > 1) self.stat_eaten = num_for_edict(self.fakepredator); else if(self.predator.classname == "player") { @@ -637,7 +581,7 @@ 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")