From 3877e977e08465a669bb329e26a807a196abc574 Mon Sep 17 00:00:00 2001 From: wolfcomp <4028289+wolfcomp@users.noreply.github.com> Date: Fri, 10 Oct 2025 07:03:13 +0200 Subject: [PATCH] Refactor entity processing for selected area --- script/entity_processor.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/script/entity_processor.lua b/script/entity_processor.lua index a88e616..12ed171 100644 --- a/script/entity_processor.lua +++ b/script/entity_processor.lua @@ -360,6 +360,7 @@ end) script.on_event(ev.on_player_selected_area, function(event) if event.item ~= "ctron-selection-tool" then return end local surface_index = event.surface.index + local force = game.players[event.player_index].force for _, entity in pairs(event.entities) do if entity and entity.valid then if entity.type == 'entity-ghost' or entity.type == 'tile-ghost' or entity.type == 'item-request-proxy' then @@ -367,8 +368,10 @@ script.on_event(ev.on_player_selected_area, function(event) end end end - for _, entity in pairs(event.surface.find_entities_filtered{area=event.area, type='item-request-proxy'}) do - entity_proc.create_chunk(entity, storage.construction_queue[surface_index], surface_index, true) + for _, entity in pairs(event.surface.find_entities_filtered{area=event.area, force=force}) do + if entity.type == 'item-request-proxy' or entity.to_be_upgraded() then + entity_proc.create_chunk(entity, storage.construction_queue[surface_index], surface_index, true) + end end end)