Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- drop slots are 2 and 13-16, fuel slot is 1, torch slots are 3 and 4
- print("Enter desired length of tunnels")
- local branchLength = read()
- print("Is this turtle on the right:r or left:l")
- local turtleSide = read()
- print("How many branches?")
- local branches = read()
- local shaftLength = 1
- local totalLength = shaftLength * 2 + branchLength * 2
- local fuelStuff = 0
- local dig_var = 0
- local exceptions = {2, 13, 14, 15, 16}
- function exceptionDrop()
- for q=5,12 do
- select(q)
- for p=0,4 do
- if turtle.compareTo(exceptions[p]) then
- turtle.drop()
- end
- end
- end
- function diggyDiggy()
- dig_var = dig_var + 1
- turtle.forward()
- if dig_var == 12 then
- exceptionDrop()
- turtle.select(4)
- turtle.back()
- if turtle.compareTo(3) then
- turtle.placeDown()
- else
- turtle.select(3)
- turtle.placeDown()
- end
- dig_var = 0
- turtle.forward()
- end
- exceptionDrop()
- turtle.digUp()
- turtle.digDown()
- turtle.dig()
- end
- function gravel()
- turtle.detect()
- if turtle.detect() == true then
- diggyDiggy()
- gravelception()
- end
- end
- function gravelception()
- turtle.detect()
- if turtle.detect() == true then
- diggyDiggy()
- gravel()
- end
- end
- function re_fuel(m)
- for k=1,16 do
- turtle.select(k)
- turtle.refuel(m)
- end
- end
- function awYiss()
- totalLength = branchLength * 2 + shaftLength * 2
- turtle.getFuelLevel()
- fuelStuff = (totalLength - turtle.getFuelLevel()) / 96
- if fuelStuff < turtle.getItemCount(1) then
- if fuelStuff < 5 then
- if fuelStuff < 4 then
- if fuelStuff < 3 then
- if fuelStuff < 2 then
- if fuelStuff < 1 then
- if fuelStuff < 0 then
- print ("requires no fuel")
- else
- re_fuel(1)
- end
- else
- re_fuel(2)
- end
- else
- re_fuel(3)
- end
- else
- re_fuel(4)
- end
- else
- re_fuel(5)
- end
- turtle.dig()
- for i = 1,shaftLength do
- diggyDiggy()
- turtle.detect()
- if turtle.detect() == true then
- gravelception()
- end
- end
- if turtleSide == "r" then
- turtle.turnRight()
- end
- if turtleSide == "l" then
- turtle.turnLeft()
- end
- turtle.dig()
- for i = 1,branchLength do
- diggyDiggy()
- turtle.detect()
- if turtle.detect() == true then
- gravelception()
- end
- end
- turtle.turnRight()
- turtle.turnRight()
- for i = 1,branchLength do
- turtle.forward()
- end
- if turtleSide == "r" then
- turtle.turnLeft()
- end
- if turtleSide == "l" then
- turtle.turnRight()
- end
- for i = 1,shaftLength do
- turtle.forward()
- end
- shaftLength = shaftLength + 3
- else
- print("I declare the distance I must travel to be far too long!")
- end
- else
- print("not enough fuel to continue")
- end
- end
- for i = 1,branches do
- awYiss()
- if turtleSide == "r" then
- turtle.turnLeft()
- end
- if turtleSide == "l" then
- turtle.turnRight()
- end
- for j=5,12 do
- turtle.select(1)
- if turtle.compareTo(j) ~= true then
- turtle.select(j)
- turtle.drop()
- end
- end
- turtle.select(1)
- if turtleSide == "r" then
- turtle.turnLeft()
- end
- if turtleSide == "l" then
- turtle.turnRight()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement