Guest User

smartexc

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