}
// find the spawnfunc_waypoint near a dynamic goal such as a dropped weapon
-entity navigation_findnearestwaypoint_withdist(entity ent, float walkfromwp, float bestdist)
+entity navigation_findnearestwaypoint_withdist_except(entity ent, float walkfromwp, float bestdist, entity except)
{
entity waylist, w, best;
vector v, org, pm1, pm2;
while (w)
{
// if object is touching spawnfunc_waypoint
- if(w != ent)
+ if(w != ent && w != except)
if (boxesoverlap(pm1, pm2, w.absmin, w.absmax))
return w;
w = w.chain;
}
entity navigation_findnearestwaypoint(entity ent, float walkfromwp)
{
- return navigation_findnearestwaypoint_withdist(ent, walkfromwp, 1050);
+ entity wp = navigation_findnearestwaypoint_withdist_except(ent, walkfromwp, 1050, world);
+ if (autocvar_g_waypointeditor_auto)
+ {
+ entity wp2 = navigation_findnearestwaypoint_withdist_except(ent, walkfromwp, 1050, wp);
+ if (!wp2)
+ wp.wpflags |= WAYPOINTFLAG_PROTECTED;
+ }
+ return wp;
}
// finds the waypoints near the bot initiating a navigation query
t = zdistance / autocvar_g_jetpack_maxspeed_up;
t += xydistance / autocvar_g_jetpack_maxspeed_side;
fuel = t * autocvar_g_jetpack_fuel * 0.8;
-
+
bot_debug(strcat("jetpack ai: required fuel ", ftos(fuel), " self.ammo_fuel ", ftos(self.ammo_fuel), "\n"));
// enough fuel ?