Advertisement
FeyMen

ROB

Feb 7th, 2025 (edited)
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.83 KB | None | 0 0
  1. --------------------------------------------------------------------
  2. --IC2:reactorVentDiamond - Алмазный теплоотвод (27)
  3. --IC2:reactorHeatSwitchSpread - Компонентный теплообменник (8)
  4. --IC2:reactorVentSpread - Компонентный теплоотвод (4)
  5. --IC2:reactorUraniumDual - Сдвоенный топливный стержень (Уран) (15)
  6. --------------------------------------------------------------------
  7. local sides = require "sides"
  8. local robot = require "robot"
  9. local component = require "component"
  10. local inv = component.inventory_controller  -- Контроллер инвентаря
  11.  
  12. -- Массивы для хранения слотов с предметами
  13. local VentDiamondArray = {}
  14. local HeatSwitchDiamondArray = {}
  15. local VentSpreadArray = {}
  16. local UraniumDualArray = {}
  17.  
  18. -- Счётчики
  19. local VentDiamondCount = 1
  20. local HeatSwitchDiamondCount = 1
  21. local VentSpreadCount = 1
  22. local UraniumDualCount = 1
  23.  
  24. -- Сортировка предметов в инвентаре
  25. for i = 1, 64 do
  26.     robot.select(i)
  27.     local ActiveItem = inv.getStackInInternalSlot()
  28.     if ActiveItem ~= nil then
  29.         if ActiveItem.name == "IC2:reactorVentDiamond" then
  30.             VentDiamondArray[VentDiamondCount] = i
  31.             VentDiamondCount = VentDiamondCount + 1
  32.         elseif ActiveItem.name == "IC2:reactorHeatSwitchSpread" then
  33.             HeatSwitchDiamondArray[HeatSwitchDiamondCount] = i
  34.             HeatSwitchDiamondCount = HeatSwitchDiamondCount + 1
  35.         elseif ActiveItem.name == "IC2:reactorVentSpread" then
  36.             VentSpreadArray[VentSpreadCount] = i
  37.             VentSpreadCount = VentSpreadCount + 1
  38.         elseif ActiveItem.name == "IC2:reactorUraniumDual" then
  39.             UraniumDualArray[UraniumDualCount] = i
  40.             UraniumDualCount = UraniumDualCount + 1
  41.         end
  42.     end
  43. end
  44.  
  45. -- Размещение компонентов в нужных слотах
  46. VentDiamondCount = 1
  47. HeatSwitchDiamondCount = 1
  48. VentSpreadCount = 1
  49. UraniumDualCount = 1
  50.  
  51. for BeginSlot = 1, 54 do
  52.     if BeginSlot % 2 == 0 then
  53.         -- Установка алмазных теплоотводов
  54.         if VentDiamondArray[VentDiamondCount] then
  55.             robot.select(VentDiamondArray[VentDiamondCount])
  56.             robot.drop(1)
  57.             VentDiamondCount = VentDiamondCount + 1
  58.         end
  59.     end
  60.    
  61.     if BeginSlot == 11 or BeginSlot == 17 or BeginSlot == 29 or BeginSlot == 31 or BeginSlot == 33 or BeginSlot == 35 or BeginSlot == 47 or BeginSlot == 53 then
  62.         -- Установка продвинутых теплообменников
  63.         if HeatSwitchDiamondArray[HeatSwitchDiamondCount] then
  64.             robot.select(HeatSwitchDiamondArray[HeatSwitchDiamondCount])
  65.             robot.drop(1)
  66.             HeatSwitchDiamondCount = HeatSwitchDiamondCount + 1
  67.         end
  68.     end
  69.    
  70.     if BeginSlot == 13 or BeginSlot == 15 or BeginSlot == 49 or BeginSlot == 51 then
  71.         -- Установка компонентных теплоотводов
  72.         if VentSpreadArray[VentSpreadCount] then
  73.             robot.select(VentSpreadArray[VentSpreadCount])
  74.             robot.drop(1)
  75.             VentSpreadCount = VentSpreadCount + 1
  76.         end
  77.     end
  78.    
  79.     if BeginSlot == 1 or BeginSlot == 3 or BeginSlot == 5 or BeginSlot == 7 or BeginSlot == 9 or BeginSlot == 19 or BeginSlot == 21 or BeginSlot == 23 or BeginSlot == 25 or BeginSlot == 27 or BeginSlot == 37 or BeginSlot == 39 or BeginSlot == 41 or BeginSlot == 43 or BeginSlot == 45 then
  80.         -- Установка урановых стержней
  81.         if UraniumDualArray[UraniumDualCount] then
  82.             robot.select(UraniumDualArray[UraniumDualCount])
  83.             robot.drop(1)
  84.             UraniumDualCount = UraniumDualCount + 1
  85.         end
  86.     end
  87. end
  88.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement