From: Rudolf Polzer Date: Fri, 7 Jan 2011 22:26:21 +0000 (+0100) Subject: fix antispam of hitsounds; fix shotgun and electro refire times with weapon rate... X-Git-Tag: xonotic-v0.5.0~109^2~28 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=510a3950c7191ae2cdd355925e385e4a67bd35ae;p=xonotic%2Fxonotic-data.pk3dir.git fix antispam of hitsounds; fix shotgun and electro refire times with weapon rate factor --- diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 2ad648e5d..3530fcacc 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -778,7 +778,9 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float { if(damage > 0) { - if(attacker.weapon != WEP_ELECTRO && attacker.weapon != WEP_LASER || ((attacker.weapon == WEP_ELECTRO && autocvar_g_balance_electro_lightning || attacker.weapon == WEP_LASER) && attacker.prevhitsound + autocvar_sv_hitsound_antispam_time < time)) + if(attacker.weapon != WEP_LASER + && (attacker.weapon != WEP_ELECTRO || !autocvar_g_balance_electro_lightning) + && attacker.prevhitsound + autocvar_sv_hitsound_antispam_time < time) { if(targ.BUTTON_CHAT) attacker.typehitsound += 1; @@ -809,8 +811,12 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float } else { - if(deathtype != DEATH_FIRE) + if(deathtype != DEATH_FIRE + && attacker.prevhitsound + autocvar_sv_hitsound_antispam_time < time) + { attacker.typehitsound += 1; + attacker.prevhitsound = time; + } if(mirrordamage > 0) if(time > attacker.teamkill_complain) { diff --git a/qcsrc/server/w_electro.qc b/qcsrc/server/w_electro.qc index 2a6b1f393..13301a0f7 100644 --- a/qcsrc/server/w_electro.qc +++ b/qcsrc/server/w_electro.qc @@ -426,7 +426,7 @@ float w_electro(float req) W_Electro_Attack2(); self.electro_count = autocvar_g_balance_electro_secondary_count; weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_electro_secondary_animtime, w_electro_checkattack); - self.electro_secondarytime = time + autocvar_g_balance_electro_secondary_refire2; + self.electro_secondarytime = time + autocvar_g_balance_electro_secondary_refire2 * W_WeaponRateFactor(); } } else if (req == WR_PRECACHE) diff --git a/qcsrc/server/w_shotgun.qc b/qcsrc/server/w_shotgun.qc index 08c4a901e..d9d717ecd 100644 --- a/qcsrc/server/w_shotgun.qc +++ b/qcsrc/server/w_shotgun.qc @@ -56,9 +56,12 @@ void shotgun_meleethink (void) vector angle; angle = v_forward; + float meleetime; + meleetime = autocvar_g_balance_shotgun_secondary_melee_time * W_WeaponRateFactor(); + // perform trace float f; - f = (self.cnt + autocvar_g_balance_shotgun_secondary_melee_time - time) / autocvar_g_balance_shotgun_secondary_melee_time * 2 - 1; + f = (self.cnt + meleetime - time) / meleetime * 2 - 1; vector targpos; targpos = self.owner.origin + self.owner.view_ofs + angle * autocvar_g_balance_shotgun_secondary_melee_range + v_right * f * autocvar_g_balance_shotgun_secondary_melee_swing + v_up * f * autocvar_g_balance_shotgun_secondary_melee_swing; @@ -74,7 +77,7 @@ void shotgun_meleethink (void) Damage (trace_ent, self.owner, self.owner, autocvar_g_balance_shotgun_secondary_damage * min(1, f + 1), WEP_SHOTGUN | HITTYPE_SECONDARY , self.owner.origin + self.owner.view_ofs, force); remove(self); } - else if(time >= self.cnt + autocvar_g_balance_shotgun_secondary_melee_time) // missed, remove ent + else if(time >= self.cnt + meleetime) // missed, remove ent remove(self); else // continue swinging the weapon in hope of hitting someone :) self.nextthink = time;