Add non-blocking request_to_regenerate methods
Posted: Sun Feb 06, 2022 8:34 am
The most straightforward way to regenerate entities and decoratives after tile replacement is to use LuaSurface :: regenerate_entity and LuaSurface :: regenerate_decorative. The problem with both of these functions is that they block further script execution until they are completed.
While those functions appear to be capable of using multiple threads when given an array of chunks to process, it's cumbersome to do so if the tile replacement is being done inside an on_chunk_generated handler. When those functions are called on single chunks, the multithreaded capability of those functions is presumably wasted.
My proposal is to add the following:
While those functions appear to be capable of using multiple threads when given an array of chunks to process, it's cumbersome to do so if the tile replacement is being done inside an on_chunk_generated handler. When those functions are called on single chunks, the multithreaded capability of those functions is presumably wasted.
My proposal is to add the following:
- LuaSurface :: request_to_regenerate_entity(entities, chunks)
- LuaSurface :: request_to_regenerate_decorative(decoratives, chunks)