X-Git-Url: https://de.git.xonotic.org/?p=voretournament%2Fvoretournament.git;a=blobdiff_plain;f=data%2Fqcsrc%2Fserver%2Fvore.qc;h=d755ddf5266ed339e4ddc14d38141b97d02f25c7;hp=6fa15248e59653384e05721116a88a844aef78a6;hb=b9db73efaf104647a43cf39cd84e4b0ad5c85611;hpb=198e7748800ea4fd51f5d0fb72456787decac16f diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index 6fa15248..d755ddf5 100644 --- a/data/qcsrc/server/vore.qc +++ b/data/qcsrc/server/vore.qc @@ -12,11 +12,16 @@ entity Swallow_player_check() { // check if we can swallow a player instead of firing our weapon + float swallow_range; vector vore_w_shotorg, vore_w_shotdir; - vore_w_shotorg = self.origin + self.view_ofs; + + swallow_range = cvar("g_balance_vore_swallow_range"); + if(self.scale) // we can swallow from further or closer based on our size + swallow_range *= self.scale; + vore_w_shotorg = self.origin; vore_w_shotdir = v_forward; - WarpZone_traceline_antilag(self, vore_w_shotorg, vore_w_shotorg + vore_w_shotdir * cvar("g_balance_vore_swallow_range"), FALSE, self, ANTILAG_LATENCY(self)); + WarpZone_traceline_antilag(self, vore_w_shotorg, vore_w_shotorg + vore_w_shotdir * swallow_range, FALSE, self, ANTILAG_LATENCY(self)); if(trace_fraction < 1) if(trace_ent.classname == "player") return trace_ent; @@ -67,6 +72,18 @@ float Swallow_condition_check(entity prey) 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; @@ -112,7 +129,7 @@ void Vore_CameraEffect_Set(entity e) } void Vore_CameraEffect_Apply() { - if(self.predator.classname != "player") + if not(self.predator.classname == "player" || self.fakeprey) return; if(self.cvar_cl_vore_cameraspeed) @@ -129,7 +146,11 @@ void Vore_CameraEffect_Apply() else self.cameraeffect_current = self.cameraeffect_target; - self.view_ofs_z = PL_VIEW_OFS_z / self.cameraeffect_current; + self.view_ofs_z = PL_PREY_VIEW_OFS_z / self.cameraeffect_current; + if(self.predator.scale) + self.view_ofs_z *= self.predator.scale; + else if(self.fakepredator.scale) + self.view_ofs_z *= self.fakepredator.scale; } .float gurgle_oldstomachload; @@ -305,20 +326,21 @@ void Vore_DeadPrey_Detach(entity e) void Vore_PreyRelease(entity e, float pred_disconnect) { - // if the keepdeadprey feature is on, don't spit a dead prey's carcass out - if(e.deadflag != DEAD_NO && cvar("g_vore_keepdeadprey")) + if(pred_disconnect) { - // if keepdeadprey is enabled and the predator disconnected, detach the dead prey - if(pred_disconnect) - { - if(e.fakeprey) - Vore_DeadPrey_Detach(e); - } + if(e.fakeprey) + Vore_DeadPrey_Detach(e); else - Vore_DeadPrey_Configure(e); + Vore_Regurgitate(e); } else - Vore_Regurgitate(e); + { + // 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")) + Vore_DeadPrey_Configure(e); + else + Vore_Regurgitate(e); + } } void Vore_Disconnect() @@ -487,8 +509,10 @@ void Vore() self.colormod_z = 1; } - // set all vore related stats - if(self.predator.classname == "player") + // set all vore stats + if(self.fakeprey) + self.stat_eaten = num_for_edict(self.fakepredator); + else if(self.predator.classname == "player") { self.stat_stomachload = self.predator.stomach_load; // necessary for the stomach board self.stat_digesting = self.predator.digesting; // necessary for the stomach board @@ -608,6 +632,8 @@ void Vore() // Code that addresses the prey: // -------------------------------- + Vore_CameraEffect_Apply(); + // 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") @@ -648,8 +674,6 @@ void Vore() if(self.BUTTON_JUMP) Vore_StomachLeave(); - Vore_CameraEffect_Apply(); - // Ugly workaround for a Keyhunt issue. Your team's key can still be given to you while in the stomach // (at round start), which is pretty ugly and wrong. So attempt to drop keys each frame for prey kh_Key_DropAll(self, FALSE);