From 3b9328e1ce6c436c242d60e83bfb9ee2f88d6f87 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 9 May 2026 00:52:54 +0900 Subject: [PATCH] . --- PHI-CL/control/cargo-landing.lua | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/PHI-CL/control/cargo-landing.lua b/PHI-CL/control/cargo-landing.lua index a7a62ce..ab26b3b 100644 --- a/PHI-CL/control/cargo-landing.lua +++ b/PHI-CL/control/cargo-landing.lua @@ -1,16 +1,12 @@ local main = {} function main.build(event) - if event.entity.type == 'proxy-container' then - if event.entity.name ~= 'proxy-cargo-landing-chest' then - return - end - + if event.entity.type == 'proxy-container' and event.entity.name == 'proxy-cargo-landing-chest' then if not prototypes.entity['cargo-landing-pad'] then return end - local ec = game.surfaces[event.entity.surface].find_entities_filtered{type='cargo-landing-pad'} + local ec = event.entity.surface.find_entities_filtered{type = 'cargo-landing-pad', name = 'cargo-landing-pad'} if not ec then return @@ -19,22 +15,18 @@ function main.build(event) event.entity.proxy_target_entity = ec[1] event.entity.proxy_target_inventory = defines.inventory.cargo_landing_pad_main - elseif event.entity.type == 'cargo-landing-pad' then - if event.entity.name ~= 'cargo-landing-pad' then - return - end - + elseif event.entity.type == 'cargo-landing-pad' and event.entity.name == 'cargo-landing-pad' then if not prototypes.entity['proxy-cargo-landing-chest'] then return end - local ec = game.surfaces[event.entity.surface].find_entities_filtered{type='cargo-landing-pad'} + local ec = event.entity.surface.find_entities_filtered{type = 'cargo-landing-pad', name = 'cargo-landing-pad'} - if #ec > 1 then + if ec and #ec > 1 then return end - local ep = game.surfaces[event.entity.surface].find_entities_filtered{type='proxy-container', name='proxy-cargo-landing-chest'} + local ep = event.entity.surface.find_entities_filtered{type = 'proxy-container', name = 'proxy-cargo-landing-chest'} if not ep then return