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

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Jun 11 07:48:26 EDT 2009


Author: div0
Date: 2009-06-11 07:48:25 -0400 (Thu, 11 Jun 2009)
New Revision: 6981

Modified:
   trunk/data/qcsrc/server/bots.qc
Log:
fix bot moveto command and routing... now all bots can get to their seats


Modified: trunk/data/qcsrc/server/bots.qc
===================================================================
--- trunk/data/qcsrc/server/bots.qc	2009-06-11 11:00:33 UTC (rev 6980)
+++ trunk/data/qcsrc/server/bots.qc	2009-06-11 11:48:25 UTC (rev 6981)
@@ -1318,6 +1318,14 @@
 {
 	entity w;
 
+	// drop the waypoint to a proper location:
+	//   first move it up by a player height
+	//   then move it down to hit the floor with player bbox size
+	traceline(position, position + '0 0 1' * (PL_MAX_z - PL_MIN_z), MOVE_NOMONSTERS, world);
+	tracebox(trace_endpos, PL_MIN, PL_MAX, trace_endpos + '0 0 -1024', MOVE_NOMONSTERS, world);
+	if(trace_fraction < 1)
+		position = trace_endpos;
+
 	w = waypoint_spawn(position, position, WAYPOINTFLAG_GENERATED | WAYPOINTFLAG_PERSONAL);
 	w.nearestwaypoint = world;
 	w.nearestwaypointtimeout = 0;
@@ -1506,7 +1514,7 @@
 					if (walkfromwp)
 					{
 						//print("^1can I reach ", vtos(org), " from ", vtos(v), "?\n");
-						if (tracewalk(ent, v, PL_MIN, PL_MAX, org, MOVE_NORMAL))
+						if (tracewalk(ent, v, PL_MIN, PL_MAX, org, MOVE_NOMONSTERS))
 						{
 							bestdist = dist;
 							best = w;
@@ -1514,7 +1522,7 @@
 					}
 					else
 					{
-						if (tracewalk(ent, org, PL_MIN, PL_MAX, v, MOVE_NORMAL))
+						if (tracewalk(ent, org, PL_MIN, PL_MAX, v, MOVE_NOMONSTERS))
 						{
 							bestdist = dist;
 							best = w;
@@ -1557,7 +1565,7 @@
 			if (vlen(diff) < maxdist)
 			{
 				head.wpconsidered = TRUE;
-				if (tracewalk(self, self.origin, self.mins, self.maxs, v, MOVE_NORMAL))
+				if (tracewalk(self, self.origin, self.mins, self.maxs, v, MOVE_NOMONSTERS))
 				{
 					head.wpnearestpoint = v;
 					head.wpcost = vlen(v - self.origin) + head.dmg;
@@ -1790,7 +1798,7 @@
 	navigation_pushroute(e);
 
 	// if it can reach the goal there is nothing more to do
-	if (tracewalk(self, startposition, PL_MIN, PL_MAX, e.origin, MOVE_NORMAL))
+	if (tracewalk(self, startposition, PL_MIN, PL_MAX, e.origin, MOVE_NOMONSTERS))
 		return TRUE;
 
 	// see if there are waypoints describing a path to the item



More information about the nexuiz-commits mailing list