Filtered deconstruction

Place to get help with not working mods / modding interface.
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3749
Joined: Tue May 13, 2014 11:06 am
Contact:

Filtered deconstruction

Post by DaveMcW »

I have a filtered deconstruction planner. What command can I use to apply that filter to an area?
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Filtered deconstruction

Post by eradicator »

Without actually selecting an area?

From a quick look at the doc it looks like you'd have to do it manually. I.e. read filters from stack, find_entities_filtered, deconstruct one-by-one.
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: Filtered deconstruction

Post by Nexela »

Closest solution will be an API requirest on surface.deconstruct_area{area=…, force=…, player=…} to allow passing entity/tile filters and settings (which can be retrieved from an item stack)
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Filtered deconstruction

Post by eradicator »

Nexela wrote:Closest solution will be an API requirest on surface.deconstruct_area{area=…, force=…, player=…} to allow passing entity/tile filters and settings (which can be retrieved from an item stack)
The documentation on LuaSurface.deconstruct_area has no mention whatsoever of any filtering capability at all.
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: Filtered deconstruction

Post by Nexela »

Like I said an API request :P
quyxkh
Smart Inserter
Smart Inserter
Posts: 1032
Joined: Sun May 08, 2016 9:01 am
Contact:

Re: Filtered deconstruction

Post by quyxkh »

I suppose you could also hook on_marked_for_deconstruction, deconstruct the whole area and cancel_deconstruction() for anything that fails the filters.
Post Reply

Return to “Modding help”