X-Git-Url: https://de.git.xonotic.org/?p=voretournament%2Fvoretournament.git;a=blobdiff_plain;f=data%2Fqcsrc%2Fserver%2Fvore.qc;h=d755ddf5266ed339e4ddc14d38141b97d02f25c7;hp=83694d8e42cca124f3ab9a8cbe1768fd2274ae6d;hb=b9db73efaf104647a43cf39cd84e4b0ad5c85611;hpb=fcd85abb425ce20d629587866b740a7082a4b977 diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index 83694d8e..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; @@ -209,7 +230,7 @@ void Vore_Swallow(entity e) PlayerSound(e.predator, playersound_swallow, CHAN_PAIN, VOICETYPE_PLAYERSOUND); setanim(e.predator, e.predator.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing / regurgitating - e.predator.punchangle_x -= e.predator.cvar_cl_vore_punchangle; + e.predator.punchangle_x -= cvar("g_balance_vore_swallow_punchangle"); e.predator.stomach_load += 1; e.predator.regurgitate_prepare = 0; e.predator.spawnshieldtime = 0; // lose spawn shield when we vore @@ -250,7 +271,7 @@ void Vore_Regurgitate(entity e) PlayerSound(e.predator, playersound_regurgitate, CHAN_PAIN, VOICETYPE_PLAYERSOUND); setanim(e.predator, e.predator.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing / regurgitating pointparticles(particleeffectnum("regurgitate"), e.predator.origin, '0 0 0', 1); - e.predator.punchangle_x += e.predator.cvar_cl_vore_punchangle; + 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"); @@ -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.health <= 0 && 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() @@ -360,7 +382,7 @@ void Vore_Digest() self.predator.digestion_step = time + steptime; } - if(self.health <= 0) + if(self.deadflag != DEAD_NO) if(stov(cvar_string("g_vore_regurgitatecolor_digest"))) self.colormod = stov(cvar_string("g_vore_regurgitatecolor_digest")); } @@ -392,35 +414,18 @@ void Vore_StomachKick() if(time > self.stomachkick_delay) { - float damage, force, rekick; - entity e; - + 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")); - force = cvar("g_balance_vore_kick_force"); - rekick = time + cvar("g_balance_vore_kick_delay"); - // if we still have a weapon, we use that to kick for more damage - // stomach kicking with a weapon does nothing more than boosting existing damage - if(self.weapon) - { - e = get_weaponinfo(self.weapon); - damage += cvar(strcat("g_balance_", e.netname, "_melee_damage")); - force += cvar(strcat("g_balance_", e.netname, "_melee_force")); - rekick += cvar(strcat("g_balance_", e.netname, "_melee_refire")); - if (!g_norecoil) - self.punchangle_x -= cvar(strcat("g_balance_", e.netname, "_melee_recoil")); - sound (self, CHAN_WEAPON, "weapons/grabber_melee.wav", VOL_BASE, ATTN_NORM); - weapon_thinkf(WFRAME_FIRE2, rekick, w_ready); // only intended to animate the gun, as damage is calculated above - } - - Damage(self.predator, self, self, damage, DEATH_STOMACHKICK, self.predator.origin, v_forward * force); + 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.wav", VOL_BASE, ATTN_NORM); - self.predator.punchangle_x -= self.predator.cvar_cl_vore_kick_punchangle; + self.predator.punchangle_x -= cvar("g_balance_vore_kick_predator_punchangle"); + self.punchangle_x += cvar("g_balance_vore_kick_prey_punchangle"); if(random() < cvar("g_balance_vore_kick_escapeprobability")) Vore_Regurgitate(self); - self.stomachkick_delay = rekick; + self.stomachkick_delay = time + cvar("g_balance_vore_kick_delay"); } } @@ -504,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 @@ -625,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") @@ -633,13 +642,13 @@ void Vore() if(self.predator.classname != "player") return; - if(self.deadflag) + if(self.deadflag != DEAD_NO) { Vore_PreyRelease(self, FALSE); return; } - if(self.predator.deadflag) + if(self.predator.deadflag != DEAD_NO) Vore_Regurgitate(self); else if(vlen(self.predator.velocity) > cvar("g_balance_vore_regurgitate_speedcap")) Vore_Regurgitate(self); @@ -665,5 +674,7 @@ 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); } \ No newline at end of file