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.
This commit is contained in:
parent
efda5103c0
commit
ea9bd903ac
1 changed files with 16 additions and 7 deletions
15
mine.lua
15
mine.lua
|
|
@ -30,10 +30,12 @@ function moveInLine (delta)
|
||||||
if mode.mine.forward then
|
if mode.mine.forward then
|
||||||
turtle.dig()
|
turtle.dig()
|
||||||
end
|
end
|
||||||
turtle.forward()
|
local success = turtle.forward()
|
||||||
|
if success then
|
||||||
mineSides()
|
mineSides()
|
||||||
delta = delta - 1
|
delta = delta - 1
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function moveUpDown (delta)
|
function moveUpDown (delta)
|
||||||
|
|
@ -42,16 +44,20 @@ function moveUpDown (delta)
|
||||||
if mode.mine.forward then
|
if mode.mine.forward then
|
||||||
turtle.digUp()
|
turtle.digUp()
|
||||||
end
|
end
|
||||||
turtle.up()
|
local success = turtle.up()
|
||||||
|
if success then
|
||||||
delta = delta - 1
|
delta = delta - 1
|
||||||
end
|
end
|
||||||
|
end
|
||||||
while delta < 0 do
|
while delta < 0 do
|
||||||
if mode.mine.forward then
|
if mode.mine.forward then
|
||||||
turtle.digDown()
|
turtle.digDown()
|
||||||
end
|
end
|
||||||
turtle.down()
|
local success = turtle.down()
|
||||||
|
if success then
|
||||||
delta = delta + 1
|
delta = delta + 1
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function turnToFace (new_direction)
|
function turnToFace (new_direction)
|
||||||
|
|
@ -206,6 +212,9 @@ function mine (block)
|
||||||
local excess = remaining_h % 3
|
local excess = remaining_h % 3
|
||||||
if excess > 0 then
|
if excess > 0 then
|
||||||
minePlane(block.xoff, block.yoff, (excess - 1) * z_dir)
|
minePlane(block.xoff, block.yoff, (excess - 1) * z_dir)
|
||||||
|
if excess == 1 then
|
||||||
|
move(0, 0, -z_dir)
|
||||||
|
end
|
||||||
remaining_h = remaining_h - excess
|
remaining_h = remaining_h - excess
|
||||||
else
|
else
|
||||||
move(0, 0, z_dir)
|
move(0, 0, z_dir)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue