Rename num_entities to entity_count (#19781)
As discussed in https://github.com/bevyengine/bevy/pull/19780#issuecomment-2994554024.
This commit is contained in:
parent
0518eda2ad
commit
efd17f133d
@ -1582,7 +1582,7 @@ mod tests {
|
||||
app.add_systems(EnterMainMenu, (foo, bar));
|
||||
|
||||
app.world_mut().run_schedule(EnterMainMenu);
|
||||
assert_eq!(app.world().num_entities(), 2);
|
||||
assert_eq!(app.world().entity_count(), 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1637,7 +1637,7 @@ mod tests {
|
||||
|
||||
assert_eq!(q1.iter(&world).len(), 1);
|
||||
assert_eq!(q2.iter(&world).len(), 1);
|
||||
assert_eq!(world.num_entities(), 2);
|
||||
assert_eq!(world.entity_count(), 2);
|
||||
|
||||
world.clear_entities();
|
||||
|
||||
@ -1652,7 +1652,7 @@ mod tests {
|
||||
"world should not contain sparse set components"
|
||||
);
|
||||
assert_eq!(
|
||||
world.num_entities(),
|
||||
world.entity_count(),
|
||||
0,
|
||||
"world should not have any entities"
|
||||
);
|
||||
|
@ -727,7 +727,7 @@ mod tests {
|
||||
world.spawn(A).flush();
|
||||
assert_eq!(vec!["add_2", "add_1"], world.resource::<Order>().0);
|
||||
// Our A entity plus our two observers
|
||||
assert_eq!(world.num_entities(), 3);
|
||||
assert_eq!(world.entity_count(), 3);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -2342,7 +2342,7 @@ mod tests {
|
||||
.spawn((W(1u32), W(2u64)))
|
||||
.id();
|
||||
command_queue.apply(&mut world);
|
||||
assert_eq!(world.num_entities(), 1);
|
||||
assert_eq!(world.entity_count(), 1);
|
||||
let results = world
|
||||
.query::<(&W<u32>, &W<u64>)>()
|
||||
.iter(&world)
|
||||
|
@ -423,12 +423,12 @@ mod test {
|
||||
let mut world = World::new();
|
||||
queue.apply(&mut world);
|
||||
|
||||
assert_eq!(world.num_entities(), 2);
|
||||
assert_eq!(world.entity_count(), 2);
|
||||
|
||||
// The previous call to `apply` cleared the queue.
|
||||
// This call should do nothing.
|
||||
queue.apply(&mut world);
|
||||
assert_eq!(world.num_entities(), 2);
|
||||
assert_eq!(world.entity_count(), 2);
|
||||
}
|
||||
|
||||
#[expect(
|
||||
@ -462,7 +462,7 @@ mod test {
|
||||
queue.push(SpawnCommand);
|
||||
queue.push(SpawnCommand);
|
||||
queue.apply(&mut world);
|
||||
assert_eq!(world.num_entities(), 3);
|
||||
assert_eq!(world.entity_count(), 3);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -220,7 +220,7 @@ impl World {
|
||||
///
|
||||
/// This is helpful as a diagnostic, but it can also be used effectively in tests.
|
||||
#[inline]
|
||||
pub fn num_entities(&self) -> u32 {
|
||||
pub fn entity_count(&self) -> u32 {
|
||||
self.entities.len()
|
||||
}
|
||||
|
||||
|
@ -535,12 +535,12 @@ pub fn extract_clusters(
|
||||
continue;
|
||||
}
|
||||
|
||||
let num_entities: usize = clusters
|
||||
let entity_count: usize = clusters
|
||||
.clusterable_objects
|
||||
.iter()
|
||||
.map(|l| l.entities.len())
|
||||
.sum();
|
||||
let mut data = Vec::with_capacity(clusters.clusterable_objects.len() + num_entities);
|
||||
let mut data = Vec::with_capacity(clusters.clusterable_objects.len() + entity_count);
|
||||
for cluster_objects in &clusters.clusterable_objects {
|
||||
data.push(ExtractedClusterableObjectElement::ClusterHeader(
|
||||
cluster_objects.counts,
|
||||
|
Loading…
Reference in New Issue
Block a user