Update canemine

This commit is contained in:
Dominic Zimmer 2020-07-04 13:59:45 +02:00
parent 2af22cdd07
commit c7110f161c

View File

@ -56,6 +56,14 @@ function digTo(x, z)
end
end
-- If the block in front of the turtle is desired, take it.
function grabOres()
local target = turtle.inspect()
if target and target["name"]:lower():find("ore") then
turtle.dig()
end
end
-- dig all the way down to bedrock, collect ores
-- Parameters:
-- * moveAction: the **vertical** move action, eg turtle.down
@ -87,8 +95,7 @@ function digDeep(moveAction, digAction, inspectAction, limit)
limit = limit - 1
digAction()
moveAction()
-- TODO
-- grabOres() -- inspect block in front of turtle, take if neccessary
grabOres() -- inspect block in front of turtle, take if neccessary
end
end
@ -104,14 +111,14 @@ end
function digShaft()
print("Starting to dig shaft")
depth = digDeep(turtle.down, turtle.digDown, turtle.inspectDown, 3)
depth = digDeep(turtle.down, turtle.digDown, turtle.inspectDown, -1)
print("Dug the first shaft (depth = "..tostring(depth)..")")
turtle.turnLeft()
digDeep(turtle.up, noop, noop, depth - 1)
digDeep(turtle.up, noop, noop, depth)
turtle.turnLeft()
digDeep(turtle.down, noop, noop, depth - 1)
digDeep(turtle.down, noop, noop, depth)
turtle.turnLeft()
digDeep(turtle.up, noop, noop, depth - 1)
digDeep(turtle.up, noop, noop, depth)
turtle.turnLeft()
selectCobble()
turtle.placeDown()