Advertisement
Spatzenhirn123

DX Mining Front

Nov 4th, 2014
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.69 KB | None | 0 0
  1. --// turtle-slot [1] Item
  2. --// turtle-slot [2] Coal
  3. --// turtle-slot [3] Wireless Modem
  4. -------------------------------------------------------------------------------------------------------------------------
  5. --CODE-------------------------------------------------------------------------------------------------------------------
  6. -------------------------------------------------------------------------------------------------------------------------
  7. --Start height
  8.     local args = {...}
  9.     a = args[1]-1           --Height
  10.     b = args[2]             --Mining Times
  11.     c = a/2
  12.     d = 0           --help
  13.  
  14. --Startcheck: Fuel-------------------------------------------------------------------------------------------------------
  15. function Start()
  16.     while turtle.getFuelLevel()<(2*a+1000) do
  17.                 turtle.select(2)
  18.         turtle.dig()
  19.         turtle.place()
  20.         turtle.suck()
  21.         shell.run("refuel all")
  22.         turtle.select(2)
  23.         turtle.dig()
  24.         end
  25.        
  26.  
  27.         print(" ")
  28.         print("--------------------------------")
  29.         print("Starting Quarry!")
  30.     print("Height: ",a+1)
  31.     print("Times:  ",b)
  32.         print("--------------------------------")
  33. end
  34.  
  35.  
  36.  
  37. --Items to Ender-Chest---------------------------------------------------------------------------------------------------
  38. function Item()
  39.         turtle.dig()
  40.         turtle.select(1)
  41.         turtle.place()
  42.         for i=4,16,1 do
  43.                 turtle.select(i)
  44.                 turtle.drop()
  45.         sleep(0.5)
  46.         end
  47.         turtle.select(1)
  48.         turtle.dig()
  49. end
  50.  
  51.  
  52. --Mining actions---------------------------------------------------------------------------------------------------------
  53. function forward()
  54.     while turtle.forward()==false do
  55.         sleep(0.5)
  56.         turtle.dig()
  57.         attack()
  58.     end
  59. end
  60.  
  61. function up()
  62.     while turtle.up()==false do
  63.         sleep(0.5)
  64.         attackUp()
  65.     end
  66. end
  67.  
  68. function down()
  69.     while turtle.down()==false do
  70.         sleep(0.5)
  71.         turtle.digDown()
  72.         attackDown()
  73.     end
  74. end
  75.  
  76. --Attack actions---------------------------------------------------------------------------------------------------------
  77. function attack()
  78.     turtle.select(3)
  79.     turtle.equipLeft()
  80.     turtle.attack()
  81.     turtle.equipLeft()
  82. end
  83.    
  84. function attackUp()
  85.     turtle.select(3)
  86.     turtle.equipLeft()
  87.     turtle.attackUp()
  88.     turtle.equipLeft()
  89. end
  90.  
  91. function attackDown()
  92.     turtle.select(3)
  93.     turtle.equipLeft()
  94.     turtle.attackDown()
  95.     turtle.equipLeft()
  96. end
  97.  
  98.  
  99. --Mining Forms-----------------------------------------------------------------------------------------------------------
  100. function Mine()
  101.     Start()
  102.     turtle.digDown()
  103.     turtle.turnRight()
  104.     turtle.dig()
  105.     turtle.turnLeft()
  106.     turtle.dig()
  107.     turtle.turnLeft()
  108.     turtle.dig()
  109.     for o=1,c,1 do
  110.         turtle.digDown()
  111.         down()
  112.         turtle.dig()
  113.         turtle.turnRight()
  114.         turtle.dig()
  115.         turtle.turnRight()
  116.         turtle.dig()
  117.         turtle.digDown()
  118.         down()
  119.         turtle.dig()
  120.         turtle.turnLeft()
  121.         turtle.dig()
  122.         turtle.turnLeft()
  123.         turtle.dig()
  124.     end
  125.     turtle.digDown()
  126.     turtle.down()
  127.     if turtle.down()==true then
  128.         d=1
  129.     end
  130.     turtle.dig()
  131.     turtle.turnRight()
  132.     turtle.dig()
  133.     turtle.turnRight()
  134.     turtle.dig()
  135.     turtle.turnLeft()
  136.     if d==1 then
  137.         up()
  138.     end
  139.     for p=1,c*2,1 do
  140.         up()
  141.     end
  142.     Item()
  143. end
  144.  
  145. function Next()
  146.     up()
  147.     for i=1,16,1 do
  148.         while turtle.forward()==false do
  149.             sleep(1)
  150.         end
  151.     end
  152.     down()
  153. end
  154.  
  155. -------------------------------------------------------------------------------------------------------------------------
  156. --Actions----------------------------------------------------------------------------------------------------------------
  157. -------------------------------------------------------------------------------------------------------------------------
  158. for t=1,b,1 do
  159.     Mine()
  160.     Next()
  161. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement