Advertisement
el_froggo

build hall

Sep 28th, 2022 (edited)
643
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.67 KB | Gaming | 0 0
  1. ---
  2. --- Generated by EmmyLua(https://github.com/EmmyLua)
  3. --- Created by martinio.
  4. --- DateTime: 27.09.22 15:51
  5. ---
  6.  
  7. function clear_terminal()
  8.     term.clear()
  9.     term.setCursorPos(1, 1)
  10. end
  11.  
  12. function turtle_up()
  13.     while turtle.up() == false do
  14.         turtle.digUp()
  15.         turtle.attackUp()
  16.     end
  17. end
  18.  
  19. function turtle_down()
  20.     while turtle.down() == false do
  21.         turtle.digDown()
  22.         turtle.attackDown()
  23.     end
  24. end
  25.  
  26. function turtle_right()
  27.     turtle.turnRight()
  28.     while turtle.forward() == false do
  29.         turtle.dig()
  30.         turtle.attack()
  31.     end
  32. end
  33.  
  34. function turtle_left()
  35.     turtle.turnLeft()
  36.     while turtle.forward() == false do
  37.         turtle.dig()
  38.         turtle.attack()
  39.     end
  40. end
  41.  
  42. function turtle_forward()
  43.     while turtle.forward() == false do
  44.         turtle.dig()
  45.         turtle.attack()
  46.     end
  47. end
  48.  
  49. function turtle_backward()
  50.     if turtle.back() == false then
  51.         turtle.turnRight(2)
  52.         while turtle.forward() == false do
  53.             turtle.dig()
  54.             turtle.attack()
  55.         end
  56.         turtle.turnRight()
  57.         turtle.turnRight()
  58.     else
  59.     end
  60. end
  61.  
  62. function compare_up()
  63.     turtle.select(1)
  64.     if turtle.compareUp() == false then
  65.         turtle.select(1)
  66.         while turtle.placeUp() == false do
  67.             turtle.digUp()
  68.             turtle.attackUp()
  69.         end
  70.     else
  71.     end
  72. end
  73.  
  74. function compare_forward()
  75.     turtle.select(1)
  76.     if turtle.compare() == false then
  77.         turtle.select(2)
  78.         while turtle.place() == false do
  79.             turtle.dig()
  80.             turtle.attack()
  81.         end
  82.     else
  83.     end
  84. end
  85.  
  86. function compare_down()
  87.     turtle.select(1)
  88.     if turtle.compareDown() == false then
  89.         turtle.select(2)
  90.         while turtle.placeDown() == false do
  91.             turtle.digDown()
  92.             turtle.attackDown()
  93.         end
  94.     else
  95.     end
  96. end
  97.  
  98. clear_terminal()
  99. write('How width?')
  100. hall_width = read()
  101.  
  102. write('How depth?')
  103. hall_depth = read()
  104.  
  105. write('How height?')
  106. hall_height = read()
  107. z = 0
  108.  
  109. clear_terminal()
  110. print('Mining in progress...')
  111. print()
  112. print()
  113. print('<                         >')
  114. term.setCursorPos(13, 5)
  115. print('0%')
  116.  
  117. turtle.refuel()
  118. turtle_forward()
  119.  
  120. turtle.turnLeft()
  121. compare_forward()
  122. turtle.turnRight()
  123.  
  124. for i = 1, hall_width - 1 do
  125.     compare_down()
  126.     compare_forward()
  127.     compare_up()
  128.     turtle.turnRight()
  129.     turtle_forward()
  130.     turtle.turnLeft()
  131. end
  132. turtle.turnRight()
  133. compare_forward()
  134. turtle.turnLeft()
  135. compare_down()
  136. compare_forward()
  137. compare_up()
  138. turtle.turnLeft()
  139. for a = 1, hall_width - 1 do
  140.     turtle.forward()
  141. end
  142. turtle_up()
  143. turtle.turnRight()
  144.  
  145.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement