Advertisement
melzneni

quarry_DFE

Oct 24th, 2021 (edited)
336
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.17 KB | None | 0 0
  1. turtleAdapter = {
  2. forward = function()
  3. local state = turtle.forward()
  4. if test then
  5. if storageData.direction == 0 then
  6. storageData.pos[1] = storageData.pos[1] + 1
  7. elseif storageData.direction == 1 then
  8. storageData.pos[3] = storageData.pos[3] + 1
  9. elseif storageData.direction == 2 then
  10. storageData.pos[1] = storageData.pos[1] - 1
  11. elseif storageData.direction == 3 then
  12. storageData.pos[3] = storageData.pos[3] - 1
  13. end
  14. state = true
  15. end
  16. return state
  17. end,
  18. up = function()
  19. local state = turtle.up()
  20. if test then
  21. storageData.pos[2] = storageData.pos[2] + 1
  22. end
  23. return state
  24. end,
  25. down = function()
  26. local state = turtle.down()
  27. if test then
  28. storageData.pos[2] = storageData.pos[2] - 1
  29. end
  30. return state
  31. end,
  32. turnLeft = function()
  33. local state = turtle.turnLeft()
  34. storageData.direction = storageData.direction - 1
  35. if storageData.direction < 0 then
  36. storageData.direction = storageData.direction + 4
  37. end
  38. return state
  39. end,
  40. turnRight = function()
  41. local state = turtle.turnRight()
  42. storageData.direction = storageData.direction + 1
  43. if storageData.direction > 3 then
  44. storageData.direction = storageData.direction - 4
  45. end
  46. return state
  47. end,
  48. detect = function()
  49. return turtle.detect()
  50. end,
  51. detectUp = function()
  52. return turtle.detectUp()
  53. end,
  54. detectDown = function()
  55. return turtle.detectDown()
  56. end,
  57. select = function(id)
  58. return turtle.select(id)
  59. end,
  60. place = function()
  61. local state = turtle.place()
  62. if state then
  63. sleep(0.1)
  64. end
  65. return state
  66. end,
  67. placeUp = function()
  68. local state = turtle.placeUp()
  69. if state then
  70. sleep(0.1)
  71. end
  72. return state
  73. end,
  74. placeDown = function()
  75. local state = turtle.placeDown()
  76. if state then
  77. sleep(0.1)
  78. end
  79. return state
  80. end,
  81. dig = function()
  82. local digged = false;
  83. while (turtle.detect()) do
  84. if not turtle.dig() then
  85. break ;
  86. end
  87. digged = true;
  88. end
  89. return digged
  90. end,
  91. digUp = function()
  92. local digged = false;
  93. while (turtle.detectUp()) do
  94. if not turtle.digUp() then
  95. break ;
  96. end
  97. digged = true;
  98. end
  99. return digged
  100. end,
  101. digDown = function()
  102. local digged = false;
  103. while (turtle.detectDown()) do
  104. if not turtle.digDown() then
  105. break ;
  106. end
  107. digged = true;
  108. end
  109. return digged
  110. end,
  111. attack = function()
  112. return turtle.attack()
  113. end,
  114. attackUp = function()
  115. return turtle.attackUp()
  116. end,
  117. attackDown = function()
  118. return turtle.attackDown()
  119. end,
  120. getItemName = function(id)
  121. local name = turtle.getItemDetail(id)
  122. if name == nil then
  123. return nil
  124. end
  125. return name.name
  126. end,
  127. getItemCount = function(id)
  128. if id == nil then
  129. return turtle.getItemCount()
  130. end
  131. return turtle.getItemCount(id)
  132. end,
  133. drop = function(cnt)
  134. return turtle.drop(cnt)
  135. end,
  136. dropUp = function(cnt)
  137. return turtle.dropUp(cnt)
  138. end,
  139. dropDown = function(cnt)
  140. return turtle.dropDown(cnt)
  141. end,
  142. suck = function(cnt)
  143. return turtle.suck(cnt)
  144. end,
  145. suckUp = function(cnt)
  146. return turtle.suckUp(cnt)
  147. end,
  148. suckDown = function(cnt)
  149. return turtle.suckDown(cnt)
  150. end,
  151. refuel = function()
  152. return turtle.refuel()
  153. end,
  154. getFuelLevel = function()
  155. return turtle.getFuelLevel()
  156. end
  157. }
  158.  
  159. function setStorageData(sD)
  160. storageData = sD
  161. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement