Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Args = {...}
- function digfor()
- while turtle.detect() do
- turtle.dig()
- os.sleep(0.5)
- end
- turtle.forward()
- end
- function digup()
- while turtle.detectUp() do
- turtle.digUp()
- os.sleep(0.5)
- end
- end
- function torch()
- turtle.turnRight()
- turtle.turnRight()
- turtle.select(2)
- turtle.place()
- turtle.turnRight()
- turtle.turnRight()
- end
- function checkdown()
- if turtle.detectDown() == false then
- turtle.select(3)
- turtle.placeDown()
- end
- end
- function checkfuel()
- fuel = turtle.getFuelLevel()
- if fuel <= 20 then
- turtle.select(1)
- turtle.refuel(1)
- end
- end
- if #Args ~= 1 then
- print("Usage: branch <num>")
- n = 0
- else
- print("Branching "..Args[1].." blocks forward.")
- print("Fuel: slot 1, torch: slot 2, cobble: slot 3.")
- turtle.select(1)
- for i=1,Args[1] do
- checkfuel()
- n = n + 1
- digfor()
- digup()
- checkdown()
- if n == 7 then
- torch()
- n = 0
- end
- end
- turtle.up()
- for i=1,Args[1] do
- checkfuel()
- turtle.back()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment