Minimal reproducible example (control.lua):
Code: Select all
script.on_event({ defines.events.on_entity_settings_pasted },
function(event)
local source = event.source
local source_modules = source and source.get_module_inventory()
if not source_modules then
return
end
local target_requests = source.surface.find_entities_filtered({
area = {
{ source.position.x - 0.01, source.position.y - 0.01 },
{ source.position.x + 0.01, source.position.y + 0.01 }
},
name = "item-request-proxy",
force = source.force
})
for _, request in pairs(target_requests) do
for _, insert in pairs(request.insert_plan) do
for _, inserted_item in pairs(insert.items.in_inventory) do
game.print("Slot " .. inserted_item.stack .. " has " .. insert.id.name)
end
end
end
end)