Advertisement
Solomeister

lumberbot v0.4bigTree

Aug 8th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.80 KB | None | 0 0
  1. local component = require("component")
  2. local computer = require("computer")
  3. local inv = component.inventory_controller
  4. local robot = require("robot")
  5. local term = require("term")
  6.  
  7.  
  8. function resDrop(first) --Дропает предметы из ячейки first до 16 в левую сторону
  9.  
  10.    
  11.     for i = first, 16 do
  12.         robot.select(i)
  13.         robot.dropDown()
  14.     end
  15.    
  16.    
  17.     robot.select(2)
  18. end
  19.  
  20.  
  21. --Основной код
  22. term.clear()
  23. print(" ")
  24. print(" ")
  25. print(" ")
  26. print(" ")
  27. print("            [|||||||||||||||||||||||||||||||||||]")
  28. print("            [|||||||LUMBERBOT V0.5BigTree|||||||]")
  29. print("            [|||||||||||||||||||||||||||||||||||]")
  30. print("            [||||||||||||IN ACTION||||||||||||||]")
  31. print("            [||||||КТО ПРОЧИТАЛ, У ТОГО|||||||||]")
  32. print("            [|||||||||РОДИТСЯ БАБУШКА|||||||||||]")
  33. print("            [|||||||||||||||||||||||||||||||||||]")
  34. while true do  --Цикл до тех пор, пока инструмент не сломается. "Не равно нулю" важно если что, ибо есть состояния nil и "No tool..."
  35.    
  36.     while robot.durability() == 0 do
  37.         computer.beep(2000, 0.1)
  38.         os.sleep(0.2)
  39.     end
  40.    
  41.    
  42.     robot.select(1)
  43.     robot.place()
  44.     robot.select(2)
  45.     inv.equip()
  46.     robot.suckUp()
  47.     for i = 1, 10 do  --Юзать костную муку/мотыгу 10 раз
  48.         robot.use()
  49.     end
  50.    
  51.     inv.equip()
  52.     robot.suckUp()
  53.     while robot.detect() == true do  --Пока перед ним есть твердый блок - рубать.
  54.         robot.swing()
  55.     end
  56.    
  57.     robot.suckUp()
  58.     robot.select(1)
  59.     inv.equip()
  60.     os.sleep(17)
  61.     inv.equip()
  62.     robot.select(2)
  63.     robot.suckUp()
  64.  
  65.    
  66.     robot.suckUp()
  67.     resDrop(4)  --Дропнуть вещи начиная с 5 слота
  68.     robot.suckUp()
  69. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement