From 312cb33544a4113ff9d50f01c12dba89cabf81af Mon Sep 17 00:00:00 2001 From: Harrison Deng Date: Fri, 7 May 2021 20:07:05 -0500 Subject: [PATCH] Row switches also break blocks now. --- mineleader.lua | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/mineleader.lua b/mineleader.lua index 535dbb1..f8d8856 100644 --- a/mineleader.lua +++ b/mineleader.lua @@ -250,6 +250,7 @@ end local function orient(v, forward, right) print("Attempting to orient such that " .. tostring(v) .. " == " .. tostring(forward) .. ".") + v = v:normalize() if vectorEqual(v, forward) then return true elseif vectorEqual(v, right) then @@ -431,10 +432,15 @@ local function quarry(x, y, z, forward, right, pattern) return end end + local bool reverseTrip = false; 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) + if (reverseTrip) then + orient(vector.new(0,0,-z), forward, right) + else + orient(vector.new(0, 0, z), forward, right) + end success = success and attemptBreakUp(pattern) success = success and attemptBreakDown(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.") 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.") return end