Repository navigation
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 ✨ |
alice-i-cecile
left a comment
There was a problem hiding this comment.
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>
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
alice-i-cecile
left a comment
There was a problem hiding this comment.
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>WorldQuerytype to replaceOption<&C>when checking existence #7811Solution
Has<T>(andHasFetch<T>) and implementedWorldQuery,ReadonlyWorldQuery, andArchetypeFilteritI 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 thatHasdoes not update component access - addingHasto 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.