Advertisement
Guest User

autobranchminer

a guest
Feb 8th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.05 KB | None | 0 0
  1. --autobranchminer
  2. --select 1 is torch storage
  3.  
  4.  
  5. function oneminer(length)
  6.     turtle.digDown()
  7.     for i=1,length do
  8.         turtle.dig()
  9.         turtle.forward()
  10.         turtle.digDown()
  11.         if i%4 == 0 then
  12.             turtle.select(1)
  13.             turtle.placeDown()
  14.         end
  15.     end
  16.     for i=1,length do
  17.         turtle.back()
  18.     end
  19. end
  20.  
  21. function lr_work(lr)
  22.     if lr == "right" then
  23.         turtle.turnRight()
  24.         turtle.dig()
  25.         turtle.forward()
  26.         turtle.digDown()
  27.         turtle.dig()
  28.         turtle.forward()
  29.         turtle.digDown()
  30.         turtle.turnLeft()
  31.     elseif lr == "left" then
  32.         turtle.turnLeft()
  33.         turtle.dig()
  34.         turtle.forward()
  35.         turtle.digDown()
  36.         turtle.dig()
  37.         turtle.forward()
  38.         turtle.digDown()
  39.         turtle.turnRight()
  40.     end
  41. end
  42.  
  43. function miner(length,many,lr)
  44.     oneminer(length)
  45.     lr_work(lr)
  46.     for i=1,many-1 do
  47.         oneminer(length)
  48.         if many-1 == i then
  49.             break
  50.         end
  51.         lr_work(lr)
  52.     end
  53. end
  54.  
  55. args = {...}
  56. if table.getn(args) == 3 then
  57.     length = tonumber(args[1])
  58.     many = tonumber(args[2])
  59.     lr = args[3]
  60.     miner(length,many,lr)
  61. else
  62.     print("autobranchminer <length> <many> <right or left>")
  63. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement