From: Mario <zacjardine@y7mail.com>
Date: Fri, 5 Dec 2014 13:13:58 +0000 (+1100)
Subject: Duplicate some bad code for the sake of fixing bot melee spam when out of ammo (WEAPO... 
X-Git-Tag: xonotic-v0.8.0~122^2~4
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=81eeee74b314802d8decf44de6d01395e240f38d;p=xonotic%2Fxonotic-data.pk3dir.git

Duplicate some bad code for the sake of fixing bot melee spam when out of ammo (WEAPONTODO)
---

diff --git a/qcsrc/common/weapons/w_shotgun.qc b/qcsrc/common/weapons/w_shotgun.qc
index 3cf527d398..9227cdab4e 100644
--- a/qcsrc/common/weapons/w_shotgun.qc
+++ b/qcsrc/common/weapons/w_shotgun.qc
@@ -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