Add filter to find_entities_filtered to find only entities with to_be_deconstructed = true
Posted: Sun Mar 22, 2020 2:39 am
Hi,
Issue summary:
I'd like to have a way to find only entities marked for deconstruction.
Details:
Currently to find to-be-deconstructed entities we have to find all entities then iterate them to filter the ones marked for deconstruction:
This is of course slower than it could be.
Use case:
I'm experimenting with creating a mod that temporarily relocates the player to an alternative (but allied) force along with any entities that have construction requests within the player's roboport range. This effectively allows the player to hit a toggle and make his local roboport service the requests in his immediate vicinity despite possibly the nearby stationary network already trying to service those requests.
Related issues:
This request is very similar to the one already fulfilled here (only, for to-be-deconstructed entities instead of to-be-upgraded ones):
viewtopic.php?p=454093
Thank you for your consideration. Nice game BTW
Issue summary:
I'd like to have a way to find only entities marked for deconstruction.
Details:
Currently to find to-be-deconstructed entities we have to find all entities then iterate them to filter the ones marked for deconstruction:
Code: Select all
local entities = surface.find_entities{area=bounds, force=...}
for _, e in pairs(entities) do
if e.to_be_deconstructed() then
...
end
end
Use case:
I'm experimenting with creating a mod that temporarily relocates the player to an alternative (but allied) force along with any entities that have construction requests within the player's roboport range. This effectively allows the player to hit a toggle and make his local roboport service the requests in his immediate vicinity despite possibly the nearby stationary network already trying to service those requests.
Related issues:
This request is very similar to the one already fulfilled here (only, for to-be-deconstructed entities instead of to-be-upgraded ones):
viewtopic.php?p=454093
Thank you for your consideration. Nice game BTW