Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Strip mining turtle program.
- -- Luke *********, Ryszard ********. 13/12/12
- -- updated by AzrylAero 5/3/2013
- -- modified for 2 wide by krakaen 14/11/20
- --[[fuel must be placed in slot 14,
- mainshaft torches must be placed in slot 15
- tunnel torches must be placed in slot 16.]]
- -- Create the function for refueling
- function checkFuel()
- if turtle.getFuelLevel() <= 10 then
- turtle.select(14)
- turtle.refuel(1)
- turtle.select(1)
- end --if
- end --checkFuel()
- -- Create the turnAround function
- function turnAround()
- turtle.turnRight()
- turtle.turnRight()
- end --turnAround()
- -- Go to the next tunnel
- function digNext(torchCounter)
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- turtle.turnLeft()
- print("turn Right")
- print("Next Tunnel")
- end
- --Dig Next End
- -- 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 10 blocks
- if distance == 10 then
- 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("Tunnel quantity")
- local quantity = read()
- local torchNext = 0
- print("starting excavation...")
- checkFuel()
- -- Tunnel loop
- for index=1,quantity do
- if torchNext == 3 then
- torchNext = 0
- end
- tunnel(length)
- checkFuel()
- digNext(torchNext)
- torchNext = torchNext + 1
- end
- print("The tunnel(s) has been excavated!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement