From 8880eb6a57596916fe2769e737cdf773c1cb655d Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 24 Feb 2025 18:52:54 +0900 Subject: [PATCH] . --- exp_legacy/module/modules/control/vlayer.lua | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 754608f7..9d1db5b9 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -512,23 +512,17 @@ local function handle_circuit_power_load() for _, v in pairs(spawn_pole) do local e = game.surfaces[1].find_entity(v.n, v.p) - if e and e.valid and e.is_connected_to_electric_network() and e.electric_network_id and not processed[e.electric_network_id] then + if e and e.valid and e.is_connected_to_electric_network() and e.electric_network_id and (not processed[e.electric_network_id]) then local ens = e.electric_network_statistics - local ensi = 0 - local enso = 0 for _, c in pairs(ens.input_counts) do - ensi = ensi + c + pi = pi + c end for _, c in pairs(ens.output_counts) do - enso = enso + c + po = po + c end - processed[e.electric_network_id] = { i = ensi, o = enso } + processed[e.electric_network_id] = true end end - for _, v in pairs(processed) do - pi = pi + v.i - po = po + v.o - end return (pi * 10000 / po) or 0 end