Advertisement
Risk_exe

Untitled

Apr 12th, 2022
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1.  
  2. local position = {
  3. x = 0, y = 0, z = 0
  4. }
  5.  
  6. local start_point = {
  7. x = 0, y = 0, z = 0
  8. }
  9.  
  10.  
  11.  
  12. function Deploy_minions()
  13. clear();
  14. for i=1,4,1 do
  15. turtle.select(i);
  16. turtle.place();
  17. turtle.turnRight();
  18. end
  19. end
  20.  
  21. function Excavate()
  22. local a = peripheral.wrap('front');
  23. local b = peripheral.wrap('left');
  24. local c = peripheral.wrap('back');
  25. local d = peripheral.wrap('right');
  26. a.turnOn(); b.turnOn(); c.turnOn(); d.turnOn();
  27. end
  28.  
  29. function clear()
  30. for i=1,4,1 do
  31. turtle.dig();
  32. turtle.turnRight();
  33. end
  34. end
  35.  
  36. function Wait_for_minions()
  37. --[[ Write code to detect if blocks are around big cheese ]]
  38. local x = 0;
  39. while x < 4 do
  40. local res = turtle.detect();
  41. if res then
  42. x = x + 1;
  43. turtle.turnRight();
  44. end
  45. end
  46.  
  47. if position.y < 22 then
  48. Redstone_pulse();
  49. Up();
  50. else
  51. Break_minions();
  52. Ascend();
  53. end
  54.  
  55. end
  56.  
  57. function Break_minions()
  58. for i=1, 4, 1 do
  59. turtle.dig();
  60. turtle.turnRight();
  61. end
  62. Ascend();
  63. end
  64.  
  65. function Descend()
  66. while position.y > 8 do
  67. Down();
  68. end
  69. end
  70.  
  71. function Ascend()
  72. while position.y < start_point.y do
  73. Up();
  74. end
  75.  
  76. end
  77.  
  78. function Populate_position()
  79. --[[ Terrible code. ]]
  80. position.y = 100;
  81. end
  82.  
  83.  
  84. function Down()
  85. if turtle.detectDown() then
  86. turtle.digDown();
  87. end
  88. turtle.down();
  89. position.y = position.y - 1;
  90. end
  91.  
  92. function Up()
  93. if turtle.detectUp() then
  94. turtle.digUp()
  95. end
  96. turtle.up()
  97. position.y = position.y + 1;
  98. end
  99.  
  100. function Forward()
  101. if turtle.detect() then
  102. turtle.dig();
  103. end
  104. turtle.forward()
  105. end
  106.  
  107. function Redstone_pulse()
  108. redstone.setOutput('front', true);
  109. redstone.setOutput('back', true);
  110. redstone.setOutput('left', true);
  111. redstone.setOutput('right', true);
  112. sleep(0.5);
  113. redstone.setOutput('front', false);
  114. redstone.setOutput('back', false);
  115. redstone.setOutput('left', false);
  116. redstone.setOutput('right', false);
  117. end
  118.  
  119. print(start_point);
  120. print(position.hi);
  121. local lowest_level = 8;
  122. local highest_level = 22;
  123.  
  124. --[[ turtle.refuel();
  125. turtle.select() ]]
  126. function Init()
  127. Populate_position();
  128. Descend()
  129. Deploy_minions();
  130. Excavate();
  131. Redstone_pulse();
  132. sleep(8);
  133. Wait_for_minions();
  134. end
  135.  
  136. Init();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement