Failed check should come before last pathed check to avoid a failed check taking up a good opportunity to path

This commit is contained in:
ancientmarinerdev 2022-11-03 00:22:05 +00:00
parent 5866983bf5
commit ea9c9e74b0

@ -3458,12 +3458,6 @@ local gopath_last = os.time()
function mcl_mobs:gopath(self,target,callback_arrived) 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 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 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)) mcl_log("We are not ready to path as last fail is less than threshold: " .. (os.time() - self._pf_last_failed))
return 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") mcl_log("We are ready to pathfind, no previous fail or we are past threshold")
end end
if os.time() - gopath_last < 5 then
mcl_log("Not ready to path yet")
return
end
gopath_last = os.time()
self.order = nil self.order = nil
local p = self.object:get_pos() local p = self.object:get_pos()