A new option for LuaSurface.count_tiles_filtered{} that returns a list of counts by tile type in addition to the total count.
Details
For example LuaSurface.count_tiles_filtered{area=area,get_statistics=true} should return the total count as it does now but have a table as second return value:
Code: Select all
{
['grass-1'] = 411,
['sand-2'] = 95,
['water'] = 1254,
}
a) Adapting newly placed tiles to their surroundings.
b) Modding machines that do different things depending on where they are placed. E.g. a ground extractor that extracts dirt, sand, rock etc depending on where it is placed. (i.e. an reskinned assembler with forced recipe.) or wind-turbines that work better near water, etc...
Why?
Currently the only way to get these numbers is to either call find_tiles_filtered and do the count myself, or to loop game.tile_prototypes and call count_tiles_filtered for each name. If count_tiles_filtered could directly return the numbers there would be less overhead.