Basic quarrying implemented and untested.

This commit is contained in:
Harrison Deng 2021-05-07 17:02:49 -05:00
parent 5e95f20889
commit 8a21ae4d77

View File

@ -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