]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Shotgun: use secondary melee (if available) in place of primary if the player runs...
authorMario <zacjardine@y7mail.com>
Thu, 27 Nov 2014 06:10:15 +0000 (17:10 +1100)
committerMario <zacjardine@y7mail.com>
Thu, 27 Nov 2014 06:10:15 +0000 (17:10 +1100)
qcsrc/common/weapons/w_shotgun.qc
qcsrc/server/weapons/weaponsystem.qc

index 5261c62dd54c7d7d7ff1f3f6c92ca0399fe27216..9e87f8c85a9890e95236f5cd4e60c5bf4cd74894 100644 (file)
@@ -230,7 +230,8 @@ float W_Shotgun(float req)
                        }
                        if(self.clip_load >= 0) // we are not currently reloading
                        if(!self.crouch) // no crouchmelee please
-                       if(self.BUTTON_ATCK2 && WEP_CVAR(shotgun, secondary))
+                       if(WEP_CVAR(shotgun, secondary))
+                       if((self.BUTTON_ATCK && self.WEP_AMMO(SHOTGUN) <= 0 && !(self.items & IT_UNLIMITED_WEAPON_AMMO)) || self.BUTTON_ATCK2)
                        if(weapon_prepareattack(1, WEP_CVAR_SEC(shotgun, refire)))
                        {
                                // attempt forcing playback of the anim by switching to another anim (that we never play) here...
index 580be7c9eb6550163ba3f3f6dc2d42744d5e8ea9..d424507417ec5025825e619dbd1cf0ef28890dbb 100644 (file)
@@ -458,6 +458,10 @@ float weapon_prepareattack_checkammo(float secondary)
                for(mine = world; (mine = find(mine, classname, "mine")); ) if(mine.owner == self)
                        return FALSE;
 
+               if(self.weapon == WEP_SHOTGUN)
+               if(!secondary && WEP_CVAR(shotgun, secondary))
+                       return FALSE; // no clicking, just allow
+
                if(self.weapon == self.switchweapon && time - self.prevdryfire > 1) // only play once BEFORE starting to switch weapons
                {
                        sound (self, CH_WEAPON_A, "weapons/dryfire.wav", VOL_BASE, ATTEN_NORM);