]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Duplicate some bad code for the sake of fixing bot melee spam when out of ammo (WEAPO...
authorMario <zacjardine@y7mail.com>
Fri, 5 Dec 2014 13:13:58 +0000 (00:13 +1100)
committerMario <zacjardine@y7mail.com>
Fri, 5 Dec 2014 13:13:58 +0000 (00:13 +1100)
qcsrc/common/weapons/w_shotgun.qc

index 3cf527d398eccdb9d99cc0f5eebfb9240d286b88..9227cdab4ee15b1e2c9257e7e167aa319645709e 100644 (file)
@@ -308,6 +308,9 @@ float W_Shotgun(float req)
                }
                case WR_CHECKAMMO2:
                {
+                       if(IS_BOT_CLIENT(self))
+                       if(vlen(self.origin-self.enemy.origin) > WEP_CVAR_SEC(shotgun, melee_range))
+                               return FALSE; // bots cannot use secondary out of range (fixes constant melee when out of ammo)
                        switch(WEP_CVAR(shotgun, secondary))
                        {
                                case 1: return TRUE; // melee does not use ammo