cyber_Ahn

Ficsit-Networks-Simple_Production_Controll

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