find_entities_filtered: item_name filter

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

find_entities_filtered: item_name filter

Post by aubergine18 »

If I want to search the surface for a specific kind of 'item-on-ground' itemEntity, I currently have to manually filter the results of surface.find_entities_filtered() which, as you can imagine, can be a big list of results depending on the area constraints, etc.

( Some background on why I'm trying to do this: viewtopic.php?f=25&t=33935 )

It's going to be much faster if this filtration is done in C.

Would it be possible to get a new additional filter parameter `item_name = "..."` which, if a matching entity is type `item-entity` it will check that <found>.stack.name == item_name

Also: would want same filter available for `count_entities_filtered()`

EDIT: Rather than adding complexity to existing functions, maybe new function specific to getting/counting item entities could be added?
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
Post Reply

Return to “Modding interface requests”