From 2c9873e6258862d994252cd0b322d2da6e8aeb43 Mon Sep 17 00:00:00 2001 From: div0 Date: Thu, 11 Jun 2009 11:48:25 +0000 Subject: [PATCH] fix bot moveto command and routing... now all bots can get to their seats git-svn-id: svn://svn.icculus.org/nexuiz/trunk@6981 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/qcsrc/server/bots.qc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/data/qcsrc/server/bots.qc b/data/qcsrc/server/bots.qc index 6984ab9ab..9acd0c12e 100644 --- a/data/qcsrc/server/bots.qc +++ b/data/qcsrc/server/bots.qc @@ -1318,6 +1318,14 @@ entity waypoint_spawnpersonal(vector position) { 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 @@ entity navigation_findnearestwaypoint(entity ent, float walkfromwp) 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 @@ entity navigation_findnearestwaypoint(entity ent, float walkfromwp) } 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 @@ float navigation_markroutes_nearestwaypoints(entity waylist, float maxdist) 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 @@ float navigation_routetogoal(entity e, vector startposition) 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 -- 2.39.2