]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Check distance of the goal from the previous waypoint but 2 before removing nearest...
authorterencehill <piuntn@gmail.com>
Wed, 15 Nov 2017 23:44:13 +0000 (00:44 +0100)
committerterencehill <piuntn@gmail.com>
Wed, 15 Nov 2017 23:44:13 +0000 (00:44 +0100)
qcsrc/server/bot/default/navigation.qc

index 71666aacd2d72d85cf1df798060ab85f00d8ad5c..a0295a7ae34cf861308eca181018207640d6555e 100644 (file)
@@ -1474,6 +1474,7 @@ bool navigation_routetogoal(entity this, entity e, vector startposition)
                {
                        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)))
                        {