Advertisement
el_froggo

tunnel with another ground

Sep 28th, 2022
729
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.78 KB | Gaming | 1 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(2)
  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(1)
  90.         while turtle.placeDown() == false do
  91.             turtle.digDown()
  92.             turtle.attackDown()
  93.         end
  94.     else
  95.     end
  96. end
  97.  
  98.  
  99. clear_terminal()
  100. write('How far forward? ')
  101. x = read()
  102. j = 0
  103. clear_terminal()
  104. print('Mining in progress...')
  105. print()
  106. print()
  107. print('<                         >')
  108. term.setCursorPos(13,5)
  109. print('0%')
  110.  
  111. for i=1,x-1 do
  112.     if j%11 == 0 then
  113.         turtle.turnRight()
  114.         turtle.turnRight()
  115.         turtle.select(16)
  116.         turtle.place()
  117.         turtle.select(1)
  118.         turtle.turnRight()
  119.         turtle.turnRight()
  120.     elseif (j-5)%11 == 0 then
  121.         turtle.turnRight()
  122.         turtle.turnRight()
  123.         turtle.select(16)
  124.         turtle.place()
  125.         turtle.select(1)
  126.         turtle.turnRight()
  127.         turtle.turnRight()
  128.     end
  129.     j = j+1
  130.     turtle_forward()
  131.     compare_down()
  132.     compare_forward()
  133.     turtle_up()
  134.     compare_forward()
  135.     turtle_up()
  136.     compare_forward()
  137.     compare_up()
  138.     turtle_left()
  139.     compare_forward()
  140.     compare_up()
  141.     turtle.turnRight()
  142.     compare_forward()
  143.     turtle_down()
  144.     compare_forward()
  145.     turtle.turnLeft()
  146.     compare_forward()
  147.     turtle_down()
  148.     compare_forward()
  149.     compare_down()
  150.     turtle.turnRight()
  151.     compare_forward()
  152.     turtle.turnRight()
  153.     turtle_forward()
  154.     turtle_forward()
  155.     compare_forward()
  156.     compare_down()
  157.     turtle.turnLeft()
  158.     compare_forward()
  159.     turtle_up()
  160.     compare_forward()
  161.     turtle.turnRight()
  162.     compare_forward()
  163.     turtle_up()
  164.     compare_forward()
  165.     compare_up()
  166.     turtle.turnLeft()
  167.     compare_forward()
  168.     turtle.turnLeft()
  169.     turtle_forward()
  170.     turtle.turnRight()
  171.     turtle_down()
  172.     turtle_down()
  173.  
  174.     p = (i/x-(i/x)%0.0001)*100
  175.     term.setCursorPos(13,5)
  176.     n = tostring(p)
  177.     term.clearLine()
  178.     print(n .. '%')
  179.     term.setCursorPos(2,4)
  180.     while p>4 do
  181.         p = p-4
  182.         write('=')
  183.     end
  184. end
  185.  
  186. term.setCursorPos(13,5)
  187. term.clearLine()
  188. print('100%')
  189. print()
  190. print('Mining complete.')
  191.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement