Advertisement
Chronno

Computercraft New Tunnel

Apr 16th, 2013
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.54 KB | None | 0 0
  1. local dist = {...}
  2. local slot = 1
  3.  
  4. function invCheck()
  5.     if turtle.getItemCount(slot) == 0 then
  6.         if slot == 15 then
  7.             print ("Reset inventory and press any key")
  8.             local event, param1 = os.pullEvent ("char")
  9.             slot = 1
  10.             turtle.select(slot)
  11.             invCheck()
  12.         else
  13.             slot = slot + 1
  14.             turtle.select(slot)
  15.             invCheck()
  16.         end
  17.     end
  18. end
  19.  
  20. function torch()
  21.     turtle.turnRight()
  22.     turtle.turnRight()
  23.     turtle.select(16)
  24.     turtle.place()
  25.     turtle.select(slot)
  26.     turtle.turnRight()
  27.     turtle.turnRight()
  28. end
  29.  
  30. function dig()
  31.     if turtle.dig() == true then
  32.         os.sleep(0.5)
  33.         dig()
  34.     end
  35. end
  36.  
  37. function digUp()
  38.     if turtle.digUp() == true then
  39.         os.sleep(0.5)
  40.         digUp()
  41.     end
  42. end
  43.    
  44.  
  45. function layer()
  46.     dig()
  47.     turtle.forward()
  48.     invCheck()
  49.     turtle.placeDown()
  50.     digUp()
  51.     turtle.up()
  52.     invCheck()
  53.     turtle.placeUp()
  54.     turtle.down()
  55.     turtle.turnLeft()
  56.     dig()
  57.     turtle.forward()
  58.     invCheck()
  59.     turtle.placeDown()
  60.     invCheck()
  61.     turtle.place()
  62.     digUp()
  63.     turtle.up()
  64.     invCheck()
  65.     turtle.place()
  66.     invCheck()
  67.     turtle.placeUp()
  68.     turtle.turnRight()
  69.     turtle.turnRight()
  70.     dig()
  71.     turtle.forward()
  72.     invCheck()
  73.     turtle.placeUp()
  74.     dig()
  75.     turtle.forward()
  76.     invCheck()
  77.     turtle.placeUp()
  78.     invCheck()
  79.     turtle.place()
  80.     turtle.digDown()
  81.     turtle.down()
  82.     invCheck()
  83.     turtle.place()
  84.     invCheck()
  85.     turtle.placeDown()
  86.     turtle.turnRight()
  87.     turtle.turnRight()
  88.     turtle.forward()
  89.     turtle.turnRight()
  90. end
  91.  
  92. if dist[1] == dist[111] then
  93.     dist[1] = 1
  94. end
  95. for i=1,dist[1] do
  96.     layer()
  97.     if math.fmod(i,5) == 1 and i ~= 1 then
  98.         torch()
  99.     end
  100. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement