From: Mario Date: Thu, 27 Nov 2014 06:10:15 +0000 (+1100) Subject: Shotgun: use secondary melee (if available) in place of primary if the player runs... X-Git-Tag: xonotic-v0.8.0~122^2~26 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=504a58a38c5364397c4c9d8bc0a62a44e973d654;p=xonotic%2Fxonotic-data.pk3dir.git Shotgun: use secondary melee (if available) in place of primary if the player runs out of shells --- diff --git a/qcsrc/common/weapons/w_shotgun.qc b/qcsrc/common/weapons/w_shotgun.qc index 5261c62dd..9e87f8c85 100644 --- a/qcsrc/common/weapons/w_shotgun.qc +++ b/qcsrc/common/weapons/w_shotgun.qc @@ -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... diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index 580be7c9e..d42450741 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -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);