]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix havocbot_checkgoaldistance forcing to find a new goal when bot walks over multipl...
authorterencehill <piuntn@gmail.com>
Thu, 7 Sep 2017 19:40:46 +0000 (21:40 +0200)
committerterencehill <piuntn@gmail.com>
Thu, 7 Sep 2017 22:32:17 +0000 (00:32 +0200)
qcsrc/server/bot/default/havocbot/havocbot.qc
qcsrc/server/bot/default/navigation.qh

index 4891b8d3852b9c35f270236c52e6a15095fcb1b5..0c47f608b04a4258414df82b419ab2c0dba09854 100644 (file)
@@ -430,7 +430,8 @@ void havocbot_bunnyhop(entity this, vector dir)
 bool havocbot_checkgoaldistance(entity this, vector gco)
 {
        float curr_dist = vlen(this.origin - gco);
-       if(curr_dist > this.goalcurrent_distance)
+       float curr_dist_2d = vlen(vec2(this.origin - gco));
+       if(curr_dist > this.goalcurrent_distance && curr_dist_2d > this.goalcurrent_distance_2d)
        {
                if(!this.goalcurrent_distance_time)
                        this.goalcurrent_distance_time = time;
@@ -440,7 +441,8 @@ bool havocbot_checkgoaldistance(entity this, vector gco)
        else
        {
                // reduce it a little bit so it works even with very small approaches to the goal
-               this.goalcurrent_distance = max(20, curr_dist - 15);
+               this.goalcurrent_distance = max(20, curr_dist - 10);
+               this.goalcurrent_distance_2d = max(20, curr_dist_2d - 10);
                this.goalcurrent_distance_time = 0;
        }
        return false;
index ea913456d33eac5db852b53c339a80d95b89350f..c88fd3397b23cfa1fea6a2fd776f4f188321a04e 100644 (file)
@@ -26,6 +26,7 @@ entity navigation_bestgoal;
 
 .entity goalcurrent_prev;
 .float goalcurrent_distance;
+.float goalcurrent_distance_2d;
 .float goalcurrent_distance_time;
 
 .entity nearestwaypoint;