vector dest = '0 0 0';
if ((ent.classname != "waypoint") || ent.wpisbox)
{
- vector wm1 = ent.origin + ent.mins - eZ * (PL_MAX_CONST.z - 1);
- vector wm2 = ent.origin + ent.maxs - eZ * (PL_MIN_CONST.z + 1);
+ vector wm1 = ent.origin + ent.mins;
+ vector wm2 = ent.origin + ent.maxs;
dest.x = bound(wm1.x, org.x, wm2.x);
dest.y = bound(wm1.y, org.y, wm2.y);
dest.z = bound(wm1.z, org.z, wm2.z);
{
if ((ent.classname != "waypoint") || ent.wpisbox)
{
- vector wm1 = ent.origin + ent.mins - eZ * (PL_MAX_CONST.z - 1);
- vector wm2 = ent.origin + ent.maxs - eZ * (PL_MIN_CONST.z + 1);
+ vector wm1 = ent.origin + ent.mins;
+ vector wm2 = ent.origin + ent.maxs;
if (IS_PLAYER(ent) || IS_MONSTER(ent))
{
// move destination point out of player bbox otherwise tracebox always fails
vector closer_dest = '0 0 0';
if ((ent.classname != "waypoint") || ent.wpisbox)
{
- vector wm1 = ent.origin + ent.mins - eZ * (PL_MAX_CONST.z - 1);
- vector wm2 = ent.origin + ent.maxs - eZ * (PL_MIN_CONST.z + 1);
+ vector wm1 = ent.origin + ent.mins;
+ vector wm2 = ent.origin + ent.maxs;
closer_dest.x = bound(wm1.x, org.x, wm2.x);
closer_dest.y = bound(wm1.y, org.y, wm2.y);
closer_dest.z = bound(wm1.z, org.z, wm2.z);
// often path can be optimized by not adding the nearest waypoint
if (this.goalentity.navigation_dynamicgoal || autocvar_g_waypointeditor)
{
- set_tracewalk_dest(this.goalentity, nearest_wp.enemy.origin, true);
- if (trace_ent == this || (vdist(tracewalk_dest - nearest_wp.enemy.origin, <, 1050)
- && vlen2(tracewalk_dest - nearest_wp.enemy.origin) < vlen2(nearest_wp.origin - nearest_wp.enemy.origin)
- && tracewalk(this, nearest_wp.enemy.origin, STAT(PL_MIN, this), STAT(PL_MAX, this),
- tracewalk_dest, tracewalk_dest_height, bot_navigation_movemode)))
+ if (nearest_wp.enemy.wpcost < autocvar_bot_ai_strategyinterval_movingtarget)
{
- e = nearest_wp.enemy;
+ if (vdist(vec2(this.goalentity.origin - nearest_wp.origin), <, 32))
+ e = nearest_wp.enemy;
+ else
+ {
+ set_tracewalk_dest(this.goalentity, nearest_wp.enemy.origin, true);
+ if (trace_ent == this || (vdist(tracewalk_dest - nearest_wp.enemy.origin, <, 1050)
+ && vlen2(tracewalk_dest - nearest_wp.enemy.origin) < vlen2(nearest_wp.origin - nearest_wp.enemy.origin)
+ && tracewalk(this, nearest_wp.enemy.origin, STAT(PL_MIN, this), STAT(PL_MAX, this),
+ tracewalk_dest, tracewalk_dest_height, bot_navigation_movemode)))
+ {
+ e = nearest_wp.enemy;
+ }
+ }
}
}
else if(navigation_item_islinked(nearest_wp.enemy, this.goalentity))
if(this.lastteleporttime > 0
&& time - this.lastteleporttime < ((this.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL) ? 2 : 0.15))
{
+ if (this.jumppadcount && !boxesoverlap(this.goalcurrent.absmin, this.goalcurrent.absmax,
+ this.lastteleport_origin + STAT(PL_MIN, this), this.lastteleport_origin + STAT(PL_MAX, this)))
+ {
+ return;
+ }
+
if(this.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING)
if(this.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL && this.goalcurrent.owner==this)
{
entity navigation_get_really_close_waypoint(entity this)
{
entity wp = this.goalcurrent;
- if(!wp || vdist(wp.origin - this.origin, >, 50))
+ if(!wp)
wp = this.goalcurrent_prev;
if(!wp)
return NULL;
+ if(wp != this.goalcurrent_prev && vdist(wp.origin - this.origin, >, 50))
+ {
+ wp = this.goalcurrent_prev;
+ if(!wp)
+ return NULL;
+ }
if(wp.classname != "waypoint")
{
wp = wp.nearestwaypoint;
}
if(vdist(wp.origin - this.origin, >, 50))
{
+ wp = NULL;
IL_EACH(g_waypoints, !(it.wpflags & WAYPOINTFLAG_TELEPORT),
{
if(vdist(it.origin - this.origin, <, 50))
break;
}
});
+ if(!wp)
+ return NULL;
}
if(wp.wpflags & WAYPOINTFLAG_TELEPORT)
return NULL;