goldfiction

safetunnel

Jun 28th, 2023
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.68 KB | None | 0 0
  1. function clc()
  2.     term.clear()
  3.     term.setCursorPos(1,1)
  4. end
  5.  
  6. function tup()
  7.     while turtle.up() == false  do
  8.         turtle.digUp()
  9.         turtle.attackUp()
  10.     end
  11. end
  12.  
  13. function tdn()
  14.     while turtle.down() == false do
  15.         turtle.digDown()
  16.         turtle.attackDown()
  17.     end
  18. end
  19.  
  20. function trt()
  21.     turtle.turnRight()
  22.     while turtle.forward() == false do
  23.         turtle.dig()
  24.         turtle.attack()
  25.     end
  26. end
  27.  
  28. function tlt()
  29.     turtle.turnLeft()
  30.     while turtle.forward() == false do
  31.         turtle.dig()
  32.         turtle.attack()
  33.     end
  34. end
  35.  
  36. function tfd()
  37.     while turtle.forward() == false do
  38.         turtle.dig()
  39.         turtle.attack()
  40.     end
  41. end
  42.  
  43. function tbk()
  44.     if turtle.back() == false then
  45.         turtle.turnRight(2)
  46.         while turtle.forward() == false do
  47.             turtle.dig()
  48.             turtle.attack()
  49.         end
  50.         turtle.turnRight()
  51.         turtle.turnRight()
  52.     else
  53.     end
  54. end
  55.  
  56. function cup()
  57.     turtle.select(1)
  58.     if turtle.compareUp() == false then
  59.         turtle.select(2)
  60.         while turtle.placeUp() == false do
  61.             turtle.digUp()
  62.             turtle.attackUp()
  63.         end
  64.     else
  65.     end
  66. end
  67.  
  68. function cfd()
  69.     turtle.select(1)
  70.     if turtle.compare() == false then
  71.         turtle.select(2)
  72.         while turtle.place() == false do
  73.             turtle.dig()
  74.             turtle.attack()
  75.         end
  76.     else
  77.     end
  78. end
  79.  
  80. function cdn()
  81.     turtle.select(1)
  82.     if turtle.compareDown() == false then
  83.         turtle.select(2)
  84.         while turtle.placeDown() == false do
  85.             turtle.digDown()
  86.             turtle.attackDown()
  87.         end
  88.     else
  89.     end
  90. end
  91.  
  92.  
  93. clc()
  94. write('How far forward? ')
  95. x = read()
  96. j = 0
  97. clc()
  98. print('Mining in progress...')
  99. print()
  100. print()
  101. print('<                         >')
  102. term.setCursorPos(13,5)
  103. print('0%')
  104.  
  105. for i=1,x-1 do
  106.     if j%11 == 0 then
  107.         turtle.turnRight()
  108.         turtle.turnRight()
  109.         turtle.select(16)
  110.         turtle.place()
  111.         turtle.select(1)
  112.         turtle.turnRight()
  113.         turtle.turnRight()
  114.     elseif (j-5)%11 == 0 then
  115.         turtle.turnRight()
  116.         turtle.turnRight()
  117.         turtle.select(16)
  118.         turtle.place()
  119.         turtle.select(1)
  120.         turtle.turnRight()
  121.         turtle.turnRight()
  122.     end
  123.     j = j+1
  124.     tfd()
  125.     cdn()
  126.     cfd()
  127.     tup()
  128.     cfd()
  129.     tup()
  130.     cfd()
  131.     cup()
  132.     tlt()
  133.     cfd()
  134.     cup()
  135.     turtle.turnRight()
  136.     cfd()
  137.     tdn()
  138.     cfd()
  139.     turtle.turnLeft()
  140.     cfd()
  141.     tdn()
  142.     cfd()
  143.     cdn()
  144.     turtle.turnRight()
  145.     cfd()
  146.     turtle.turnRight()
  147.     tfd()
  148.     tfd()
  149.     cfd()
  150.     cdn()
  151.     turtle.turnLeft()
  152.     cfd()
  153.     tup()
  154.     cfd()
  155.     turtle.turnRight()
  156.     cfd()
  157.     tup()
  158.     cfd()
  159.     cup()
  160.     turtle.turnLeft()
  161.     cfd()
  162.     turtle.turnLeft()
  163.     tfd()
  164.     turtle.turnRight()
  165.     tdn()
  166.     tdn()
  167.    
  168.     p = (i/x-(i/x)%0.0001)*100
  169.     term.setCursorPos(13,5)
  170.     n = tostring(p)
  171.     term.clearLine()
  172.     print(n .. '%')
  173.     term.setCursorPos(2,4)
  174.     while p>4 do
  175.         p = p-4
  176.         write('=')
  177.     end
  178. end
  179.  
  180. term.setCursorPos(13,5)
  181. term.clearLine()
  182. print('100%')
  183. print()
  184. print('Mining complete.')
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
Add Comment
Please, Sign In to add comment