Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Strip mining turtle program.
- -- Luke *********, Ryszard ********. 13/12/12
- --[[fuel must be placed in slot 15,
- torches must be placed in slot 16.]]
- -- Create the function for refueling
- 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
- for index = 1,givenLength do
- turtle.dig()
- if turtle.forward() then
- distance = distance + 1
- end --if
- turtle.digUp()
- turtle.select(1)
- turtle.placeDown()
- -- Places a torch every 11 blocks
- if distance == 11 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