// rough simulation of walking from one point to another to test if a path
// can be traveled, used for waypoint linking and havocbot
// if end_height is > 0 destination is any point in the vertical segment [end, end + end_height * eZ]
// rough simulation of walking from one point to another to test if a path
// can be traveled, used for waypoint linking and havocbot
// if end_height is > 0 destination is any point in the vertical segment [end, end + end_height * eZ]
bool tracewalk(entity e, vector start, vector m1, vector m2, vector end, float end_height, float movemode)
{
if(autocvar_bot_debug_tracewalk)
bool tracewalk(entity e, vector start, vector m1, vector m2, vector end, float end_height, float movemode)
{
if(autocvar_bot_debug_tracewalk)
ignorehazards = true;
tracebox(start, m1, m2, start, MOVE_NOMONSTERS, e);
ignorehazards = true;
tracebox(start, m1, m2, start, MOVE_NOMONSTERS, e);
- float best_dist = 10000;
- IL_EACH(g_waypoints, vdist(it.origin - theEnemy.origin, <, 500)
+ float best_dist = FLOAT_MAX;
+ IL_EACH(g_waypoints, !(it.wpflags & WAYPOINTFLAG_TELEPORT)
+ && vdist(it.origin - theEnemy.origin, <, 500)
//print("routerating ", etos(e), " = ", ftos(f), " - ", ftos(rangebias), "\n");
// Evaluate path using jetpack
//print("routerating ", etos(e), " = ", ftos(f), " - ", ftos(rangebias), "\n");
// Evaluate path using jetpack
if(this.items & IT_JETPACK)
if(autocvar_bot_ai_navigation_jetpack)
if(vdist(this.origin - goal_org, >, autocvar_bot_ai_navigation_jetpack_mindistance))
if(this.items & IT_JETPACK)
if(autocvar_bot_ai_navigation_jetpack)
if(vdist(this.origin - goal_org, >, autocvar_bot_ai_navigation_jetpack_mindistance))
- LOG_DEBUG("jetpack ai: required fuel ", ftos(fuel), " this.ammo_fuel ", ftos(this.ammo_fuel));
+ LOG_DEBUG("jetpack ai: required fuel ", ftos(fuel), ", have ", ftos(GetResourceAmount(this, RESOURCE_FUEL)));
this.bot_tracewalk_time = max(time, this.bot_tracewalk_time) + 0.25;
bool cut_allowed = false;
this.bot_tracewalk_time = max(time, this.bot_tracewalk_time) + 0.25;
bool cut_allowed = false;
{
LOG_DEBUG("path optimized for ", this.netname, ", removed a goal from the queue");
navigation_poproute(this);
{
LOG_DEBUG("path optimized for ", this.netname, ", removed a goal from the queue");
navigation_poproute(this);
this.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_GOING;
this.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_REACHED;
}
this.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_GOING;
this.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_REACHED;
}
+ if(this.jumppadcount)
+ {
+ // remove jumppad waypoint after a random delay to prevent bots getting
+ // stuck on certain jumppads that require an extra initial horizontal speed
+ float max_delay = 0.1;
+ if (vdist(vec2(this.velocity), >, 2 * autocvar_sv_maxspeed))
+ max_delay = 0.05;
+ if (time - this.lastteleporttime < random() * max_delay)
+ return removed_goals;
+ }
float d = vlen2(this.origin - bot_waypoint_queue_goal.origin);
LOG_DEBUG(this.netname, " evaluating ", bot_waypoint_queue_goal.classname, " with distance ", ftos(d));
set_tracewalk_dest(bot_waypoint_queue_goal, this.origin, false);
float d = vlen2(this.origin - bot_waypoint_queue_goal.origin);
LOG_DEBUG(this.netname, " evaluating ", bot_waypoint_queue_goal.classname, " with distance ", ftos(d));
set_tracewalk_dest(bot_waypoint_queue_goal, this.origin, false);
- if (tracewalk(bot_waypoint_queue_goal, this.origin, STAT(PL_MIN, this), STAT(PL_MAX, this),
+ if (tracewalk(this, this.origin, STAT(PL_MIN, this), STAT(PL_MAX, this),
tracewalk_dest, tracewalk_dest_height, bot_navigation_movemode))
{
if( d > bot_waypoint_queue_bestgoalrating)
tracewalk_dest, tracewalk_dest_height, bot_navigation_movemode))
{
if( d > bot_waypoint_queue_bestgoalrating)