Advertisement
Guest User

reactormanager.lua

a guest
Jun 13th, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.94 KB | None | 0 0
  1. local component = require("component")
  2. local component = require("sides")
  3.  
  4. --Variables
  5. reactorslots = 54 -- Number of VISIBLE inventory slots in reactor (i.e. 54 for max sized 6-chamber reactor)
  6. celltype = "60k NaK Coolantcell" -- Label of coolant cell (i.e. "60k Nak Coolantcell")
  7.  
  8. --Do not edit below this line
  9. coolantcells = {}
  10.  
  11.  
  12. function findCoolantCells()
  13.  
  14.   for slot = 1, reactorslots do
  15.     if component.transposer.getStackInSlot(sides.down, slot).label == celltype then
  16.       table.insert(coolantcells, slot)
  17.     end
  18.   end
  19.   print("Found coolant cells in slot(s) " .. table.concat(coolantcells,", "))
  20.  
  21. end
  22.  
  23. function coolantCheck()
  24.  for _, slot in pairs(coolantcells) do
  25.   if component.transposer.getStackInSlot(sides.down, slot).damage > 50 then
  26.     component.transposer.transferItem(sides.down, sides.up, 1, slot, 1)
  27.     print("Removed hot cell from slot " .. slot .. " for cooling.")
  28.   end
  29.  end
  30. end
  31.  
  32. findCoolantCells()
  33.  
  34. while true do
  35.   coolantCheck()
  36. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement