Advertisement
Risk_exe

Untitled

Apr 13th, 2022
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 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. sleep(5);
  51. Wait_for_minions();
  52. else
  53. Break_minions();
  54. Ascend();
  55. end
  56.  
  57. end
  58.  
  59. function Break_minions()
  60. for i=1, 4, 1 do
  61. turtle.dig();
  62. turtle.turnRight();
  63. end
  64. Ascend();
  65. end
  66.  
  67. function Descend()
  68. while position.y > 8 do
  69. Down();
  70. end
  71. end
  72.  
  73. function Ascend()
  74. while position.y < start_point.y do
  75. Up();
  76. end
  77.  
  78. end
  79.  
  80. function Populate_position()
  81. --[[ Terrible code. ]]
  82. position.y = 100;
  83. end
  84.  
  85.  
  86. function Down()
  87. if turtle.detectDown() then
  88. turtle.digDown();
  89. end
  90. turtle.down();
  91. position.y = position.y - 1;
  92. end
  93.  
  94. function Up()
  95. if turtle.detectUp() then
  96. turtle.digUp()
  97. end
  98. turtle.up()
  99. position.y = position.y + 1;
  100. end
  101.  
  102. function Forward()
  103. if turtle.detect() then
  104. turtle.dig();
  105. end
  106. turtle.forward()
  107. end
  108.  
  109. function Redstone_pulse()
  110. redstone.setOutput('front', true);
  111. redstone.setOutput('back', true);
  112. redstone.setOutput('left', true);
  113. redstone.setOutput('right', true);
  114. sleep(0.5);
  115. redstone.setOutput('front', false);
  116. redstone.setOutput('back', false);
  117. redstone.setOutput('left', false);
  118. redstone.setOutput('right', false);
  119. end
  120.  
  121. print(start_point);
  122. print(position.hi);
  123. local lowest_level = 8;
  124. local highest_level = 22;
  125.  
  126. --[[ turtle.refuel();
  127. turtle.select() ]]
  128. function Init()
  129. Populate_position();
  130. Descend()
  131. Deploy_minions();
  132. Excavate();
  133. Redstone_pulse();
  134. sleep(8);
  135. Wait_for_minions();
  136. end
  137.  
  138. Init();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement