-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Added Has<T> WorldQuery type #8844
Added Has<T> WorldQuery type #8844
Conversation
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I've often wanted this.
Can we have a couple more tests to verify that the accesses are set up correctly? We should be able to do Have + &mut in two queries in the same system.
Perhaps as a doc test: this is a nice property to teach about.
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
… into has-worldquery
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
… into has-worldquery
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A small suggestion to help call out the important property to the reader, but this LGTM now :)
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
@wainwrightmark can you try out the suggestion from James and report back? Once that's done (success or failure), I'm happy to merge this and ship it for 0.11 :) |
Replacing |
Co-authored-by: JoJoJet <21144246+JoJoJet@users.noreply.github.com>
I realize I have made a mistake in making |
# Objective - Fixes bevyengine#7811 ## Solution - I added `Has<T>` (and `HasFetch<T>` ) and implemented `WorldQuery`, `ReadonlyWorldQuery`, and `ArchetypeFilter` it - I also added documentation with an example and a unit test I believe I've done everything right but this is my first contribution and I'm not an ECS expert so someone who is should probably check my implementation. I based it on what `Or<With<T>,>`, would do. The only difference is that `Has` does not update component access - adding `Has` to a query should never affect whether or not it is disjoint with another query *I think*. --- ## Changelog ## Added - Added `Has<T>` WorldQuery to find out whether or not an entity has a particular component. --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com> Co-authored-by: JoJoJet <21144246+JoJoJet@users.noreply.github.com>
Objective
Has<C>
WorldQuery
type to replaceOption<&C>
when checking existence #7811Solution
Has<T>
(andHasFetch<T>
) and implementedWorldQuery
,ReadonlyWorldQuery
, andArchetypeFilter
itI believe I've done everything right but this is my first contribution and I'm not an ECS expert so someone who is should probably check my implementation. I based it on what
Or<With<T>,>
, would do. The only difference is thatHas
does not update component access - addingHas
to a query should never affect whether or not it is disjoint with another query I think.Changelog
Added
Has<T>
WorldQuery to find out whether or not an entity has a particular component.