Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Retrieve variables/Instantiate Values
- local args = {...}
- --First argument = how long tunnel is
- local dist = tonumber(args[1])
- --Second argument = What direction the tunnels go
- local direct = tostring(args[2])
- --Mines out blocks in front and above (for Gravel or Sand) [Moves forward when clear]
- local function mineTunnel()
- if turtle.detect() then
- turtle.dig()
- end
- if turtle.detectUp() then
- turtle.digUp()
- end
- while not turtle.forward() do
- turtle.dig()
- turtle.digUp()
- end
- end
- --Digs a tunnel given distance args[0] (requires args[0])
- local function tunnel()
- for i=1,dist,1 do
- mineTunnel()
- end
- if direct == "left" then
- turtle.turnLeft()
- mineTunnel()
- turtle.turnLeft()
- end
- if direct == "right" then
- turtle.turnRight()
- mineTunnel()
- turtle.turnRight()
- end
- for i=1,dist,1 do
- mineTunnel()
- end
- end
- --Executes until told to stop
- while true do
- tunnel()
- turtle.select(1)
- turtle.dig()
- turtle.place()
- for slot=2,16,1 do
- turtle.select(slot)
- while turtle.getItemCount(slot) > 0 do
- turtle.drop()
- end
- end
- if direct == "left" then
- turtle.turnRight()
- end
- if direct == "right" then
- turtle.turnLeft()
- end
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- if direct == "left" then
- turtle.turnRight()
- end
- if direct == "right" then
- turtle.turnLeft()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment