Filters for selection-tool not working as expected
Posted: Thu Jul 07, 2022 3:06 pm
I've created this selection-tool:
In data-final-fixes.lua, I sort out the names of prototypes I want to ignore and add the renaming names to entity_filters:
The prototype browser shows that the filters have been applied. However, when I select an area with the tool, the selection includes entities that are based on prototypes not mentioned in keys.entity_filters.
I got the expected result when I removed entity_type_filters. I therefore suspect that tool.entity_filters and tool.entity_type_filters are ORed instead of ANDed (the same applies for alt_entity_filters and alt_entity_type_filters). In my opinion, this behavior is unexpected because it makes the filters more general where they should be more precise.
Code: Select all
local tool = {
type = "selection-tool",
name = GCKI.carkey_name,
entity_filter_mode = "whitelist",
entity_type_filters = {"car", "spider-vehicle"},
selection_mode = {"entity-with-owner", "avoid-rolling-stock"},
selection_color = {g = 1},
selection_cursor_box_type = "entity",
}
data:extend({tool})
Code: Select all
local keys = data.raw["selection-tool"][GCKI.carkey_name]
keys.entity_filters = { "name_1", "name_2", "name_3" }
I got the expected result when I removed entity_type_filters. I therefore suspect that tool.entity_filters and tool.entity_type_filters are ORed instead of ANDed (the same applies for alt_entity_filters and alt_entity_type_filters). In my opinion, this behavior is unexpected because it makes the filters more general where they should be more precise.