Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("How many branches?")
- local input = read()
- local output = input-1
- function math()
- local reqfuel = (input*30.4)
- print("Current Fuel is: ",turtle.getFuelLevel())
- print("Required fuel is ",reqfuel)
- print("Proceed? Y/N")
- proceed = read()
- end
- function tunnel()
- for i=1,10 do
- while turtle.detect() do
- turtle.dig()
- end
- turtle.forward()
- turtle.digDown()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.down()
- if turtle.detectDown() == true then
- turtle.up()
- turtle.select(16)
- turtle.placeDown()
- else
- turtle.select(15)
- turtle.placeDown()
- turtle.up()
- turtle.select(16)
- turtle.placeDown()
- end
- for i=1,10 do
- turtle.forward()
- end
- turtle.turnLeft()
- for i=1,3 do
- while turtle.detect() do
- turtle.dig()
- end
- turtle.forward()
- turtle.digDown()
- end
- turtle.turnLeft()
- end
- function refuel()
- for i=1,13 do
- turtle.select(i)
- turtle.refuel()
- end
- end
- function home()
- turtle.turnLeft()
- local bal = 1
- for i=1,input do
- turtle.down()
- if turtle.detectDown() == true then
- turtle.up()
- turtle.select(16)
- if bal == 1 then
- turtle.placeDown()
- bal = 2
- elseif bal == 2 then
- bal = 3
- else
- bal = 1
- end
- else
- turtle.select(15)
- turtle.placeDown()
- turtle.up()
- turtle.select(16)
- if bal == 1 then
- turtle.placeDown()
- bal = 2
- elseif bal == 2 then
- bal = 3
- else
- bal =1
- end
- end
- turtle.forward()
- turtle.forward()
- turtle.forward()
- end
- turtle.turnLeft()
- turtle.forward()
- turtle.select(14)
- turtle.placeDown()
- for i=1,13 do
- turtle.select(i)
- turtle.dropDown()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.forward()
- turtle.down()
- end
- math()
- if proceed == "Y" then
- turtle.up()
- for i=1,input do
- tunnel()
- end
- home()
- else
- refuel()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement