diff --git a/mineleader.lua b/mineleader.lua index 45d39e6..dbb663a 100644 --- a/mineleader.lua +++ b/mineleader.lua @@ -405,8 +405,26 @@ local function moveTo(dest) end -local function quarry(a, b) +local function quarry(x, y, z, forward, right, pattern) sendLog(QUARRY, "Starting quarry task from positions " .. tostring(a) .. " to " .. tostring(b) ".") + 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) { + attemptMoveUp(); + } elseif (y < 0) { + attemptMoveDown(); + } + end end local function executeTasks() @@ -495,6 +513,11 @@ local function listen() elseif data["request"] == HEADING then determineHeading() elseif data["request"] == QUARRY then + if heading ~= nil then + quarry(data["content"][1], data["content"][2], data["content"][3], heading, rightAxis) + else + quarry(data["content"][1], data["content"][2], data["content"][3], relHeading, relRightAxis) + end end end end