Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function fuel()
- if turtle.getFuelLevel() < 10 then
- for n=1,16 do
- if turtle.getItemCount(n) > 0 then
- turtle.select(n)
- if turtle.refuel(1) then
- turtle.select(1)
- end
- end
- end
- turtle.select(1)
- else
- print("Fuel: "..turtle.getFuelLevel().." ")
- end
- end
- function turn()
- turtle.turnRight()
- turtle.turnRight()
- end
- function tunnel()
- turtle.dig()
- sleep(0.5)
- turtle.forward()
- distance = distance + 1
- turtle.digUp()
- turtle.select(1)
- turtle.placeDown()
- turtle.turnRight()
- turtle.detect()
- turtle.place()
- turn()
- turtle.detect()
- turtle.place()
- turtle.turnRight()
- if distance == 9 then
- turtle.select(16)
- print("Placing Torch...")
- turn()
- turtle.place()
- turn()
- distance = 0
- end
- end
- function back()
- turtle.up()
- turn()
- for j = 1,length do
- turtle.forward()
- -- if turtle.forward() == false then
- turtle.dig()
- turtle.attack()
- -- end
- end
- turtle.down()
- turn()
- end
- write("Tunnel length: ")
- length = read()
- print("Starting...")
- fuel()
- distance = 0
- i = 1
- while i < length do
- tunnel()
- end
- back()
- print("Done...")
Advertisement
Add Comment
Please, Sign In to add comment