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

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Jun 10 09:43:00 EDT 2009


Author: div0
Date: 2009-06-10 09:42:59 -0400 (Wed, 10 Jun 2009)
New Revision: 6957

Modified:
   trunk/data/qcsrc/server/bots.qc
   trunk/data/qcsrc/server/bots_scripting.qc
   trunk/data/qcsrc/server/gamecommand.qc
   trunk/data/qcsrc/server/havocbot.qc
Log:
bots: minor fixes, still not good...


Modified: trunk/data/qcsrc/server/bots.qc
===================================================================
--- trunk/data/qcsrc/server/bots.qc	2009-06-10 09:20:43 UTC (rev 6956)
+++ trunk/data/qcsrc/server/bots.qc	2009-06-10 13:42:59 UTC (rev 6957)
@@ -111,6 +111,7 @@
 		#ifdef DEBUG_TRACEWALK
 			debugnodestatus(start, DEBUG_NODE_FAIL);
 		#endif
+		//print("tracewalk: ", vtos(start), " is a bad start\n");
 		return FALSE;
 	}
 
@@ -125,6 +126,7 @@
 			#ifdef DEBUG_TRACEWALK
 				debugnodestatus(org, DEBUG_NODE_SUCCESS);
 			#endif
+			//print("tracewalk: ", vtos(start), " can reach ", vtos(end), "\n");
 			return TRUE;
 		}
 		#ifdef DEBUG_TRACEWALK
@@ -145,6 +147,7 @@
 				#ifdef DEBUG_TRACEWALK
 					debugnodestatus(org, DEBUG_NODE_FAIL);
 				#endif
+				//print("tracewalk: ", vtos(start), " hits a hazard when trying to reach ", vtos(end), "\n");
 				return FALSE;
 			}
 		}
@@ -176,6 +179,7 @@
 						debugnodestatus(org, DEBUG_NODE_FAIL);
 					#endif
 					return FALSE;
+					//print("tracewalk: ", vtos(start), " failed under water\n");
 				}
 				continue;
 
@@ -221,6 +225,9 @@
 						#ifdef DEBUG_TRACEWALK
 							debugnodestatus(trace_endpos, DEBUG_NODE_FAIL);
 						#endif
+						//print("tracewalk: ", vtos(start), " hit something when trying to reach ", vtos(end), "\n");
+						//te_explosion(trace_endpos);
+						//print(ftos(e.dphitcontentsmask), "\n");
 						return FALSE; // failed
 					}
 				}
@@ -251,6 +258,8 @@
 		}
 	}
 
+	//print("tracewalk: ", vtos(start), " did not arrive at ", vtos(end), " but at ", vtos(org), "\n");
+
 	// moved but didn't arrive at the intended destination
 	#ifdef DEBUG_TRACEWALK
 		debugnodestatus(org, DEBUG_NODE_FAIL);
