-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Add entities alongside resources #19711
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 15 commits
042337f
47c20a5
64eac9a
956c1a6
073df4b
6c8281d
f9dc9f1
07723ac
1ba7af2
b89c042
9b33933
c7b4f1d
96aef45
e3ccd1b
5758134
9824c3a
9acf43f
da1d203
4d4e914
78a0672
4a2416d
3942c56
724a4c4
f442ff6
acb539e
a0d76c3
c99df9c
12383a3
d1b9b56
2261f8b
7f224be
6246539
b83a617
e98bcd8
09e5ff8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -275,6 +275,7 @@ impl<'w, D: QueryData, F: QueryFilter> QueryBuilder<'w, D, F> { | |
| mod tests { | ||
| use crate::{ | ||
| prelude::*, | ||
| resource::IsResource, | ||
| world::{EntityMutExcept, EntityRefExcept, FilteredEntityMut, FilteredEntityRef}, | ||
| }; | ||
| use std::dbg; | ||
|
|
@@ -332,6 +333,7 @@ mod tests { | |
| #[test] | ||
| fn builder_or() { | ||
| let mut world = World::new(); | ||
|
|
||
| world.spawn((A(0), B(0))); | ||
| world.spawn(B(0)); | ||
| world.spawn(C(0)); | ||
|
|
@@ -485,6 +487,7 @@ mod tests { | |
|
|
||
| let mut query = QueryBuilder::<(FilteredEntityMut, EntityMutExcept<A>)>::new(&mut world) | ||
| .data::<EntityMut>() | ||
| .filter::<Without<IsResource>>() | ||
|
||
| .build(); | ||
|
|
||
| // Removing `EntityMutExcept<A>` just leaves A | ||
|
|
@@ -496,6 +499,7 @@ mod tests { | |
|
|
||
| let mut query = QueryBuilder::<(FilteredEntityMut, EntityRefExcept<A>)>::new(&mut world) | ||
| .data::<EntityMut>() | ||
| .filter::<Without<IsResource>>() | ||
| .build(); | ||
|
|
||
| // Removing `EntityRefExcept<A>` just leaves A, plus read access | ||
|
|
||
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.
This is so fragile: I really don't like this.
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.
This is exactly correct. I've justified it to myself by noting that creating entities from raw numbers is really fragile, so this is not really that bad in comparison.
It's not great either.
Uh oh!
There was an error while loading. Please reload this page.
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.
I suppose we could use the lower level
entities.len(), which would be more robust to adding internal entities that are not resources, but I think that the offset stuff is gonna have to stay.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.
setupcallsworld.spawn_batch, which returns an iterator that yields the actualEntityvalues. Would it work to stick those in aVec<Entity>and iterate that instead of using integers andEntity::from_raw?