Advertisement
thezak48

Strip

Jan 19th, 2015
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.07 KB | None | 0 0
  1. --Usage: pastebin get 2wgS78bK strip
  2. --strip <Depth of Tunnels> <No. of Cycles>
  3. --Put Fuel in Slot 1
  4. --Put Bridging Material in slot 2
  5. --Put Chests in slot 3. 1 chest for every Cycle
  6. --Remember to keep turtle chunk loaded
  7.  
  8. local tArgs = { ... }
  9.  
  10. function AboutTurn()
  11.         turtle.turnLeft()
  12.         turtle.turnLeft()
  13. end
  14.  
  15. function detect()
  16.         if turtle.detect() then
  17.                 turtle.dig()
  18.         end
  19. end
  20.  
  21. function detectUp()
  22.         if turtle.detectUp() then
  23.                 turtle.digUp()
  24.         end
  25.     if turtle.detectUp() then
  26.                 turtle.digUp()
  27.         end
  28.     if turtle.detectUp() then
  29.                 turtle.digUp()
  30.         end
  31.     if turtle.detectUp() then
  32.                 turtle.digUp()
  33.         end
  34.     if turtle.detectUp() then
  35.                 turtle.digUp()
  36.         end
  37.     if turtle.detectUp() then
  38.                 turtle.digUp()
  39.         end
  40.     if turtle.detectUp() then
  41.                 turtle.digUp()
  42.         end
  43.         turtle.up()
  44. end
  45.  
  46. function detectDown()
  47.         if turtle.detectDown() then
  48.                 turtle.digDown()
  49.         end
  50.         turtle.down()
  51. end
  52.  
  53. function forward()
  54.     if turtle.detect() then
  55.         detect()
  56.     end
  57.     if turtle.detect() then
  58.         detect()
  59.     end
  60.     if turtle.detect() then
  61.         detect()
  62.     end
  63.     if turtle.detect() then
  64.         detect()
  65.     end
  66.         if turtle.detectDown() then
  67.                 turtle.forward()
  68.         else
  69.                 turtle.select(2)
  70.                 turtle.placeDown()
  71.                 turtle.forward()
  72.         end
  73. end
  74.  
  75. function tunnel()
  76.         turtle.refuel()
  77.         detect()
  78.         forward()
  79.         detect()
  80.         turtle.turnLeft()
  81.         detect()
  82.         detectUp()
  83.         detect()
  84.         detectUp()
  85.         detect()
  86.         AboutTurn()
  87.         detect()
  88.         detectDown()
  89.         detect()
  90.         detectDown()
  91.         detect()
  92.         turtle.turnLeft()  
  93. end
  94.  
  95. function tunnelFinish()
  96.         forward()
  97.         turtle.turnLeft()
  98.         detect()
  99.         detectUp()
  100.         detect()
  101.         detectUp()
  102.         detect()
  103.         AboutTurn()
  104.         detect()
  105.         detectDown()
  106.         detect()
  107.         detectDown()
  108.         detect()
  109.         turtle.turnLeft()
  110. end
  111.  
  112. if tArgs[1] == nil then
  113.         depth = 1
  114.     else
  115.         depth = tArgs[1]
  116. end
  117.  
  118. if tArgs[2] == nil then
  119.         times = 1
  120.     else
  121.         times = tArgs[2]
  122. end
  123.  
  124. tunnel()
  125. tunnelFinish()
  126. for a = 1, times do
  127.     tunnel()
  128.     tunnel()
  129.     tunnelFinish()
  130.     AboutTurn()
  131.     turtle.forward()
  132.     turtle.turnLeft()
  133.    
  134.     for i = 1, depth - 1 do
  135.         tunnel()
  136.     end
  137.    
  138.     tunnelFinish()
  139.     AboutTurn()
  140.    
  141.     for i = 1, depth do
  142.         forward()
  143.     end
  144.    
  145.     AboutTurn()
  146.     turtle.select(3)
  147.     turtle.place()
  148.     turtle.select(1)
  149.     turtle.drop()
  150.     for z = 4, 16 do
  151.         turtle.select(z)
  152.         turtle.drop()
  153.     end
  154.     AboutTurn()
  155.    
  156.     forward()
  157.    
  158.     for i = 1, depth - 1 do
  159.         tunnel()
  160.     end
  161.    
  162.     tunnelFinish()
  163.     AboutTurn()
  164.    
  165.     for i = 1, depth do
  166.         forward()
  167.     end
  168.    
  169.     forward()
  170.    
  171.     turtle.select(1)
  172.     turtle.drop()
  173.     for z = 4, 16 do
  174.         turtle.select(z)
  175.         turtle.drop()
  176.     end
  177.    
  178.     turtle.turnLeft()
  179.     forward()
  180.     tunnel()
  181.     tunnelFinish()
  182.    
  183. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement