tterrag1098

branch

May 11th, 2013
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.03 KB | None | 0 0
  1. local tArgs = {...}
  2. local length = tArgs[1]
  3. local numTunnels = tArgs[2]
  4. local inv = true
  5. local checkTorch = 0
  6.  
  7. function tunnel()
  8.   for i=1,length do
  9.     turtle.dig()
  10.     while turtle.forward() == false do
  11.       turtle.dig()
  12.     end
  13.     turtle.digUp()
  14.     torch()
  15.   end
  16. end
  17.  
  18. function turnAround()
  19.   for k = 1,6 do
  20.     turtle.dig()
  21.     while turtle.forward() == false do
  22.       turtle.dig()
  23.     end
  24.     turtle.digUp()
  25.     torch()
  26.   end
  27.  
  28.   checkInv()
  29.  
  30.   turtle.back()
  31.   turtle.back()
  32.   turtle.back()
  33. end
  34.  
  35. function checkInv()
  36.   for y = 2,16 do
  37.     turtle.select(y)
  38.     if turtle.compareTo(1) then
  39.       turtle.drop()
  40.     end
  41.   end
  42. end
  43.  
  44. function torch()
  45.   if checkTorch == 10 then
  46.     turtle.select(16)
  47.     turtle.placeUp()
  48.     turtle.select(1)
  49.     checkTorch = 0
  50.   else
  51.     checkTorch = checkTorch + 1
  52.   end
  53. end
  54.      
  55. for j = 1,numTunnels do
  56.   tunnel()
  57.   turtle.turnLeft()
  58.   turnAround()
  59.   turtle.turnLeft()
  60.   tunnel()
  61.   turtle.turnRight()
  62.   turnAround()
  63.   turtle.turnRight()
  64. end
Advertisement
Add Comment
Please, Sign In to add comment