return this.bot_strategytime < time;
}
+void navigation_goalrating_timeout_extend_if_needed(entity this, float seconds)
+{
+ this.bot_strategytime = max(this.bot_strategytime, time + seconds);
+}
+
#define MAX_CHASE_DISTANCE 700
bool navigation_goalrating_timeout_can_be_anticipated(entity this)
{
return false;
}
+// Unfortuntely we can't use trace_inwater since it doesn't hold the fraction of the total
+// distance that was traveled before impact as the description in the engine (collision.h) says.
+// It would have helped to speed up tracewalk underwater
vector resurface_limited(vector org, float lim, vector m1)
{
if (WETFEET(org + eZ * (lim - org.z)))
vector pm1 = ent.origin + ent.mins;
vector pm2 = ent.origin + ent.maxs;
- // do two scans, because box test is cheaper
- IL_EACH(g_waypoints, it != ent && it != except && !(it.wpflags & WAYPOINTFLAG_TELEPORT),
+ if (autocvar_g_waypointeditor && !IS_BOT_CLIENT(ent))
+ {
+ // this code allows removing waypoints in the air and seeing jumppad/telepport waypoint links
+ // FIXME it causes a bug where a waypoint spawned really close to another one (max 16 qu)
+ // isn't detected as the nearest waypoint
+ IL_EACH(g_waypoints, it != ent && it != except,
+ {
+ if (boxesoverlap(pm1, pm2, it.absmin, it.absmax))
+ return it;
+ });
+ }
+ else
{
- if(boxesoverlap(pm1, pm2, it.absmin, it.absmax))
+ // do two scans, because box test is cheaper
+ IL_EACH(g_waypoints, it != ent && it != except && !(it.wpflags & (WAYPOINTFLAG_TELEPORT | WAYPOINTFLAG_JUMP)),
{
- if(!autocvar_g_waypointeditor && walkfromwp && !ent.navigation_dynamicgoal)
+ if(boxesoverlap(pm1, pm2, it.absmin, it.absmax))
{
- waypoint_clearlinks(ent); // initialize wpXXmincost fields
- navigation_item_addlink(it, ent);
+ if(walkfromwp && !ent.navigation_dynamicgoal)
+ {
+ waypoint_clearlinks(ent); // initialize wpXXmincost fields
+ navigation_item_addlink(it, ent);
+ }
+ return it;
}
- return it;
- }
- });
+ });
+ }
vector org = ent.origin;
if (navigation_testtracewalk)
waypoint_clearlinks(ent); // initialize wpXXmincost fields
IL_EACH(g_waypoints, it != ent,
{
- if(walkfromwp && (it.wpflags & WAYPOINTFLAG_NORELINK))
+ if (walkfromwp && (it.wpflags & WPFLAGMASK_NORELINK))
continue;
set_tracewalk_dest(ent, it.origin, false);
// box check failed, try walk
IL_EACH(g_waypoints, it != ent,
{
- if(walkfromwp && (it.wpflags & WAYPOINTFLAG_NORELINK))
+ if (walkfromwp && (it.wpflags & WPFLAGMASK_NORELINK))
continue;
v = it.origin;
LOG_DEBUG("jetpack ai: required fuel ", ftos(fuel), ", have ", ftos(GetResource(this, RES_FUEL)));
// enough fuel ?
- if(GetResource(this, RES_FUEL) > fuel || (this.items & IT_UNLIMITED_WEAPON_AMMO))
+ if(GetResource(this, RES_FUEL) > fuel || (this.items & IT_UNLIMITED_AMMO))
{
// Estimate cost
// (as onground costs calculation is mostly based on distances, here we do the same establishing some relationship
next = this.goalstack01;
// if for some reason the bot is closer to the next goal, pop the current one
- if (!IS_MOVABLE(next) // already checked in the previous case
+ if (!IS_MOVABLE(next) && !(this.goalcurrent.wpflags & (WAYPOINTFLAG_TELEPORT | WAYPOINTFLAG_JUMP))
&& vlen2(this.goalcurrent.origin - next.origin) > vlen2(next.origin - this.origin)
&& checkpvs(this.origin + this.view_ofs, next))
{
if(vdist(wp.origin - this.origin, >, 50))
{
wp = NULL;
- IL_EACH(g_waypoints, !(it.wpflags & WAYPOINTFLAG_TELEPORT),
+ IL_EACH(g_waypoints, !(it.wpflags & (WAYPOINTFLAG_TELEPORT | WAYPOINTFLAG_JUMP)),
{
if(vdist(it.origin - this.origin, <, 50))
{