Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --made by DiamondFireZ
- --Fuel goes to slot 16
- --Torches goes to slot 15
- --chests goes to slot 14
- function fuelling()
- if turtle.getFuelLevel() <= 10 then
- print("Adding Fuel...")
- turtle.select(16)
- turtle.refuel(1)
- turtle.select(1)
- print("Done.")
- end
- end
- function turnAround()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- function turnAround2Left()
- turtle.turnLeft()
- turtle.dig()
- if turtle.detect() then
- for index = 1,5 do
- turtle.dig()
- end
- end
- turtle.forward()
- turtle.digUp()
- turtle.turnLeft()
- end
- function nextPlaceLeft()
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- turtle.turnRight()
- end
- function turnAround2Right()
- turtle.turnRight()
- turtle.dig()
- if turtle.detect() then
- for index = 1,5 do
- turtle.dig()
- end
- end
- turtle.forward()
- turtle.digUp()
- turtle.turnRight()
- end
- function nextPlaceRight()
- turtle.turnLeft()
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- turtle.turnLeft()
- end
- function tunnelling(givenLenght)
- local distance = 0
- for index = 1,givenLenght do
- if turtle.detect() then
- for index = 1,5 do
- turtle.dig()
- end
- end
- turtle.forward()
- distance = distance + 1
- turtle.digUp()
- turtle.select(1)
- fuelling()
- if distance == 10 then
- print("Placing torch...")
- turtle.select(15)
- turnAround()
- turtle.place()
- turnAround()
- distance = 0
- end
- end
- end
- function tunnellingBack(givenLenght)
- for index = 1,givenLenght do
- if turtle.detect() then
- for index = 1,5 do
- turtle.dig()
- end
- end
- turtle.forward()
- turtle.digUp()
- turtle.select(1)
- fuelling()
- end
- end
- function chestAndDrop()
- turtle.select(14)
- turtle.dig()
- print("Placing chest...")
- turtle.place()
- print("Dropping items to chest...")
- local selected = 0
- for index = 1,13 do
- selected = selected + 1
- turtle.select(selected)
- print(selected)
- turtle.drop()
- end
- turtle.select(1)
- print("Done!")
- end
- print("Starting program...")
- print("--------------------------")
- print("Version 0.2 release, build/test 14")
- print("--------------------------")
- print("Fuel goes to slot 16")
- print("Torches goes to slot 15")
- print("Chests goes to slot 14")
- print("--------------------------")
- print("What will be the tunnel lenght?")
- local lenght = read()
- print("--------------------------")
- print("How many tunnels will the turtle make?")
- local tunnels = read()
- print("--------------------------")
- print("Which way the tunnels will go? (left=1/right=2)")
- local way = read()
- print("--------------------------")
- print("Starting to work...")
- print("--------------------------")
- fuelling()
- for index = 1,tunnels do
- tunnelling(lenght)
- if way == "1" then
- turnAround2Left()
- elseif way == "2" then
- turnAround2Right()
- else
- print("ERR-1. You have not chosen right or left!")
- return 0
- end
- tunnellingBack(lenght)
- chestAndDrop()
- if way == "1" then
- nextPlaceLeft()
- elseif way == "2" then
- nextPlaceRight()
- else
- print("ERR-1. You have not chosen right or left!")
- return 0
- end
- end
- print("Tunnel's are ready.")
- print("Program Stopped.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement