LuaSurface::deconstruct_area gets filter parameter or...
Posted: Wed Jun 13, 2018 4:43 pm
LuaSurface::deconstruct_area should get filter parameter or LuaItemStack should get deconstruct_area function.
The deconstruction planner with its entity filters is a really useful tool. It would be nice to use that tool in scripts rather than having to reinvent it by manually scanning a surface and applying our own filter code.
To this end, the existing LuaSurface::deconstruct_area function should get an optional filter parameter that must be a deconstruction planner, and if it gets one it applies the item filter in that planner. Alternatively, LuaItemStack can get a deconstruct_area function akin to the already existing build_blueprint function that will act similarly when it's called for a non-deconstruction planner items as build_blueprint acts when called on a non-blueprint items.
For completeness, perhaps LuaSurface::cancel_deconstruct_area should get the same treatment, though it's less useful as you can just blanket cancel everything, then deconstruct again with a different filter.
The deconstruction planner with its entity filters is a really useful tool. It would be nice to use that tool in scripts rather than having to reinvent it by manually scanning a surface and applying our own filter code.
To this end, the existing LuaSurface::deconstruct_area function should get an optional filter parameter that must be a deconstruction planner, and if it gets one it applies the item filter in that planner. Alternatively, LuaItemStack can get a deconstruct_area function akin to the already existing build_blueprint function that will act similarly when it's called for a non-deconstruction planner items as build_blueprint acts when called on a non-blueprint items.
For completeness, perhaps LuaSurface::cancel_deconstruct_area should get the same treatment, though it's less useful as you can just blanket cancel everything, then deconstruct again with a different filter.