Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("place a single torch in slot 15 and a stack of torches in slot 16")
- --Length of the 3x3 hall
- print("How long should the Hall be?")
- local hallLength = tonumber(io.read())
- --Length of each tunnel
- print("How long should each side tunnel be?")
- local tunnelLength = tonumber(io.read())
- -- How far apart torches are placed
- local torchSpacing = 6
- function strip()
- if turtle.detect() then
- repeat turtle.dig() until turtle.forward()
- else
- repeat until turtle.forward()
- end
- if turtle.detectDown() then turtle.digDown() end
- while turtle.detectUp() do
- turtle.digUp()
- sleep(0.5)
- end
- end
- function layer()
- strip()
- turtle.turnLeft()
- strip()
- turtle.turnLeft()
- turtle.turnLeft()
- repeat until turtle.forward()
- strip()
- turtle.back()
- turtle.turnLeft()
- end
- function refuel(min)
- if turtle.getFuelLevel()<min then
- print("Refuelling...")
- shell.run("refuel","all")
- end
- if turtle.getFuelLevel()<min then
- print("Not enough fuel to continue")
- return
- end
- end
- function placeTorch()
- turtle.select(16)
- if turtle.compareTo(15) then
- turtle.placeDown()
- end
- end
- function checkTorch(progress)
- if (progress % torchSpacing == 0) and (progress>1) then
- placeTorch()
- end
- end
- function tunnel(length)
- for i=1,length do
- strip()
- checkTorch(i-1)
- end
- end
- function hall(length)
- for i=1,length do
- layer()
- checkTorch(i)
- end
- end
- function minesection()
- local sections = math.floor(hallLength/6)
- for i=1,sections do
- hall(6)
- for i=1,5 do
- repeat until turtle.back()
- end
- turtle.turnLeft()
- repeat until turtle.forward()
- tunnel(tunnelLength)
- turtle.turnRight()
- tunnel(5)
- turtle.back()
- turtle.back()
- placeTorch()
- turtle.turnRight()
- tunnel(tunnelLength)
- for i=1,2 do
- repeat until turtle.forward()
- end
- tunnel(tunnelLength)
- turtle.turnRight()
- tunnel(5)
- turtle.back()
- turtle.back()
- placeTorch()
- turtle.turnRight()
- tunnel(tunnelLength)
- repeat until turtle.forward()
- turtle.turnRight()
- for i=1,5 do
- repeat until turtle.forward()
- end
- end
- end
- minesection()
Advertisement
Add Comment
Please, Sign In to add comment