-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Query filter for component value rather than component existence #5639
Copy link
Copy link
Open
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-FeatureA new feature, making something new possibleA new feature, making something new possibleD-ComplexQuite challenging from either a design or technical perspective. Ask for help!Quite challenging from either a design or technical perspective. Ask for help!X-Needs-SMEThis type of work requires an SME to approve it.This type of work requires an SME to approve it.
Metadata
Metadata
Assignees
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-FeatureA new feature, making something new possibleA new feature, making something new possibleD-ComplexQuite challenging from either a design or technical perspective. Ask for help!Quite challenging from either a design or technical perspective. Ask for help!X-Needs-SMEThis type of work requires an SME to approve it.This type of work requires an SME to approve it.
What problem does this solve or what need does it fill?
I'm working on a game that uses a lot of different 'status effects'. These status effects are presently implemented on each character as an inserted/removed component, but I am interested in exploring these with always-inserted bool fields instead (akin to
Visibility). The main issue I have is that I won't be able to filter out entities as easily as I can presently (like finding all poisoned entities by usingWith<Poisoned>).What solution would you like?
UPDATE: Working proof of concept: https://crates.io/crates/bevy_mod_check_filter
A Query Filter pair akin to
With/Without, that instead of checking for component existence, checks for component value. Given we don't have full const generics yet, this should probably be limited totrue/falsefor simplicity. Alternatively, the current value could be compared to theDefaultvalue.The name for these filters? Unsure. Maybe
Truthy/FalseyorEnabled/Disabled?Illustration
Today:
New query filter (see how we don't lose the ergonomics of marker components?):
What alternative(s) have you considered?
Filtering the way that the
Visibilitystruct does presently. It's not the best ergonomics, though.Additional context
Related to the discussion found in #3796.