]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
fix antispam of hitsounds; fix shotgun and electro refire times with weapon rate...
authorRudolf Polzer <divverent@alientrap.org>
Fri, 7 Jan 2011 22:26:21 +0000 (23:26 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Fri, 7 Jan 2011 22:26:21 +0000 (23:26 +0100)
qcsrc/server/g_damage.qc
qcsrc/server/w_electro.qc
qcsrc/server/w_shotgun.qc

index 2ad648e5d7e429c6efefaeff83f81029a0f9579f..3530fcaccd038c739f553862acd750a1c536f2ac 100644 (file)
@@ -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)
                                                {
index 2a6b1f393e002814af9292f63042894e4c9cb9ef..13301a0f7325b3e8dc4cc54ad9e77288d19e431d 100644 (file)
@@ -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)
index 08c4a901e12083d7bdd972ed8755e3010cf97d9e..d9d717ecdeb6d3165d2c2109d74b55917f756b19 100644 (file)
@@ -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;