fix scenes test

This commit is contained in:
Elliott Pierce 2025-05-31 17:09:50 -04:00
parent b415dc8325
commit 38a97105a4
2 changed files with 29 additions and 2 deletions

View File

@ -82,6 +82,12 @@ impl<'w> EntityRef<'w> {
self.cell.location()
}
/// Returns if the entity is constructed or not.
#[inline]
pub fn is_constructed(&self) -> bool {
self.cell.location().is_some()
}
/// Returns the archetype that the current entity belongs to.
#[inline]
pub fn archetype(&self) -> Option<&Archetype> {
@ -492,6 +498,12 @@ impl<'w> EntityMut<'w> {
self.cell.location()
}
/// Returns if the entity is constructed or not.
#[inline]
pub fn is_constructed(&self) -> bool {
self.cell.location().is_some()
}
/// Returns the archetype that the current entity belongs to.
#[inline]
pub fn archetype(&self) -> Option<&Archetype> {
@ -1220,7 +1232,7 @@ impl<'w> EntityWorldMut<'w> {
}
}
/// Returns whether or not the entity is constructed.
/// Returns if the entity is constructed or not.
#[inline]
pub fn is_constructed(&self) -> bool {
self.location.is_some()
@ -3277,6 +3289,12 @@ impl<'w> FilteredEntityRef<'w> {
self.entity.location()
}
/// Returns if the entity is constructed or not.
#[inline]
pub fn is_constructed(&self) -> bool {
self.entity.location().is_some()
}
/// Returns the archetype that the current entity belongs to.
#[inline]
pub fn archetype(&self) -> Option<&Archetype> {
@ -3619,6 +3637,12 @@ impl<'w> FilteredEntityMut<'w> {
self.entity.location()
}
/// Returns if the entity is constructed or not.
#[inline]
pub fn is_constructed(&self) -> bool {
self.entity.location().is_some()
}
/// Returns the archetype that the current entity belongs to.
#[inline]
pub fn archetype(&self) -> Option<&Archetype> {

View File

@ -774,7 +774,10 @@ mod tests {
assert!(dst_world
.query_filtered::<&MyEntityRef, With<Foo>>()
.iter(&dst_world)
.all(|r| world.get_entity(r.0).is_err()));
.all(|r| world
.get_entity(r.0)
.map(|entity| !entity.is_constructed())
.unwrap_or(true)));
}
#[test]