Advertisement
guamie

DirtDropDumb

Apr 5th, 2020
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.23 KB | None | 0 0
  1. --DirtDropDumb
  2. --FUNCTIONS
  3. --This is a set of all of the basic functions added to most programs
  4. --
  5. --MOVEMENT
  6. --
  7. --Turn turtle 180 Degrees in place ==========
  8. --
  9. function turnAround()
  10.         turtle.turnRight()
  11.         turtle.turnRight()
  12. end
  13. --
  14. --Ensure turtle goes up
  15. --
  16. function goUp()
  17.     while not turtle.up() do
  18.         upDig()
  19.     end
  20. end
  21. --    
  22. --Ensure turtle goes down
  23. --
  24. function goDown()
  25.     while not turtle.down() do
  26.         downDig()
  27.     end
  28. end
  29. --
  30. --Ensure turtle moves forward
  31. --
  32. function goForward()
  33.     while not turtle.forward() do
  34.         forwardDig()
  35.     end
  36. end
  37. --
  38. --Ensure Back (No)
  39. --We can't Ensure going back
  40. --Use 'shell.run("go back")' if needed.
  41. --
  42. --ACTION FUNCTIONS
  43. --
  44. --Dig forward
  45. --
  46. function forwardDig()
  47.     while turtle.detect() do
  48.         turtle.dig()
  49.     end
  50. end
  51. --
  52. --Dig up
  53. --
  54. function upDig()
  55.     while turtle.detectUp() do
  56.         turtle.digUp()
  57.     end
  58. end
  59. --
  60. --Dig Down
  61. --
  62. function downDig()
  63.     turtle.digDown()
  64. end
  65. --
  66. --Counter for inventer for the PLACE BLOCK DOWN function
  67. --More is needed here
  68. --Select next inventory slot if current is empty
  69. --
  70. --Counts stacks of items
  71. --
  72. function CounterBlock()
  73.     repeat
  74.     if turtle.getItemCount(slot) == 0 and slot ~=16 then
  75.         slot = slot + 1
  76.         turtle.select(slot)
  77.     elseif
  78.         turtle.getItemCount(slot) == 0 and slot ==16 then
  79.         term.clear()
  80.         print("I've run out of Material before finishing.  Add more to continue!")
  81.         slot = 1
  82.         turtle.select(slot)
  83.         repeat
  84.             sleep(1)
  85.         until turtle.getItemCount(slot) > 0
  86.         sleep(3)
  87.         print("Starting in 3 seconds")
  88. end
  89. until
  90. turtle.getItemCount(slot) > 0
  91. end
  92. --
  93. --Place Block Down
  94. --
  95. function placeDown()
  96.     turtle.select(slot)
  97.         turtle.placeDown()
  98.             CounterBlock()
  99. end
  100. --
  101. --Place Block Forward
  102. --
  103. function place()
  104.     turtle.select(slot)
  105.         turtle.place()
  106.             CounterBlock()
  107. end
  108. --
  109. --Place Block Up
  110. --
  111. function placeUp()
  112.     turtle.select(slot)
  113.         turtle.placeUp()
  114.             CounterBlock()
  115. end
  116. --
  117. ----------
  118. ----------
  119. ----------
  120. slot=1
  121. z=0
  122. while not turtle.detect() do
  123. while not turtle.detectDown() do
  124. turtle.down()
  125. z=z+1
  126. end
  127. for i=1, z do
  128. turtle.up()
  129. placeDown()
  130. z=z-1
  131. end
  132. turtle.forward()
  133. end
  134.  
  135. repeat
  136. turtle.down()
  137. z=z+1
  138. until
  139. turtle.detectDown()
  140. repeat
  141. turtle.up()
  142. placeDown()
  143. z=z-1
  144. until
  145. z==0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement