diff --git a/dominic/canemine.lua b/dominic/canemine.lua index 8db2ccd..5b01359 100644 --- a/dominic/canemine.lua +++ b/dominic/canemine.lua @@ -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()