diff --git a/mineleader.lua b/mineleader.lua index a2677d1..24683a5 100644 --- a/mineleader.lua +++ b/mineleader.lua @@ -412,22 +412,35 @@ local function quarry(x, y, z, forward, right, pattern) z = tonumber(z) 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 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 - 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 if not attemptMoveDown() then 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