Advertisement
nainmagic

computercraft/mine

Jun 25th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.63 KB | None | 0 0
  1. os.loadAPI("tmnt")
  2.  
  3. function tunnel(count)
  4.     for i=1,count do
  5.         tmnt.forceForward()
  6.         tmnt.tryDigUp()
  7.     end
  8. end
  9.  
  10. function linkPrevious()
  11.     tunnel(2)
  12.     tmnt.turn180()
  13.     turtle.forward()
  14.     turtle.forward()
  15.     turtle.forward()
  16.     tunnel(3)
  17. end
  18.  
  19. function mine()
  20.     turtle.turnLeft()
  21.     tunnel(9)
  22.    
  23.     turtle.turnLeft()
  24.     linkPrevious()
  25.  
  26.     turtle.turnRight()
  27.     tunnel(9)
  28.    
  29.     turtle.turnRight()
  30.     linkPrevious()
  31. end
  32.  
  33. local repetition = 1
  34.  
  35. local argv = { ... }
  36. if #argv == 1 then
  37.     repetition = tonumber(argv[1])
  38. elseif #argv > 1 then
  39.     error("Usage: mine [length=1]")
  40. end
  41.  
  42. tmnt.checkFuel()
  43.  
  44. for i = 1, repetition do
  45.     mine()
  46. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement