From: terencehill Date: Mon, 11 Dec 2017 23:16:34 +0000 (+0100) Subject: Remove nearest waypoint of dynamic goals very close to them without further tests... X-Git-Tag: xonotic-v0.8.5~2378^2~9 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=328cf4c1e72b924f6f065ac33c6d8313ef7b621b;p=xonotic%2Fxonotic-data.pk3dir.git Remove nearest waypoint of dynamic goals very close to them without further tests (e.g. CTF flag on its own base) --- diff --git a/qcsrc/server/bot/default/navigation.qc b/qcsrc/server/bot/default/navigation.qc index 9b9d47c9c..c7c3c553c 100644 --- a/qcsrc/server/bot/default/navigation.qc +++ b/qcsrc/server/bot/default/navigation.qc @@ -1474,16 +1474,20 @@ 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) { - if (nearest_wp.enemy.wpcost < autocvar_bot_ai_strategyinterval_movingtarget - && vdist(vec2(this.goalentity.origin - nearest_wp.origin), >, 16)) + if (nearest_wp.enemy.wpcost < autocvar_bot_ai_strategyinterval_movingtarget) { - 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 (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; + } } } }