if(vlen2(this.goalcurrent.origin - this.goalstack01.origin) > vlen2(this.goalstack01.origin - this.origin))
if(checkpvs(this.origin + this.view_ofs, this.goalstack01))
{
- // this can happen when a player stands still or is frozen
- // NOTE: this is only needed because tracewalk always fail when destination
- // point is on a player and bot_navigation_ignoreplayers is false
- if (this.goalentity.navigation_dynamicgoal
- && boxesoverlap(this.absmin, this.absmax, this.goalentity.absmin, this.goalentity.absmax))
- {
- navigation_poproute(this);
- ++removed_goals;
- return removed_goals;
- }
-
vector dest = '0 0 0';
float dest_height = 0;
SET_TRACEWALK_DESTCOORDS(this.goalstack01, this.origin, dest, dest_height);
// if ent is a box waypoint or an item v is set to coords of ent that are closer to org
// (but v.z is set to the lowest coord of ent), v_height is set to ent's height
+// if destination ent is a player make so that destination point doesn't overlap with
+// player bbox, otherwise tracebox always fails (if bot_navigation_ignoreplayers is false)
#define SET_TRACEWALK_DESTCOORDS(ent, org, v, v_height) MACRO_BEGIN { \
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); \
+ if (IS_PLAYER(ent) || IS_MONSTER(ent)) \
+ { \
+ wm1 += vec2(PL_MIN_CONST) + '-1 -1 0'; \
+ wm2 += vec2(PL_MAX_CONST) + '1 1 0'; \
+ } \
v.x = bound(wm1.x, org.x, wm2.x); \
v.y = bound(wm1.y, org.y, wm2.y); \
v.z = wm1.z; \