Now stops on failure to "moveby".
This commit is contained in:
parent
bcf30e259d
commit
6f94e81ca1
@ -332,25 +332,37 @@ local function moveBy(delta, forward, right)
|
|||||||
sendLog(MOVEBY, "Moving on x axis by: " .. delta.x)
|
sendLog(MOVEBY, "Moving on x axis by: " .. delta.x)
|
||||||
orient(vector.new(delta.x, 0, 0):normalize(), forward, right)
|
orient(vector.new(delta.x, 0, 0):normalize(), forward, right)
|
||||||
for x=1,math.abs(delta.x) do
|
for x=1,math.abs(delta.x) do
|
||||||
attemptMoveForward()
|
if not attemptMoveForward() then
|
||||||
|
sendLog(FAILED, "Unable to move forward.")
|
||||||
|
return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if delta.z ~= 0 then
|
if delta.z ~= 0 then
|
||||||
sendLog(MOVEBY, "Moving on z axis by: " .. delta.z)
|
sendLog(MOVEBY, "Moving on z axis by: " .. delta.z)
|
||||||
orient(vector.new(0, 0, delta.z):normalize(), forward, right)
|
orient(vector.new(0, 0, delta.z):normalize(), forward, right)
|
||||||
for z=1,math.abs(delta.z) do
|
for z=1,math.abs(delta.z) do
|
||||||
attemptMoveForward()
|
if not attemptMoveForward() then
|
||||||
|
sendLog(FAILED, "Unable to move forward.")
|
||||||
|
return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if delta.y > 0 then
|
if delta.y > 0 then
|
||||||
sendLog(MOVEBY, "Moving on y axis by: " .. delta.y)
|
sendLog(MOVEBY, "Moving on y axis by: " .. delta.y)
|
||||||
for y=1,delta.y do
|
for y=1,delta.y do
|
||||||
attemptMoveUp()
|
if not attemptMoveUp() then
|
||||||
|
sendLog(FAILED, "Unable to move up.")
|
||||||
|
return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
elseif delta.y < 0 then
|
elseif delta.y < 0 then
|
||||||
sendLog(MOVEBY, "Moving on y axis by: " .. delta.y)
|
sendLog(MOVEBY, "Moving on y axis by: " .. delta.y)
|
||||||
for y=1,math.abs(delta.y) do
|
for y=1,math.abs(delta.y) do
|
||||||
attemptMoveDown()
|
if not attemptMoveDown() then
|
||||||
|
sendLog(FAILED, "Unable to move down.")
|
||||||
|
return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user