Progress on quarrying.

This commit is contained in:
Harrison Deng 2021-05-07 19:40:57 -05:00
parent 433203f490
commit fbb04299bb

View File

@ -412,22 +412,35 @@ local function quarry(x, y, z, forward, right, pattern)
z = tonumber(z) z = tonumber(z)
sendLog(QUARRY, "Starting quarry of (x length,depth,z length): " .. x .. "," .. y .. "," .. z .. " with a not pattern of: " .. pattern) sendLog(QUARRY, "Starting quarry of (x length,depth,z length): " .. x .. "," .. y .. "," .. z .. " with a not pattern of: " .. pattern)
for yDelta=1,math.abs(y) do for yDelta=1,math.abs(y) do
for xDelta=1,math.abs(x) do
for zDelta=1,math.abs(z) do
orient(vector.new(0, 0, z), forward, right)
attemptBreakUp(pattern)
attemptBreakDown(pattern)
attemptBreakFront(pattern)
attemptMoveForward()
end
orient(vector.new(x, 0, 0), forward, right)
attemptMoveForward()
end
if (y > 0) then if (y > 0) then
attemptMoveUp(); if not attemptBreakUp(pattern) then
sendLog(FAILED, "Unable to break up.")
return
end
if not attemptMoveUp() then
sendLog(FAILED, "Unable to move up.")
return
end
else else
if not attemptMoveDown() then if not attemptMoveDown() then
sendLog(FAILED, "Unable to move further down for quarrying.") sendLog(FAILED, "Unable to move further down for quarrying.")
return
end
end
for xDelta=1,math.abs(x) do
for zDelta=1,math.abs(z) do
local success = true;
orient(vector.new(0, 0, z), forward, right)
success = success && attemptBreakUp(pattern)
success = success && attemptBreakDown(pattern)
success = success && attemptBreakFront(pattern)
success = success && attemptMoveForward(pattern)
if not success then
sendLog(FAILED, "Unable to proceed with quarrying.")
end
end
if not (orient(vector.new(x, 0, 0), forward, right) and attemptMoveForward()) then
sendLog(FAILED, "Unable to move to next row.")
end end
end end
end end