Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.clear()
- term.setCursorPos(1,1)
- term.write("Branch depth: ")
- local length = io.read()
- term.setCursorPos(1,2)
- term.write("Number of branches: ")
- local number = io.read()
- term.clear()
- function forward()
- term.clear()
- term.setCursorPos(1,1)
- print("Branch Mining...")
- if turtle.getItemCount(13) > 0 or turtle.getItemCount(14) > 0 then
- unload()
- end
- while not turtle.forward() do
- if not turtle.dig() then
- sleep(1)
- end
- end
- end
- function back()
- while not turtle.back() do
- sleep(1)
- end
- end
- function left()
- turtle.turnLeft()
- end
- function right()
- turtle.turnRight()
- end
- function dig()
- turtle.digDown()
- while turtle.detectUp() do
- turtle.digUp()
- sleep(0.8)
- end
- end
- function placeTorch()
- for i=1,14 do
- turtle.select(i)
- if turtle.compareTo(15) then
- turtle.placeDown()
- return
- end
- end
- end
- function unload()
- turtle.select(16)
- turtle.digUp()
- turtle.placeUp()
- for i=1,14 do
- turtle.select(i)
- if not turtle.compareTo(15) then
- turtle.dropUp(turtle.getItemCount(i))
- end
- end
- turtle.select(1)
- end
- function digLine()
- for i=1,4 do
- forward()
- dig()
- end
- back()
- back()
- left()
- placeTorch()
- for i=1,length do
- if i % 5 == 0 then
- placeTorch()
- end
- forward()
- dig()
- end
- right()
- placeTorch()
- for i=1,3 do
- forward()
- dig()
- end
- right()
- placeTorch()
- for i=1,length*2 do
- if i % 5 == 0 then
- placeTorch()
- end
- forward()
- dig()
- end
- right()
- placeTorch()
- for i=1,3 do
- forward()
- dig()
- end
- right()
- placeTorch()
- for i=1,length do
- if i % 5 == 0 then
- placeTorch()
- end
- forward()
- dig()
- end
- right()
- for i=1,4 do
- if i==3 then
- placeTorch()
- end
- forward()
- dig()
- end
- end
- for i=1,number do
- digLine()
- end
Advertisement
Add Comment
Please, Sign In to add comment