Advertisement
cyber_Ahn

Ficsit-Networks-Simple_Production_Controll

Oct 30th, 2022 (edited)
1,051
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.90 KB | None | 0 0
  1. Name = "SEED_PC"
  2. ----------------------get-hardware---------------------------------
  3. local NetworkCard = computer.getPCIDevices(findClass("NetworkCard"))[1]
  4. local storage = component.proxy(component.findComponent("seed_con"))
  5. local switch = component.proxy(component.findComponent("seed_switch"))
  6.  
  7. local var_x = 100
  8. local var_running = "start"
  9.  
  10. while true do
  11.     event.pull(3)
  12.     var_running = "start"
  13.     for i=1, #storage do
  14.         lines = i
  15.         inv = storage[i]:getInventories()[1]
  16.         inv:sort()
  17.         amount = inv.itemCount
  18.         itemName = "Empty"
  19.         max = 0
  20.         if amount > 1 then
  21.             max = inv:getStack(0).count * inv.size
  22.             itemName = inv:getStack(0).item.type.name
  23.             if amount > (max-var_x) then
  24.                 var_running = "stop"
  25.             end
  26.         end
  27.     end
  28.     for i=1, #switch do
  29.         if var_running == "stop" then
  30.             switch[i].isSwitchOn = false
  31.         else
  32.             switch[i].isSwitchOn = true
  33.         end
  34.     end
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement