From c37c257618f9d6e4181649a5f76685475a9ea521 Mon Sep 17 00:00:00 2001 From: mand1nga Date: Thu, 18 Aug 2011 16:43:19 -0300 Subject: [PATCH] Experimental: path optimization --- qcsrc/server/bot/navigation.qc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/qcsrc/server/bot/navigation.qc b/qcsrc/server/bot/navigation.qc index 4f680284e..1386d30d9 100644 --- a/qcsrc/server/bot/navigation.qc +++ b/qcsrc/server/bot/navigation.qc @@ -891,6 +891,16 @@ void navigation_poptouchedgoals() } } + // If for some reason the bot is closer to the next goal, pop the current one + if(self.goalstack01) + if(vlen(self.goalcurrent.origin - self.origin) > vlen(self.goalstack01.origin - self.origin)) + if(checkpvs(self.origin + self.view_ofs, self.goalstack01)) + if(tracewalk(self, self.origin, self.mins, self.maxs, (self.goalstack01.absmin + self.goalstack01.absmax) * 0.5, bot_navigation_movemode)) + { + /// dprint("path optimized, removed a goal from the queue\n"); + navigation_poproute(); + } + // Loose goal touching check when running if(self.aistatus & AI_STATUS_RUNNING) if(self.goalcurrent.classname=="waypoint") -- 2.39.2