Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Variables
- turtle.select(1)
- local tArgs = { ... }
- local togo = tonumber(tArgs[1])
- togo = togo or 1
- print("Branching")
- -- Functions
- function getFuel(amount)
- if turtle.getFuelLevel() < 5 then
- turtle.select(16)
- turtle.refuel(amount)
- turtle.select(1)
- end
- end
- function goBack()
- turtle.turnRight()
- turtle.turnRight()
- end
- function mine()
- if turtle.detectUp() then
- turtle.digUp()
- end
- turtle.up()
- if turtle.detectUp() == false then
- turtle.select(2)
- turtle.placeUp()
- turtle.select(1)
- end
- turtle.turnRight()
- if turtle.detect() == false then
- turtle.select(2)
- turtle.place()
- turtle.select(1)
- end
- turtle.turnLeft()
- turtle.turnLeft()
- if turtle.detect() == false then
- turtle.select(2)
- turtle.place()
- turtle.select(1)
- end
- turtle.turnRight()
- turtle.down()
- if turtle.detectDown() then
- turtle.digDown()
- end
- turtle.down()
- if turtle.detectDown() == false then
- turtle.select(2)
- turtle.placeDown()
- turtle.select(1)
- end
- turtle.turnRight()
- if turtle.detect() == false then
- turtle.select(2)
- turtle.place()
- turtle.select(1)
- end
- turtle.turnLeft()
- turtle.turnLeft()
- if turtle.detect() == false then
- turtle.select(2)
- turtle.place()
- turtle.select(1)
- end
- turtle.turnLeft()
- turtle.up()
- end
- -- Branching
- for i = 1, togo do
- getFuel(1)
- if turtle.detect() then
- repeat
- turtle.dig()
- sleep(0.25)
- until turtle.detect() == false
- turtle.forward()
- mine()
- else
- turtle.forward()
- mine()
- end
- if togo >= 10 then
- if (i % 10 == 0) then
- turtle.placeDown()
- end
- end
- end
- -- Go Back
- goBack()
- for r = 1, togo do
- getFuel(1)
- turtle.forward()
- end
Advertisement
Add Comment
Please, Sign In to add comment