Code: Select all
local count = player.surface.count_entities_filtered{area=DEFINED_AREA, type="assembling-machine"}
if count >= 1 then
for _, entity in pairs(player.surface.find_entities_filtered{area=DEFINED_AREA, type="assembling-machine"}) do
local item_input = {}
local item_output = {}
for content, amount in pairs(entity.get_inventory(defines.inventory.assembling_machine_output).get_contents()) do
item_output = MY_FUNCTION(content, amount)
end
for content, amount in pairs(entity.get_inventory(defines.inventory.assembling_machine_input).get_contents()) do
item_input = MY_FUNCTION(content, amount)
end
end
end