Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Original Author
- Rasmus Sommer aka. TheSommer
- youtube.com/thesommersmc
- twitch.tv/thesommer
- Edited by Mjmac85
- How to use:
- Slot 1 - Fuel
- Slot 2 - Bridge material
- Slot 3 - Torches
- Edit:Place chest directly behind the turtle at the start point.
- 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 makeBridge()
- if turtle.detectDown() == false then
- turtle.select(2)
- turtle.placeDown()
- end
- end
- local count = 1
- --Emptys inventory into a chest
- local function dropItems()
- local invCount = 4
- for invCount = 4, 16 do
- turtle.select(invCount)
- turtle.drop()
- end
- turtle.select(4)
- end
- --Turns the turtle around calls dropItems and goes back to mining
- local function returnTrip(count)
- turtle.turnRight()
- turtle.turnRight()
- for moveCount = 1, count - 1 do
- tryForward()
- end
- turtle.turnLeft()
- dropItems()
- turtle.turnLeft()
- for moveCount = 1, count - 1 do
- tryForward()
- end
- end
- for i = 1, length do
- --Checks item count and drops if full
- if turtle.getItemCount(16) > 0 then
- returnTrip(count)
- end
- tryForward()
- count = count + 1
- makeBridge()
- tryDigUp()
- turtle.turnLeft()
- tryDig()
- tryUp()
- tryDig()
- --Torches taken out
- --if count % 8 == 0 then
- --turtle.select(3)
- --turtle.place()
- --end
- turtle.turnRight()
- turtle.turnRight()
- tryDig()
- tryDown()
- tryDig()
- turtle.turnLeft()
- end
- --Takes the turtle back to start point, drops items, and faces forward to start again
- turtle.turnRight()
- turtle.turnRight()
- for i = 1, count - 1 do
- tryForward()
- end
- turtle.turnLeft()
- dropItems()
- turtle.turnLeft()
- print("Finished boss!")
Advertisement
Add Comment
Please, Sign In to add comment