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
|
while not vectorEqual(dest, position) do
|
||||||
local pos
|
local pos
|
||||||
if relative then
|
if relative then
|
||||||
pos = position
|
|
||||||
else
|
|
||||||
pos = relativePos
|
pos = relativePos
|
||||||
|
else
|
||||||
|
pos = position
|
||||||
end
|
end
|
||||||
if oldPos ~= nil and vectorEqual(oldPos, pos) then
|
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
|
break
|
||||||
end
|
end
|
||||||
oldPos = vector.new(pos.x, pos.y, pos.z);
|
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.")
|
sendLog(FAILED, "Unable to orient for X axis.")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
xblocked = attemptMoveForward()
|
xblocked = not attemptMoveForward()
|
||||||
end
|
end
|
||||||
if position.y ~= dest.y then
|
if position.y ~= dest.y then
|
||||||
if dest.y - pos.y > 0 then
|
if dest.y - pos.y > 0 then
|
||||||
yBlocked = attemptMoveUp()
|
yBlocked = not attemptMoveUp()
|
||||||
else
|
else
|
||||||
yBlocked = attemptMoveDown()
|
yBlocked = not attemptMoveDown()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if pos.z ~= dest.z then
|
if pos.z ~= dest.z then
|
||||||
@ -424,7 +424,7 @@ local function moveTo(dest, relative)
|
|||||||
sendLog(FAILED, "Unable to orient for Z axis.")
|
sendLog(FAILED, "Unable to orient for Z axis.")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
zBlocked = attemptMoveForward()
|
zBlocked = not attemptMoveForward()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user