From 482bfcb4c23d9d5a49ee511945b0fe0d05c52bbd Mon Sep 17 00:00:00 2001 From: terencehill Date: Tue, 19 Sep 2017 19:26:28 +0200 Subject: [PATCH] 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 --- qcsrc/server/bot/default/navigation.qc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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'; -- 2.39.2