]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Bot AI: detect if bot is ahead of current goal and remove it; it fixes bots sometimes...
authorterencehill <piuntn@gmail.com>
Tue, 19 Sep 2017 17:26:28 +0000 (19:26 +0200)
committerterencehill <piuntn@gmail.com>
Tue, 19 Sep 2017 17:26:28 +0000 (19:26 +0200)
qcsrc/server/bot/default/navigation.qc

index b21670a06357527f6a44d9ccb4d0bdd62695ec89..576c9d62c74bed4d80303ce0526060ee73f2fd8d 100644 (file)
@@ -1362,7 +1362,8 @@ int navigation_poptouchedgoals(entity this)
 
        // If for some reason the bot is closer to the next goal, pop the current one
        if(this.goalstack01 && !wasfreed(this.goalstack01))
-       if(vlen2(this.goalcurrent.origin - this.origin) > vlen2(this.goalstack01.origin - this.origin))
+       if(vlen2(this.goalcurrent.origin - this.origin) > vlen2(this.goalstack01.origin - this.origin)
+               || vlen2(this.goalcurrent.origin - this.goalstack01.origin) > vlen2(this.goalstack01.origin - this.origin))
        if(checkpvs(this.origin + this.view_ofs, this.goalstack01))
        {
                vector dest = '0 0 0';