From ff799196edc889ed0066bf74af41795d57d93427 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 9 May 2026 21:53:47 +0900 Subject: [PATCH] . --- PHI-CL/control/combinator.lua | 46 +++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/PHI-CL/control/combinator.lua b/PHI-CL/control/combinator.lua index a67a6eb..7e61a3d 100644 --- a/PHI-CL/control/combinator.lua +++ b/PHI-CL/control/combinator.lua @@ -38,28 +38,42 @@ function main.gui_create(player) end function main.gui_update(player, entity) - if entity.valid and entity.type and entity.type == 'constant-combinator' and entity.name == 'super-combinator' then - local circuit_oc = player.opened.get_or_create_control_behavior() + if not entity.valid then + return + end - if circuit_oc and circuit_oc.sections_count and circuit_oc.sections_count == 0 then - circuit_oc.add_section() - end + if not entity.type then + return + end - circuit_oc = circuit_oc.sections[1] - local cs1 = circuit_oc.get_slot(1) + if entity.type ~= 'constant-combinator' then + return + end - if not cs1 or not cs1.value or not cs1.value.name or cs1.value.name ~= 'signal-SA' then - return - end + if entity.name ~= 'super-combinator' then + return + end - local val = cs1.min or 0 + local circuit_oc = player.opened.get_or_create_control_behavior() - if player.gui.relative.phi_cl_combinator_config and player.gui.relative.phi_cl_combinator_config['default'] and player.gui.relative.phi_cl_combinator_config['default']['table_research_queue'] then - local dropdown = player.gui.relative.phi_cl_combinator_config['default']['table_research_queue']['research_queue_dropdown'] + if circuit_oc and circuit_oc.sections_count and circuit_oc.sections_count == 0 then + circuit_oc.add_section() + end - if dropdown then - dropdown.selected_index = ((val < 0 or val > 3) and 1) or (val + 1) - end + circuit_oc = circuit_oc.sections[1] + local cs1 = circuit_oc.get_slot(1) + + if not cs1 or not cs1.value or not cs1.value.name or cs1.value.name ~= 'signal-SA' then + return + end + + local val = cs1.min or 0 + + if player.gui.relative.phi_cl_combinator_config and player.gui.relative.phi_cl_combinator_config['default'] and player.gui.relative.phi_cl_combinator_config['default']['table_research_queue'] then + local dropdown = player.gui.relative.phi_cl_combinator_config['default']['table_research_queue']['research_queue_dropdown'] + + if dropdown then + dropdown.selected_index = ((val < 0 or val > 3) and 1) or (val + 1) end end end