Row switches also break blocks now.

This commit is contained in:
Harrison Deng 2021-05-07 20:07:05 -05:00
parent 3c634fe129
commit 312cb33544

View File

@ -250,6 +250,7 @@ end
local function orient(v, forward, right) local function orient(v, forward, right)
print("Attempting to orient such that " .. tostring(v) .. " == " .. tostring(forward) .. ".") print("Attempting to orient such that " .. tostring(v) .. " == " .. tostring(forward) .. ".")
v = v:normalize()
if vectorEqual(v, forward) then if vectorEqual(v, forward) then
return true return true
elseif vectorEqual(v, right) then elseif vectorEqual(v, right) then
@ -431,10 +432,15 @@ local function quarry(x, y, z, forward, right, pattern)
return return
end end
end end
local bool reverseTrip = false;
for xDelta=1,math.abs(x) do for xDelta=1,math.abs(x) do
for zDelta=1,math.abs(z) do for zDelta=1,math.abs(z) do
local success = true; local success = true;
if (reverseTrip) then
orient(vector.new(0,0,-z), forward, right)
else
orient(vector.new(0, 0, z), forward, right) orient(vector.new(0, 0, z), forward, right)
end
success = success and attemptBreakUp(pattern) success = success and attemptBreakUp(pattern)
success = success and attemptBreakDown(pattern) success = success and attemptBreakDown(pattern)
success = success and attemptBreakFront(pattern) success = success and attemptBreakFront(pattern)
@ -443,7 +449,12 @@ local function quarry(x, y, z, forward, right, pattern)
sendLog(FAILED, "Unable to proceed with quarrying.") sendLog(FAILED, "Unable to proceed with quarrying.")
end end
end end
if not (orient(vector.new(x, 0, 0), forward, right) and attemptBreakFront(pattern) and attemptMoveForward()) then reverseTrip = not reverseTrip
if not (orient(vector.new(x, 0, 0), forward, right) and
attemptBreakFront(pattern) and
attemptBreakUp(pattern) and
attemptBreakDown(pattern) and
attemptMoveForward()) then
sendLog(FAILED, "Unable to move to next row.") sendLog(FAILED, "Unable to move to next row.")
return return
end end