Advertisement
sinkir

lua turtle AutoBreakNoFuel

Apr 1st, 2013
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.74 KB | None | 0 0
  1. --   _____
  2. --  |  ___|   _ _ __   ___
  3. --  | |_ | | | | '_ \ / __|
  4. --  |  _|| |_| | | | | (__
  5. --  |_|   \__,_|_| |_|\___|
  6. --
  7.  
  8. left = function()
  9.     return turtle.turnLeft()
  10. end
  11.  
  12. right = function()
  13.     return turtle.turnRight()
  14. end
  15.  
  16.  
  17. select = function(id)
  18.     return turtle.select(id)
  19. end
  20.  
  21. count = function(id)
  22.     return turtle.getItemCount(id)
  23. end
  24.  
  25. move = function(id, nb)
  26.     return turtle.transferTo(id, nb)
  27. end
  28.  
  29. --   _____
  30. --  |  ___|   _ _ __   ___
  31. --  | |_ | | | | '_ \ / __|
  32. --  |  _|| |_| | | | | (__
  33. --  |_|   \__,_|_| |_|\___|
  34. --
  35.  
  36. function init()
  37.     return true
  38. end
  39. function clear_inventory()
  40.     for i = 1,16 do
  41.         if(count(i)>0)then
  42.             turtle.select(i)
  43.             if(turtle.dropDown()==false)then
  44.                 return false
  45.             end
  46.         end
  47.     end
  48.     select(1)
  49.     return true
  50. end
  51.  
  52. --  __  __       _        ____
  53. -- |  \/  | __ _(_)_ __  / /\ \
  54. -- | |\/| |/ _` | | '_ \| |  | |
  55. -- | |  | | (_| | | | | | |  | |
  56. -- |_|  |_|\__,_|_|_| |_| |  | |
  57. --                       \_\/_/
  58.  
  59.  
  60. args = { ... }
  61. if( args[1]==null)then
  62.     args[1] = 16
  63.     --print("Début de 'tree', par defaut, "..args[1].." blocks")
  64. else
  65.     --print("Début de 'tree', "..args[1].." blocks")
  66. end
  67.  
  68. stop=false
  69. if(init()==false) then
  70.     stop=true
  71. end
  72. select(1)
  73. while(stop==false)do
  74.     turtle.suck()
  75.     turtle.suckUp()
  76.     if(turtle.detect() == true)then
  77.         turtle.dig()
  78.        
  79.         turtle.suck()
  80.         turtle.suckUp()
  81.         sleep(3)
  82.         turtle.suck()
  83.         turtle.suckUp()
  84.     else
  85.         sleep(3)
  86.     end
  87.     turtle.turnLeft()
  88.     if(count(1) > 0)then
  89.         if(clear_inventory() == false)then
  90.             print('chest full :(')
  91.             stop = true
  92.         end
  93.     end
  94.     redstone.setOutput("bottom", true)
  95.     sleep(1)
  96.     redstone.setOutput("bottom", false)
  97. end
  98.  
  99.  
  100. print('End')
  101. if(fuel() == 0) then
  102.   --print('Ya plus de coco mon coco !')
  103. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement