Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = {...}
- local supply = peripheral.wrap("right") --Resupply Station
- function startup()
- term.clear()
- term.setCursorPos(1,1)
- print("Beginning tunnel")
- turtle.select(1)
- supply.link()
- turtle.forward()
- end
- function checkArgs()
- if #tArgs >= 3 or #tArgs == 0 then
- print("Invalid parameters, must contain at least 2 parameters <Distance, Direction>")
- end
- end
- function checkSupply()
- while turtle.getItemCount(15) <= 2 do
- --for i = 1,60 do
- --term.clear()
- --term.setCursorPos(1,1)
- --print("Waiting 60 seconds for more pipes")
- --print("Time remaining: " .. 60 - i .. " seconds")
- --sleep(1)
- --end
- supply.resupply(15)
- end
- end
- function send()
- turtle.select(16) --MFR Item Collector
- turtle.place()
- turtle.up()
- for i = 1,14 do
- turtle.select(i)
- turtle.drop()
- end
- turtle.down()
- turtle.select(16)
- turtle.dig()
- turtle.select(15) --Any Pipe
- turtle.place()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- function tunnel(dist, direction)
- if direction == "left" then
- turtle.turnLeft()
- end
- if direction == "right" then
- turtle.turnRight()
- end
- if direction == "back" then
- turtle.turnRight()
- turtle.turnRight()
- end
- for i = 1, tonumber(dist) do
- turtle.select(1)
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- turtle.turnLeft()
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- turtle.back()
- turtle.turnRight()
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- turtle.back()
- turtle.turnRight()
- checkSupply()
- send()
- end
- print("Tunnelling Complete")
- print("Returning")
- comeback(tArgs[1])
- end
- function comeback(dist)
- sleep(0) --Change this depending on your pipe type and distance, ie Gold = 0
- turtle.turnLeft()
- turtle.turnLeft()
- for i = 1,tonumber(dist) do
- turtle.dig()
- turtle.forward()
- end
- end
- startup()
- checkArgs()
- checkSupply()
- tunnel(tArgs[1], tostring(tArgs[2]))
Advertisement
Add Comment
Please, Sign In to add comment