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 3cf527d..9227cda 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