@@ -561,10 +570,12 @@
 {
 	local entity e;
 	local vector sv, sm1, sm2, ev, em1, em2, dv;
+
+	stepheightvec = cvar("sv_stepheight") * '0 0 1';
+
 	//dprint("waypoint_think wpisbox = ", ftos(self.wpisbox), "\n");
 	sm1 = self.origin + self.mins;
 	sm2 = self.origin + self.maxs;
-	stepheightvec = cvar("sv_stepheight") * '0 0 1';
 	for(e = world; (e = find(e, classname, "waypoint")); )
 	{
 		if (boxesoverlap(self.absmin, self.absmax, e.absmin, e.absmax))
@@ -769,6 +780,23 @@
 
 	waypoint_clearlinks(w);
 	//waypoint_schedulerelink(w);
+
+	if (cvar("g_waypointeditor"))
+	{
+		m1 = w.mins;
+		m2 = w.maxs;
+		setmodel(w, "models/runematch/rune.mdl"); w.effects = EF_LOWPRECISION;
+		setsize(w, m1, m2);
+		if (w.wpflags & WAYPOINTFLAG_ITEM)
+			w.colormod = '1 0 0';
+		else if (w.wpflags & WAYPOINTFLAG_GENERATED)
+			w.colormod = '1 1 0';
+		else
+			w.colormod = '1 1 1';
+	}
+	else
+		w.model = "";
+
 	return w;
 };
 
@@ -1285,6 +1313,9 @@
 {
 	entity w;
 
+	tracebox(position, PL_MIN, PL_MAX, position + '0 0 -1024', MOVE_NORMAL, world);
+	if(trace_fraction < 1)
+		position = trace_endpos;
 	w = waypoint_spawn(position, position, WAYPOINTFLAG_GENERATED | WAYPOINTFLAG_PERSONAL);
 	w.nearestwaypoint = world;
 	w.nearestwaypointtimeout = 0;
@@ -1300,6 +1331,7 @@
 // completely empty the goal stack, used when deciding where to go
 void navigation_clearroute()
 {
+	//print("bot ", etos(self), " clear\n");
 	self.navigation_hasgoals = FALSE;
 	self.goalcurrent = world;
 	self.goalstack01 = world;
@@ -1339,6 +1371,7 @@
 // (in other words: add a new prerequisite before going to the later goals)
 void navigation_pushroute(entity e)
 {
+	//print("bot ", etos(self), " push ", etos(e), "\n");
 	self.goalstack31 = self.goalstack30;
 	self.goalstack30 = self.goalstack29;
 	self.goalstack29 = self.goalstack28;
@@ -1378,6 +1411,7 @@
 // (used when a spawnfunc_waypoint is reached)
 void navigation_poproute()
 {
+	//print("bot ", etos(self), " pop\n");
 	if(self.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL && self.goalcurrent.owner==self)
 		remove(self.goalcurrent);
 
@@ -1430,8 +1464,9 @@
 	while (w)
 	{
 		// if object is touching spawnfunc_waypoint
-		if (boxesoverlap(pm1, pm2, w.absmin, w.absmax))
-			return w;
+		if(w != ent)
+			if (boxesoverlap(pm1, pm2, w.absmin, w.absmax))
+				return w;
 		w = w.chain;
 	}
 
@@ -1448,39 +1483,45 @@
 	while (w)
 	{
 		// if object can walk from spawnfunc_waypoint
-		if (w.wpisbox)
+		if(w != ent)
 		{
-			local vector wm1, wm2;
-			wm1 = w.origin + w.mins;
-			wm2 = w.origin + w.maxs;
-			v_x = bound(wm1_x, org_x, wm2_x);
-			v_y = bound(wm1_y, org_y, wm2_y);
-			v_z = bound(wm1_z, org_z, wm2_z);
-		}
-		else
-			v = w.origin;
-		dist = vlen(v - org);
-		if (bestdist > dist)
-		{
-			if (walkfromwp)
+			if (w.wpisbox)
 			{
-				traceline(v, org, TRUE, ent);
-				if (trace_fraction == 1)
-				if (tracewalk(ent, v, PL_MIN, PL_MAX, org, MOVE_NORMAL))
-				{
-					bestdist = dist;
-					best = w;
-				}
+				local vector wm1, wm2;
+				wm1 = w.origin + w.mins;
+				wm2 = w.origin + w.maxs;
+				v_x = bound(wm1_x, org_x, wm2_x);
+				v_y = bound(wm1_y, org_y, wm2_y);
+				v_z = bound(wm1_z, org_z, wm2_z);
 			}
 			else
+				v = w.origin;
+			dist = vlen(v - org);
+			if (bestdist > dist)
 			{
 				traceline(v, org, TRUE, ent);
 				if (trace_fraction == 1)
-				if (tracewalk(ent, org, PL_MIN, PL_MAX, v, MOVE_NORMAL))
 				{
-					bestdist = dist;
-					best = w;
+					if (walkfromwp)
+					{
+						//print("^1can I reach ", vtos(org), " from ", vtos(v), "?\n");
+						if (tracewalk(ent, v, PL_MIN, PL_MAX, org, MOVE_NORMAL))
+						{
+							bestdist = dist;
+							best = w;
+						}
+					}
+					else
+					{
+						if (tracewalk(ent, org, PL_MIN, PL_MAX, v, MOVE_NORMAL))
+						{
+							bestdist = dist;
+							best = w;
+						}
+					}
 				}
+				else
+					te_lightning1(world, v, org);
 			}
 		}
 		w = w.chain;
@@ -2639,6 +2680,7 @@
 		{
 			//navigation_testtracewalk = TRUE;
 			head = navigation_findnearestwaypoint(player, FALSE);
+			print("currently selected WP is ", etos(head), "\n");
 			//navigation_testtracewalk = FALSE;
 			if (head)
 			{
@@ -2790,6 +2832,8 @@
 	if (time < 2)
 		return;
 
+	stepheightvec = cvar("sv_stepheight") * '0 0 1';
+
 	if(time > autoskill_nextthink)
 	{
 		float a;

Modified: trunk/data/qcsrc/server/bots_scripting.qc
===================================================================
--- trunk/data/qcsrc/server/bots_scripting.qc	2009-06-10 09:20:43 UTC (rev 6956)
+++ trunk/data/qcsrc/server/bots_scripting.qc	2009-06-10 13:42:59 UTC (rev 6957)
@@ -897,7 +897,6 @@
 {
 	entity e;
 	e = find(world, targetname, bot_cmd.bot_cmd_parm_string);
-	print(etos(e), "\n");
 	if(!e)
 		return CMD_STATUS_ERROR;
 	return self.cmd_moveto(e.origin + (e.mins + e.maxs) * 0.5);

Modified: trunk/data/qcsrc/server/gamecommand.qc
===================================================================
--- trunk/data/qcsrc/server/gamecommand.qc	2009-06-10 09:20:43 UTC (rev 6956)
+++ trunk/data/qcsrc/server/gamecommand.qc	2009-06-10 13:42:59 UTC (rev 6957)
@@ -913,6 +913,15 @@
 		}
 	}
 
+	if(argv(0) == "tracewalk")
+	{
+		e = nextent(world);
+		if(tracewalk(e, stov(argv(1)), e.mins, e.maxs, stov(argv(2)), MOVE_NORMAL))
+			print("can walk\n");
+		else
+			print("cannot walk\n");
+	}
+
 	if(argv(0) == "bot_cmd")
 	{
 		if(argv(1) == "help")

Modified: trunk/data/qcsrc/server/havocbot.qc
===================================================================
--- trunk/data/qcsrc/server/havocbot.qc	2009-06-10 09:20:43 UTC (rev 6956)
+++ trunk/data/qcsrc/server/havocbot.qc	2009-06-10 13:42:59 UTC (rev 6957)
@@ -1136,6 +1136,7 @@
 			// Refresh path to goal if necessary
 			local entity g;
 			g = self.goalentity;
+			//print("bot ", etos(self), " goal = ", etos(g), "\n");
 			navigation_clearroute();
 			navigation_routetogoal(g,self.origin);
 			bot_strategytoken_taken = TRUE;
@@ -1170,8 +1171,9 @@
 
 	// Put it as next goal
 	navigation_clearroute();
-	navigation_findnearestwaypoint(wp, TRUE);
+	wp.nearestwaypoint = navigation_findnearestwaypoint(wp, TRUE);
 	navigation_routetogoal(wp,self.origin);
+	//print("bot ", etos(self), " goal = ", etos(self.goalentity), "\n");
 	bot_strategytoken_taken = TRUE;
 	self.bot_strategytime = time + 10;
 



More information about the nexuiz-commits mailing list