From: terencehill Date: Tue, 21 Nov 2017 14:21:33 +0000 (+0100) Subject: Bot AI: if the nearest waypoint of a dynamic goal is inside the goal itself or bot... X-Git-Tag: xonotic-v0.8.5~2378^2~15 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3b4c3d10c70529e970952f183a7ee8fa3a00c2f7;p=xonotic%2Fxonotic-data.pk3dir.git Bot AI: if the nearest waypoint of a dynamic goal is inside the goal itself or bot won't reach it in time don't remove it from the path --- diff --git a/qcsrc/server/bot/default/navigation.qc b/qcsrc/server/bot/default/navigation.qc index 8e326fe1b..e28509618 100644 --- a/qcsrc/server/bot/default/navigation.qc +++ b/qcsrc/server/bot/default/navigation.qc @@ -1474,13 +1474,17 @@ bool navigation_routetogoal(entity this, entity e, vector startposition) // 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 + && vdist(vec2(this.goalentity.origin - nearest_wp.origin), >, 16)) { - e = nearest_wp.enemy; + 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))