Advertisement
Guest User

chestexc

a guest
Feb 23rd, 2013
4,374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.33 KB | None | 0 0
  1. local args = { ... }
  2. size = args[1]
  3. if(size % 2 == 1) then
  4.     size = size - 1
  5. end
  6.  
  7. function clear()
  8.     turtle.digUp()
  9.     turtle.digDown()
  10. end
  11.  
  12. function move()
  13.     if (turtle.getItemCount(16) ~= 0) then
  14.         dropItems()
  15.     end
  16.     if(turtle.getFuelLevel() == 0) then
  17.         error("Out of fuel")
  18.     end
  19.     while (not turtle.forward()) do
  20.         turtle.dig()
  21.     end
  22. end
  23.  
  24. function right()
  25.     turtle.turnRight()
  26. end
  27.  
  28. function left()
  29.     turtle.turnLeft()
  30. end
  31.  
  32. function down3()
  33.     for num = 1, 3 do
  34.         turtle.digDown()
  35.         turtle.down()
  36.     end
  37. end
  38.  
  39. function outer()
  40.     for num = 1, 3 do
  41.         for num = 2, size do
  42.             clear()
  43.             move()
  44.         end
  45.         right()
  46.     end
  47. end
  48.  
  49. function inner()
  50.     peaks = (size / 2) - 1
  51.     for num = 1, peaks do
  52.         ascend()
  53.         descend()
  54.     end
  55.     clear()
  56.     move()
  57.     right()
  58. end
  59.  
  60. function ascend()
  61.     clear()
  62.     move()
  63.     right()
  64.     for num = 3, size do
  65.         clear()
  66.         move()
  67.     end
  68.     left()
  69. end
  70.  
  71. function descend()
  72.     clear()
  73.     move()
  74.     left()
  75.     for num = 3, size do
  76.         clear()
  77.         move()
  78.     end
  79.     right()
  80. end
  81.  
  82. function dropItems()
  83.     right()
  84.     right()
  85.     turtle.select(1)
  86.     while (not turtle.place()) do
  87.         turtle.dig()
  88.     end
  89.     for num = 2, 16 do
  90.         turtle.select(num)
  91.         turtle.drop()
  92.     end
  93.     turtle.select(2)
  94.     left()
  95.     left()
  96.     if(turtle.getItemCount(1) == 0) then
  97.         error("Out of chests")
  98.     end
  99. end
  100.  
  101. while(true) do
  102.     outer()
  103.     inner()
  104.     down3()
  105. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement