Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Author
- Rasmus Sommer mod by me
- How to use:
- Slot 1 - Fuel
- Slot 2 - Bridge material
- Slot 3 - Torches
- torchedtunnel <length>
- --]]
- local tArgs = { ... }
- if #tArgs ~= 1 then
- print( "Usage: torchedtunnel <length>" )
- return
- end
- local length = tonumber( tArgs[1] )
- if length < 1 then
- print( "Tunnel length must be positive" )
- return
- end
- local function tryRefuel()
- if turtle.getFuelLevel() == 0 then
- turtle.select(1)
- turtle.refuel(1)
- end
- end
- local function tryDig()
- while turtle.detect() == true do
- turtle.dig()
- sleep(0.5)
- end
- end
- local function tryDigUp()
- while turtle.detectUp() == true do
- turtle.digUp()
- sleep(0.5)
- end
- end
- local function tryUp()
- tryDigUp()
- tryRefuel()
- turtle.up()
- end
- local function tryDown()
- while turtle.detectDown() == true do
- turtle.digDown()
- sleep(0.5)
- end
- tryRefuel()
- turtle.down()
- end
- local function tryForward()
- tryDig()
- tryRefuel()
- turtle.forward()
- end
- local function tryBackward()
- tryRefuel()
- turtle.back()
- end
- local function makeBridge()
- if turtle.detectDown() == false then
- turtle.select(2)
- turtle.placeDown()
- turtle.turnLeft()
- if turtle.detect() == false then
- turtle.place()
- end
- turtle.turnRight()
- turtle.turnRight()
- if turtle.detect() == false then
- turtle.place()
- end
- turtle.turnLeft()
- end
- end
- local count = 1
- while true do
- tryForward()
- makeBridge()
- tryDigUp()
- if count % 8 == 0 then
- turtle.select(3)
- turtle.placeUp()
- end
- count = count + 1
- end
- for i = 1, length do
- tryBackward()
- end
- for i = 4, 16 do
- turtle.select(i)
- turtle.dropDown()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement