Advertisement
M0n5t3r

SuperMinerBot

Jul 5th, 2014
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.56 KB | None | 0 0
  1. -- Start
  2.  
  3. term.write("Insert length: ")
  4. steps = tonumber(read())
  5. print(" ")
  6.  
  7. term.write("Insert width: ")
  8. width = tonumber(read())
  9. print(" ")
  10.  
  11.  
  12. -- Important stuff
  13.  
  14. steps = steps or 1
  15. width = width or 0
  16. local second = 0
  17. local fuelslot = 1
  18. local torchslot = 2
  19. local chestslot = 3
  20. local dirtslot = 4
  21. local torch = 0
  22. local chest = 0
  23. local fuellevel = turtle.getFuelLevel()
  24.  
  25.  
  26.  
  27.  
  28. -- function DIGBLOCK
  29.  
  30.     function digBlock()
  31.             repeat
  32.                     turtle.dig()
  33.                     sleep(0.5)
  34.             until not turtle.detect() == true
  35.     end
  36.  
  37.    
  38.  -- Required
  39.  
  40.     function refuel()
  41.         if turtle.getFuelLevel() < 800 then
  42.             turtle.select(1)
  43.                     repeat
  44.                             turtle.refuel(1)
  45.                             sleep(0.5)
  46.                     until turtle.getFuelLevel() > 1600
  47.             turtle.select(5)
  48.         end
  49.     end
  50.    
  51.     function Chestre()
  52.         if turtle.getItemCount(chestslot) < 2 then
  53.             turtle.select(chestslot)
  54.                 repeat
  55.                         turtle.getItemCount(chestslot)
  56.                         sleep(0.5)
  57.                 until turtle.getItemCount(chestslot) >= 10
  58.             turtle.select(5)
  59.         end
  60.     end
  61.    
  62.  
  63.     function Torchre()
  64.         if turtle.getItemCount(torchslot) < 2 then
  65.             turtle.select(torchslot)
  66.                 repeat
  67.                         turtle.getItemCount(torchslot)
  68.                         sleep(0.5)
  69.                 until turtle.getItemCount(torchslot) >= 20
  70.             turtle.select(5)
  71.         end
  72.     end
  73.  
  74.  
  75.  
  76. -- Begin Digging
  77.  
  78. print("Lets GO!")  
  79. repeat     
  80.  
  81.                     refuel()
  82.                     Chestre()
  83.                     Torchre()
  84. turtle.placeDown()
  85.     repeat
  86.     turtle.digUp()
  87.     sleep(0.3)
  88.     until turtle.up() == true
  89.     repeat
  90.     turtle.digUp()
  91.     sleep(0.3)
  92.     until turtle.up() == true      
  93. turtle.turnLeft()
  94. turtle.dig()
  95. turtle.turnRight()
  96. turtle.turnRight()
  97. turtle.dig()
  98. turtle.down()
  99. turtle.dig()
  100. turtle.turnLeft()
  101. turtle.turnLeft()
  102. turtle.dig()
  103. turtle.down()
  104. digBlock()
  105. turtle.turnRight()
  106. turtle.turnRight()
  107. digBlock()
  108. turtle.turnLeft()
  109.      
  110.             for i = 1, steps do
  111.                     refuel()
  112.                     Chestre()
  113.                     Torchre()
  114.                     digBlock()
  115.                     turtle.forward()
  116.                     turtle.select(dirtslot)
  117.                     turtle.placeDown()
  118.                     repeat
  119.                             turtle.digUp()
  120.                             sleep(0.3)
  121.                     until turtle.up() == true
  122.                     repeat
  123.                             turtle.digUp()
  124.                             sleep(0.3)
  125.                     until turtle.up() == true
  126.                     turtle.turnLeft()
  127.                     turtle.dig()
  128.                     turtle.turnRight()
  129.                     turtle.turnRight()
  130.                     turtle.dig()
  131.                     turtle.down()
  132.                     turtle.dig()
  133.                     turtle.turnLeft()
  134.                     turtle.turnLeft()
  135.                     turtle.dig()
  136.                     turtle.down()
  137.                     digBlock()
  138.                     turtle.turnRight()
  139.                     turtle.turnRight()
  140.                     digBlock()
  141.                     turtle.turnLeft()
  142.                     torch = torch + 1
  143.                     if torch == 10 then
  144.                             turtle.turnLeft()
  145.                             turtle.turnLeft()
  146.                             turtle.select(torchslot)
  147.                             turtle.place()
  148.                             turtle.turnLeft()
  149.                             turtle.turnLeft()
  150.                             turtle.forward()
  151.                             turtle.select(5)
  152.                             torch = 0
  153.                     end
  154.                             chest = chest + 1
  155.                     if chest == 30 then
  156.                             turtle.turnLeft()
  157.                             turtle.select(chestslot)
  158.                             turtle.place()
  159.                             for q=5,16 do turtle.select(q) turtle.drop() end
  160.                             turtle.turnRight()
  161.                             turtle.select(5)
  162.                             chest = 0
  163.                                     end
  164.  
  165.             -- Return
  166.  
  167.                                 end
  168.                                 turtle.turnLeft()
  169.                                 turtle.turnLeft()
  170.                                 turtle.up()
  171.                                 for i = 1, steps do
  172.                                         turtle.forward()
  173.                                 end
  174.  
  175.             -- With
  176.  
  177.             if width >= 1 then
  178.                     turtle.turnLeft()
  179.                     turtle.digDown()
  180.                     turtle.down()
  181.                             refuel()
  182.                             digBlock()
  183.                             turtle.forward()
  184.                             turtle.select(4)
  185.                             turtle.placeDown()
  186.                            
  187.                             digBlock()
  188.                             turtle.forward()
  189.                            
  190.                     digBlock()
  191.                     turtle.forward()
  192.                     turtle.turnLeft()
  193.                 width = width - 1
  194.             end
  195.        
  196.        
  197. until width == 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement