[nexuiz-commits] r6417 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Apr 2 19:19:17 EDT 2009


Author: mand1nga
Date: 2009-04-02 19:19:17 -0400 (Thu, 02 Apr 2009)
New Revision: 6417

Modified:
   trunk/data/qcsrc/server/havocbot.qc
Log:
If there are no enemies at sight and the laser is not available then try use the first available weapon


Modified: trunk/data/qcsrc/server/havocbot.qc
===================================================================
--- trunk/data/qcsrc/server/havocbot.qc	2009-04-02 22:56:40 UTC (rev 6416)
+++ trunk/data/qcsrc/server/havocbot.qc	2009-04-02 23:19:17 UTC (rev 6417)
@@ -656,12 +656,27 @@
 float(entity e) w_getbestweapon;
 void havocbot_chooseweapon()
 {
+	local float i;
+
 	// TODO: clean this up by moving it to weapon code
 	if(self.enemy.classname!="player")
 	{
-	//	self.switchweapon = w_getbestweapon(self);
+		// If there aren't enemies at sight use the laser (like most players)
 		if(client_hasweapon(self, WEP_LASER, TRUE, FALSE))
+		{
 			self.switchweapon = WEP_LASER;
+			return;
+		}
+
+		// Otherwise get the first available weapon
+		for(i=WEP_LASER + 1; i < WEP_COUNT ; ++i)
+		{
+			if(client_hasweapon(self, i, TRUE, FALSE))
+			{
+				self.switchweapon = i;
+				return;
+			}
+		}
 		return;
 	}
 
@@ -698,7 +713,7 @@
 	combo_time = time + ct + (ct * ((-0.3*skill)+3));
 
 	// Custom weapon list based on distance to the enemy
-	local float i; i = 0;
+	i = 0;
 	if(bot_custom_weapon){
 
 		// Choose weapons for far distance



More information about the nexuiz-commits mailing list