From: terencehill Date: Sun, 5 Nov 2017 10:39:06 +0000 (+0100) Subject: Bot AI: fix bots using waypoints to reach a player when they could go straight to... X-Git-Tag: xonotic-v0.8.5~2378^2~26 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d019c92d221c861cc11674eb9ab7f9c7720b98e3;p=xonotic%2Fxonotic-data.pk3dir.git Bot AI: fix bots using waypoints to reach a player when they could go straight to him by adjusting tracewalk destination point. Revert workaround introduced in 7d9d2113 as it's no longer needed --- diff --git a/qcsrc/server/bot/default/navigation.qc b/qcsrc/server/bot/default/navigation.qc index 18c4383a0..3ac966196 100644 --- a/qcsrc/server/bot/default/navigation.qc +++ b/qcsrc/server/bot/default/navigation.qc @@ -1425,17 +1425,6 @@ int navigation_poptouchedgoals(entity this) 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); diff --git a/qcsrc/server/bot/default/navigation.qh b/qcsrc/server/bot/default/navigation.qh index 350367984..63d066b51 100644 --- a/qcsrc/server/bot/default/navigation.qh +++ b/qcsrc/server/bot/default/navigation.qh @@ -65,10 +65,17 @@ entity navigation_bestgoal; // 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; \