I'm not sure how to get this resolved! Can someone please take a look and see if they know why.
Code below and mod attached.
Line 143 is the "items = collector.surface.find_entities_"
Code: Select all
function ProcessCollector(collector)
--This makes collectors collect items.
writeDebug("mod looking for items")
local items
local inventory
items = collector.surface.find_entities_filtered({area = {{x = collector.position.x - radius, y = collector.position.y - radius}, {x = collector.position.x + radius, y = collector.position.y + radius}}, name = "item-on-ground"})
if #items > 0 then
inventory = collector.get_inventory(chestInventoryIndex)
for i=1,#items do
local stack = items[i].stack
--print(stack.name)
if filters[stack.name] == 1 and inventory.can_insert(stack) then
inventory.insert(stack)
items[i].destroy()
break
end
end
end
end