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

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat May 30 14:59:51 EDT 2009


Author: mand1nga
Date: 2009-05-30 14:59:51 -0400 (Sat, 30 May 2009)
New Revision: 6813

Modified:
   trunk/data/qcsrc/server/havocbot_roles.qc
Log:
Make bots find their ctf base

Modified: trunk/data/qcsrc/server/havocbot_roles.qc
===================================================================
--- trunk/data/qcsrc/server/havocbot_roles.qc	2009-05-30 17:49:32 UTC (rev 6812)
+++ trunk/data/qcsrc/server/havocbot_roles.qc	2009-05-30 18:59:51 UTC (rev 6813)
@@ -353,6 +353,37 @@
 		navigation_routerating(head, ratingscale, 10000);
 };
 
+void havocbot_goalrating_ctf_ourbase(float ratingscale)
+{
+	if not(bot_waypoints_for_items)
+	{
+		havocbot_goalrating_ctf_ourflag(ratingscale);
+		return;
+	}
+
+	local entity head;
+	head = ctf_worldflaglist;
+	while (head)
+	{
+		if (self.team == head.team)
+			break;
+		head = head.ctf_worldflagnext;
+	}
+	if not(head)
+		return;
+
+	head = findradius(head.dropped_origin, 100);
+	while(head)
+	{
+		if(head.classname=="waypoint")
+		{
+			navigation_routerating(head, ratingscale, 10000);
+			return;
+		}
+		head=head.chain;
+	}
+};
+
 void havocbot_goalrating_ctf_enemyflag(float ratingscale)
 {
 	local entity head;
@@ -433,7 +464,7 @@
 	{
 		self.bot_strategytime = time + cvar("bot_ai_strategyinterval");
 		navigation_goalrating_start();
-		havocbot_goalrating_ctf_ourflag(50000);
+		havocbot_goalrating_ctf_ourbase(50000);
 		if(self.health<100)
 			havocbot_goalrating_ctf_carrieritems(1000, self.origin, 1000);
 		navigation_goalrating_end();



More information about the nexuiz-commits mailing list