Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function refuel()
- if turtle.getFuelLevel() < 1000 then
- turtle.select(2)
- turtle.refuel(10)
- end
- end
- function torch()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.select(1)
- if turtle.getItemCount(1) > 1 then turtle.place() end
- turtle.turnLeft()
- turtle.turnLeft()
- end
- function tunnel(l)
- local light = 0
- for i=1, l do
- refuel()
- while turtle.detect() do turtle.dig() end
- turtle.forward()
- if i == 1 then torch() end
- light = (light + 1)
- if light >= 13 then torch() light = 0 end
- while turtle.detectUp() do turtle.digUp() end
- turtle.select(3)
- turtle.placeDown()
- end
- end
- function turn(direction)
- if direction then turtle.turnLeft() end
- if not direction then turtle.turnRight() end
- tunnel(4)
- if direction then turtle.turnLeft() end
- if not direction then turtle.turnRight() end
- end
- function restock()
- turtle.dig()
- turtle.select(4)
- turtle.place()
- turtle.select(5)
- turtle.placeUp()
- for i=5, 16 do turtle.select(i) turtle.drop() end
- turtle.select(1)
- turtle.suckUp(turtle.getItemSpace(1))
- turtle.select(4)
- turtle.dig()
- turtle.select(5)
- turtle.digUp()
- turtle.select(1)
- turtle.place()
- end
- args = {...}
- local length = args[1]
- if length == nil then print("Error Invalid Argument. ex: Dig (length) [left:right] [width] [r]") error() end
- local d = args[2]
- local direct = false
- if d == "left" then direct = true end
- local rows = args[3]
- if rows == nil then rows = 1 end
- local dump = args[4]
- print(" Please add:")
- print("torches to Slot 1")
- print("fuel to slot 2")
- print("cobble to slot 3")
- if dump == "r" then print("Drop off chest to slot 4 and optionally a chest of torches to slot 5") end
- print("Press enter to continue.")
- read("*")
- term.clear()
- term.setCursorPos(1,1)
- while true do
- for i=1, rows do
- tunnel(length)
- turn(direct)
- direct = not direct
- tunnel(length)
- if dump == "r" then restock() end
- turn(direct)
- direct = not direct
- end
- print("Press enter to continue.")
- read("*")
- term.clear()
- term.setCursorPos(1,1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement