From ea9c9e74b09040e5650a6abd939e9ffe5dd1e469 Mon Sep 17 00:00:00 2001 From: ancientmarinerdev Date: Thu, 3 Nov 2022 00:22:05 +0000 Subject: [PATCH] Failed check should come before last pathed check to avoid a failed check taking up a good opportunity to path --- mods/ENTITIES/mcl_mobs/api.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 7591b0af8..4687a6b0b 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -3458,12 +3458,6 @@ local gopath_last = os.time() function mcl_mobs:gopath(self,target,callback_arrived) if self.state == PATHFINDING then mcl_log("Already pathfinding, don't set another until done.") return end - if os.time() - gopath_last < 5 then - mcl_log("Not ready to path yet") - return - end - gopath_last = os.time() - if self._pf_last_failed and (os.time() - self._pf_last_failed) < 60 then mcl_log("We are not ready to path as last fail is less than threshold: " .. (os.time() - self._pf_last_failed)) return @@ -3471,6 +3465,12 @@ function mcl_mobs:gopath(self,target,callback_arrived) mcl_log("We are ready to pathfind, no previous fail or we are past threshold") end + if os.time() - gopath_last < 5 then + mcl_log("Not ready to path yet") + return + end + gopath_last = os.time() + self.order = nil local p = self.object:get_pos()