From 939d9e3cb650db7a04fd5b5239b39f03ee54dc09 Mon Sep 17 00:00:00 2001 From: Wyrrrd Date: Sat, 17 Apr 2021 09:05:58 +0200 Subject: [PATCH] Limited pickup/drop to object-layer and not-decontructing --- control.lua | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/control.lua b/control.lua index 3f9614c..80e0bdc 100644 --- a/control.lua +++ b/control.lua @@ -136,8 +136,24 @@ local function on_built_entity(event) if inserter and inserter.valid and (inserter.type == "inserter") then if inserter.filter_slot_count then if is_filter_empty(inserter) and inserter.inserter_filter_mode == "whitelist" then - local pickup = inserter.surface.find_entities_filtered({position = inserter.pickup_position, force = inserter.force, surface = inserter.surface, limit = 1}) - local drop = inserter.surface.find_entities_filtered({position = inserter.drop_position, force = inserter.force, surface = inserter.surface, limit = 1}) + -- Read pickup and drop position entity + local pickup = inserter.surface.find_entities_filtered({ + position = inserter.pickup_position, + force = inserter.force, + surface = inserter.surface, + collision_mask_layer= "object-layer", + to_be_deconstructed = false, + limit = 1 + }) + local drop = inserter.surface.find_entities_filtered({ + position = inserter.drop_position, + force = inserter.force, + surface = inserter.surface, + collision_mask= "object-layer", + to_be_deconstructed = false, + limit = 1 + }) + if pickup[1] and pickup[1].valid then -- Prequisites local inventory_pickup = pickup[1].get_output_inventory()