You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What problem does this solve or what need does it fill?
A common pattern is to use Option<&C> query parameters, then check if it's .is_some.
Unfortunately, this is slightly more verbose than needed (and the intent is less clear). More critically, it pointlessly locks the resource to a higher permissions level than needed.
What solution would you like?
Add a Has<C: Component> query parameter, which returns true if the entity has the particular component. This does not require any read permissions, as components cannot be changed during the execution of a parallel stage.
What alternative(s) have you considered?
Use the existing strategy.
Additional context
Idea blatantly borrowed from @Ralith's HECS, where it is called Satisfies, and can also be used to check whether an entity matches a given query. We don't need that particular bit of functionality: if anything, a simple Query::contains(entity) method would work well (but should be a seperate PR). See #3089 for that issue.
A Not query parameter, used for this and query filters, might be helpful for clarity but is not essential.
The text was updated successfully, but these errors were encountered:
Option<With> and then calling .is_some() is the same behaviour as Has isnt it?
Yes, but the intent to the reader is dramatically less clear. I don't think I've ever seen With<T> being used in a non-filtering position (and had to verify that this in fact works).
Another "problem" with Option<With<T>> is, that the Some(false) will never occur, because either the Entity has it (Some(true)) or it doesn't (None). #2665 (comment)
What problem does this solve or what need does it fill?
A common pattern is to use
Option<&C>
query parameters, then check if it's.is_some
.Unfortunately, this is slightly more verbose than needed (and the intent is less clear). More critically, it pointlessly locks the resource to a higher permissions level than needed.
What solution would you like?
Add a
Has<C: Component>
query parameter, which returns true if the entity has the particular component. This does not require any read permissions, as components cannot be changed during the execution of a parallel stage.What alternative(s) have you considered?
Use the existing strategy.
Additional context
Idea blatantly borrowed from @Ralith's HECS, where it is called
Satisfies
, and can also be used to check whether an entity matches a given query. We don't need that particular bit of functionality: if anything, a simpleQuery::contains(entity)
method would work well (but should be a seperate PR). See #3089 for that issue.A
Not
query parameter, used for this and query filters, might be helpful for clarity but is not essential.The text was updated successfully, but these errors were encountered: