From: terencehill Date: Tue, 19 Sep 2017 17:26:28 +0000 (+0200) Subject: Bot AI: detect if bot is ahead of current goal and remove it; it fixes bots sometimes... X-Git-Tag: xonotic-v0.8.5~2378^2~56 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=482bfcb4c23d9d5a49ee511945b0fe0d05c52bbd;p=xonotic%2Fxonotic-data.pk3dir.git Bot AI: detect if bot is ahead of current goal and remove it; it fixes bots sometimes going back to touch the nearest waypoint when they recalculate path --- diff --git a/qcsrc/server/bot/default/navigation.qc b/qcsrc/server/bot/default/navigation.qc index b21670a06..576c9d62c 100644 --- a/qcsrc/server/bot/default/navigation.qc +++ b/qcsrc/server/bot/default/navigation.qc @@ -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';