Skip to content
Snippets Groups Projects
Commit 38dc7746 authored by DarkGod's avatar DarkGod
Browse files

fix

parent 43faff1e
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -190,7 +190,7 @@ function _M:aiSeeTargetPos(target)
if LSeen.GCache_x then -- update guess with new random position. Could use util.findFreeGrid here at cost of speed
tx = math.floor(LSeen.GCache_x + (tx-LSeen.GCache_x)/2)
ty = math.floor(LSeen.GCache_y + (ty-LSeen.GCache_y)/2)
if not target:canMove(tx, ty, true) or (tx == self.x and ty == self.y) then -- find a reasonable spot if target can't be at that position
if (target.canMove and not target:canMove(tx, ty, true)) or (tx == self.x and ty == self.y) then -- find a reasonable spot if target can't be at that position
local nx, ny = util.findFreeGrid(tx, ty, math.max(1, spread), false)
if nx then tx, ty = nx, ny end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment