From ea9bd903ac02048fe298b57387975ae2113421a7 Mon Sep 17 00:00:00 2001 From: Emerson Rosen-Jones Date: Sat, 27 Sep 2025 23:10:55 -0400 Subject: [PATCH] Some tweaks to mine.lua. - Checks for movement success now, tries to ensure movement even if a block falls in front of the turtle. - Fixed the bug for depths of 1 mod 3 leaving a plane of blocks. --- mine.lua | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/mine.lua b/mine.lua index 34fc084..b8c533a 100644 --- a/mine.lua +++ b/mine.lua @@ -30,9 +30,11 @@ function moveInLine (delta) if mode.mine.forward then turtle.dig() end - turtle.forward() - mineSides() - delta = delta - 1 + local success = turtle.forward() + if success then + mineSides() + delta = delta - 1 + end end end @@ -42,15 +44,19 @@ function moveUpDown (delta) if mode.mine.forward then turtle.digUp() end - turtle.up() - delta = delta - 1 + local success = turtle.up() + if success then + delta = delta - 1 + end end while delta < 0 do if mode.mine.forward then turtle.digDown() end - turtle.down() - delta = delta + 1 + local success = turtle.down() + if success then + delta = delta + 1 + end end end @@ -206,6 +212,9 @@ function mine (block) local excess = remaining_h % 3 if excess > 0 then minePlane(block.xoff, block.yoff, (excess - 1) * z_dir) + if excess == 1 then + move(0, 0, -z_dir) + end remaining_h = remaining_h - excess else move(0, 0, z_dir)