Attempt at fixing move to.
This commit is contained in:
parent
04904d0935
commit
096de7f8e3
@ -396,12 +396,12 @@ local function moveTo(dest, relative)
|
||||
while not vectorEqual(dest, position) do
|
||||
local pos
|
||||
if relative then
|
||||
pos = position
|
||||
else
|
||||
pos = relativePos
|
||||
else
|
||||
pos = position
|
||||
end
|
||||
if oldPos ~= nil and vectorEqual(oldPos, pos) then
|
||||
sendLog(FAILED, "Cannot proceed to due obstacle. XYZ being blocked: " .. tostring(xBlocked) .. "," .. tostring(yBlocked) .. "," .. tostring(zBlocked))
|
||||
sendLog(FAILED, "Cannot proceed due to obstacle. XYZ being blocked: " .. tostring(xBlocked) .. "," .. tostring(yBlocked) .. "," .. tostring(zBlocked))
|
||||
break
|
||||
end
|
||||
oldPos = vector.new(pos.x, pos.y, pos.z);
|
||||
@ -410,13 +410,13 @@ local function moveTo(dest, relative)
|
||||
sendLog(FAILED, "Unable to orient for X axis.")
|
||||
return
|
||||
end
|
||||
xblocked = attemptMoveForward()
|
||||
xblocked = not attemptMoveForward()
|
||||
end
|
||||
if position.y ~= dest.y then
|
||||
if dest.y - pos.y > 0 then
|
||||
yBlocked = attemptMoveUp()
|
||||
yBlocked = not attemptMoveUp()
|
||||
else
|
||||
yBlocked = attemptMoveDown()
|
||||
yBlocked = not attemptMoveDown()
|
||||
end
|
||||
end
|
||||
if pos.z ~= dest.z then
|
||||
@ -424,7 +424,7 @@ local function moveTo(dest, relative)
|
||||
sendLog(FAILED, "Unable to orient for Z axis.")
|
||||
return
|
||||
end
|
||||
zBlocked = attemptMoveForward()
|
||||
zBlocked = not attemptMoveForward()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user