Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = {...}
- local length = tArgs[1]
- local numTunnels = tArgs[2]
- local inv = true
- local checkTorch = 0
- local height = 0
- function tunnel()
- term.clear()
- term.setCursorPos(1,1)
- print("Mining...")
- for i=1,length do
- fuel()
- turtle.dig()
- while turtle.forward() == false do
- turtle.dig()
- end
- turtle.digUp()
- torch()
- end
- end
- function turnAround()
- term.clear()
- term.setCursorPos(1,1)
- print("Turning around...")
- for k = 1,6 do
- fuel()
- turtle.dig()
- while turtle.forward() == false do
- turtle.dig()
- end
- turtle.digUp()
- torch()
- end
- checkInv()
- while turtle.back() == false do
- turtle.turnRight()
- turtle.turnRight()
- turtle.dig()
- for i = 1,3 do
- turtle.forward()
- turtle.dig()
- end
- turtle.turnRight()
- turtle.turnRight()
- for i = 1,3 do
- turtle.back()
- end
- end
- turtle.back()
- turtle.back()
- end
- function checkInv()
- term.clear()
- term.setCursorPos(1,1)
- print("Trashing...")
- for y = 2,16 do
- turtle.select(y)
- if turtle.compareTo(1) then
- turtle.drop()
- end
- end
- end
- function torch()
- if turtle.getItemCount(16) < 5 then
- term.clear()
- term.setCursorPos(1,1)
- print("Waiting for torches...place in bottom right.")
- while turtle.getItemCount(16) < 5 do
- sleep(2)
- end
- end
- term.clear()
- term.setCursorPos(1,1)
- print("Mining...")
- if checkTorch == 8 then
- fuel()
- turtle.select(16)
- turtle.up()
- turtle.digUp()
- if turtle.placeUp() or turtle.getItemCount(16) == 0 then
- for i = 0,height do
- fuel()
- turtle.down()
- end
- turtle.select(1)
- checkTorch = 0
- height = 0
- else
- height = height + 1
- torch()
- end
- else
- checkTorch = checkTorch + 1
- end
- end
- function fuel()
- if turtle.getFuelLevel() < 50 then
- print ("Wating for fuel...place in bottom left.")
- while turtle.getFuelLevel() < 50 do
- turtle.select(13)
- turtle.refuel()
- sleep(2)
- end
- end
- term.clear()
- term.setCursorPos(1,1)
- print("Mining...")
- turtle.select(1)
- end
- function begin()
- turtle.select(1)
- if turtle.getItemCount(1) == 0 then
- print("Please place an item to trash in the top left.")
- while turtle.getItemCount(1) == 0 do
- sleep(1)
- end
- term.clear()
- term.setCursorPos(1,1)
- begin()
- else
- print("The item in the top left will be trashed...confirm?")
- os.pullEvent("key")
- end
- term.clear()
- term.setCursorPos(1,1)
- end
- begin()
- for j = 1,numTunnels do
- tunnel()
- turtle.turnLeft()
- turnAround()
- turtle.turnLeft()
- tunnel()
- turtle.turnRight()
- turnAround()
- turtle.turnRight()
- end
- term.clear()
- term.setCursorPos(1,1)
- print("Done!")
Advertisement
Add Comment
Please, Sign In to add comment