goldfiction

tunn

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