]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
also add a time check to the dryfire sound, apparently it plays many times for bots
authorFruitieX <rasse@rasse-laptop.(none)>
Thu, 21 Oct 2010 19:49:14 +0000 (22:49 +0300)
committerFruitieX <rasse@rasse-laptop.(none)>
Thu, 21 Oct 2010 19:49:14 +0000 (22:49 +0300)
qcsrc/server/cl_weaponsystem.qc

index 4537573c5d57b28c6ed7757a4aea131bcd78d109..4430d5e7881584105d591ff2f99c327be4fba752 100644 (file)
@@ -1106,6 +1106,7 @@ void W_SwitchToOtherWeapon(entity pl)
        if(ww)
                W_SwitchWeapon_Force(pl, ww);
 }
+.float prevdryfire;
 float weapon_prepareattack_checkammo(float secondary)
 {
        if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
@@ -1117,8 +1118,11 @@ float weapon_prepareattack_checkammo(float secondary)
                for(mine = world; (mine = find(mine, classname, "mine")); ) if(mine.owner == self)
                        return FALSE;
 
-               if(self.weapon == self.switchweapon) // only play once BEFORE starting to switch weapons
+               if(self.weapon == self.switchweapon && time - self.prevdryfire > 1) // only play once BEFORE starting to switch weapons
+               {
                        sound (self, CHAN_AUTO, "weapons/dryfire.wav", VOL_BASE, ATTN_NORM);
+                       self.prevdryfire = time;
+               }
 
                W_SwitchToOtherWeapon(self);
                return FALSE;