Advertisement
juliancardz

StipMine

Nov 4th, 2016
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.76 KB | None | 0 0
  1. term.write("Tunnel Length: ")
  2. tunnelLength = read()
  3. term.write("# of tunnels: ")
  4. tunnels = read()
  5.  
  6. function mine()
  7.     local a,v=turtle.inspectUp()
  8.     if v.name ~= "minecraft:stone" then
  9.         turtle.digUp()
  10.     end
  11.     a,v=turtle.inspectDown()
  12.     if v.name ~= "minecraft:stone" then
  13.         turtle.digDown()
  14.     end
  15.     a,v = turtle.inspect()
  16.     if v.name ~= "minecraft:stone" then
  17.         turtle.dig()
  18.     end
  19.     turtle.turnRight()
  20.     a,v = turtle.inspect()
  21.     if v.name ~= "minecraft:stone" then
  22.         turtle.dig()
  23.     end
  24.     turtle.turnRight()
  25.     a,v = turtle.inspect()
  26.     if v.name ~= "minecraft:stone" then
  27.         turtle.dig()
  28.     end
  29.     turtle.turnRight()
  30.     a,v = turtle.inspect()
  31.     if v.name ~= "minecraft:stone" then
  32.         turtle.dig()
  33.     end
  34.     turtle.turnRight()
  35. end
  36.  
  37. function dig()
  38.     while turtle.detect() do
  39.         turtle.dig()
  40.         os.sleep(0.5)
  41.     end
  42.     turtle.forward()
  43.     mine()
  44.     while turtle.detectUp() do
  45.         turtle.digUp()
  46.         os.sleep(0.5)
  47.     end
  48.     turtle.up()
  49.     mine()
  50.     turtle.down()
  51.     if turtle.detectDown() then
  52.         turtle.digDown()
  53.     end
  54.     turtle.down()
  55.     mine()
  56.     turtle.up()
  57. end
  58.  
  59. function unload()
  60.     for i=1,16 do
  61.         turtle.select(i)
  62.         turtle.drop()
  63.     end
  64. end
  65.  
  66. for i = 1, tunnels do
  67.     for j = 1, tunnelLength do
  68.         dig()
  69.     end
  70.  
  71.     turtle.turnRight()
  72.     turtle.turnRight()
  73.  
  74.     for k = 1, tunnelLength do
  75.         turtle.forward()
  76.     end
  77.  
  78.     turtle.turnRight()
  79.  
  80.     local distance = 2*(i-1)
  81.  
  82.     for l=1, distance do
  83.         turtle.forward()
  84.     end
  85.     unload()
  86.     turtle.turnRight()
  87.     turtle.turnRight()
  88.  
  89.     for m=1, distance do
  90.         turtle.forward()
  91.     end
  92.  
  93.     for n=1, 2 do
  94.         while turtle.detect() do
  95.             turtle.dig()
  96.             os.sleep(0.5)
  97.         end
  98.         turtle.forward()
  99.         turtle.digUp()
  100.         turtle.digDown()
  101.     end
  102.     turtle.turnLeft()
  103. end
  104.  
  105. turtle.turnLeft()
  106. for i=1,2*tunnels do
  107.     turtle.forward()
  108. end
  109. unload()
  110. print("DONE!!! WOOOOOO!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement