Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --3x3 tunnel maker With TurtleOS 1.8
- --based on Luke Ryszard script
- --[[
- ITEMS IN GUI!
- [ ][ ][ ][ ]
- [ ][ ][ ][ ]
- [ ][ ][ ][ ]
- [ ][ ][15][16]
- 15 - fuel spot
- 16 - torch spot
- ]]
- function RMine()
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- turtle.digDown()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.forward()
- turtle.digDown()
- turtle.turnRight()
- end -- end RMine()
- function LMine()
- turtle.turnLeft()
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- turtle.digDown()
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- turtle.digDown()
- turtle.turnLeft()
- end -- end LMine()
- function checkFuel()
- if turtle.getFuelLevel() <= 10 then
- turtle.select(15)
- turtle.refuel(1)
- turtle.select(1)
- end --if
- end --checkFuel()
- -- Create the turnAround function
- function turnAround()
- turtle.turnRight()
- turtle.turnRight()
- end --turnAround()
- -- Digs the tunnel for the given length
- function tunnel(givenLength)
- local distance = 0
- turtle.up()
- for index = 1,givenLength do
- turtle.dig()
- if turtle.forward() then
- distance = distance + 1
- end --if
- turtle.digUp()
- turtle.select(1)
- turtle.placeDown()
- LMine()
- RMine()
- -- Places a torch every 10 blocks
- if distance == 10 then
- turtle.select(16)
- print("Placing torch...")
- turnAround()
- turtle.place()
- turnAround()
- distance = 0
- checkFuel()
- end --if
- end --for
- -- Sends the turtle back to the start
- turtle.up()
- for index = 1,givenLength do
- turtle.back()
- end --for
- turtle.down()
- end --tunnel()
- -- Main script
- print("Input tunnel length:")
- local length = read()
- print("starting excavation...")
- checkFuel()
- tunnel(length)
- print("The tunnel has been excavated!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement