luaSurface:*_entities_filtered check for not_on_map flag
Posted: Sun Apr 30, 2017 2:52 am
Humbly requesting that find/count_entities_filtered have an additional optional parameter exclude_not_on_map = boolean
When true the array of entities returned would not contain any entities with the not-on-map flag.
When false or nil no affect.
Hmmm seems entity and tile ghost are flagged as not-on-map so this might not help too much
Use Case:
Nanobots does a find_entities_filtered search. The area it checks is relativly small and in most cases completes very quickly However in areas with lots of smoke/fire (steam engine arrays etc) There is a a LOT more stuff to check.
Using a limit won't work If all the find returns is smoke then I won't have a list of entities I am looking for.
Using a force won't work as I scan for stuff marked for deconstruction and somethings don't have a force (trees/rocks etc)
Doing an entity.has_flag check does give me some substantial performance improvements. However I think this could be even more greatly improved if the data returned was even smaller.
Alternatively being able to filter on flags in general would be awesome include_flags={} if present only include entities with these flags, and exlude_flags={} if present exclude entities with these flags
Thank you for looking into this and letting me know your thoughts!
When true the array of entities returned would not contain any entities with the not-on-map flag.
When false or nil no affect.
Hmmm seems entity and tile ghost are flagged as not-on-map so this might not help too much
Use Case:
Nanobots does a find_entities_filtered search. The area it checks is relativly small and in most cases completes very quickly However in areas with lots of smoke/fire (steam engine arrays etc) There is a a LOT more stuff to check.
Using a limit won't work If all the find returns is smoke then I won't have a list of entities I am looking for.
Using a force won't work as I scan for stuff marked for deconstruction and somethings don't have a force (trees/rocks etc)
Doing an entity.has_flag check does give me some substantial performance improvements. However I think this could be even more greatly improved if the data returned was even smaller.
Alternatively being able to filter on flags in general would be awesome include_flags={} if present only include entities with these flags, and exlude_flags={} if present exclude entities with these flags
Thank you for looking into this and letting me know your thoughts!