fixed merge conflicts hopefully
This commit is contained in:
parent
9de86df4f9
commit
0b3da3464c
@ -7,12 +7,13 @@ use crate::{
|
||||
relationship::RelationshipHookMode,
|
||||
world::World,
|
||||
};
|
||||
use alloc::{borrow::ToOwned, boxed::Box, collections::VecDeque, vec::Vec};
|
||||
use bevy_platform::collections::{HashMap, HashSet};
|
||||
use alloc::{boxed::Box, collections::VecDeque, vec::Vec};
|
||||
use bevy_platform::collections::{hash_map::Entry, HashMap, HashSet};
|
||||
use bevy_ptr::{Ptr, PtrMut};
|
||||
use bevy_utils::prelude::DebugName;
|
||||
use bumpalo::Bump;
|
||||
use core::any::TypeId;
|
||||
use core::{any::TypeId, cell::LazyCell, ops::Range};
|
||||
use derive_more::From;
|
||||
|
||||
use super::EntitiesAllocator;
|
||||
|
||||
@ -558,7 +559,9 @@ impl EntityCloner {
|
||||
#[cfg(not(feature = "bevy_reflect"))]
|
||||
let app_registry = Option::<()>::None;
|
||||
|
||||
let source_archetype = source_entity.archetype();
|
||||
let source_archetype = source_entity
|
||||
.archetype()
|
||||
.expect("Source entity must exist constructed");
|
||||
bundle_scratch = BundleScratch::with_capacity(source_archetype.component_count());
|
||||
|
||||
let target_archetype = LazyCell::new(|| {
|
||||
@ -566,6 +569,7 @@ impl EntityCloner {
|
||||
.get_entity(target)
|
||||
.expect("Target entity must exist")
|
||||
.archetype()
|
||||
.expect("Target entity must exist constructed")
|
||||
});
|
||||
|
||||
filter.clone_components(source_archetype, target_archetype, |component| {
|
||||
|
||||
@ -20,9 +20,9 @@ use crate::{
|
||||
component::{Component, ComponentId, Mutable},
|
||||
entity::{
|
||||
ConstructedEntityDoesNotExistError, Entities, EntitiesAllocator, Entity,
|
||||
EntityClonerBuilder, EntityDoesNotExistError,
|
||||
EntityClonerBuilder, EntityDoesNotExistError, OptIn, OptOut,
|
||||
},
|
||||
error::{ignore, warn, BevyError, CommandWithEntity, ErrorContext, HandleError},
|
||||
error::{warn, BevyError, CommandWithEntity, ErrorContext, HandleError},
|
||||
event::{BufferedEvent, EntityEvent, Event},
|
||||
observer::{Observer, TriggerTargets},
|
||||
resource::Resource,
|
||||
|
||||
@ -11,7 +11,7 @@ use crate::{
|
||||
},
|
||||
entity::{
|
||||
ConstructionError, ContainsEntity, Entity, EntityCloner, EntityClonerBuilder,
|
||||
EntityEquivalent, EntityIdLocation, EntityLocation,
|
||||
EntityEquivalent, EntityIdLocation, EntityLocation, OptIn, OptOut,
|
||||
},
|
||||
event::EntityEvent,
|
||||
lifecycle::{DESPAWN, REMOVE, REPLACE},
|
||||
@ -2888,9 +2888,7 @@ impl<'w> EntityWorldMut<'w> {
|
||||
) -> Entity {
|
||||
self.assert_not_despawned();
|
||||
|
||||
let entity_clone = self.world.entities.reserve_entity();
|
||||
self.world.flush();
|
||||
|
||||
let entity_clone = self.world.spawn_empty().id();
|
||||
let mut builder = EntityCloner::build_opt_out(self.world);
|
||||
config(&mut builder);
|
||||
builder.clone_entity(self.entity, entity_clone);
|
||||
|
||||
@ -843,19 +843,20 @@ pub fn process_remote_query_request(In(params): In<Option<Value>>, world: &mut W
|
||||
match &option {
|
||||
ComponentSelector::All => {
|
||||
// Add all reflectable components present on the entity (as Option<&T>)
|
||||
let all_optionals =
|
||||
entity_ref
|
||||
.archetype()
|
||||
.components()
|
||||
.filter_map(|component_id| {
|
||||
let info = world.components().get_info(component_id)?;
|
||||
let type_id = info.type_id()?;
|
||||
// Skip required components (already included)
|
||||
if required.iter().any(|(_, cid)| cid == &component_id) {
|
||||
return None;
|
||||
}
|
||||
Some((type_id, Some(component_id)))
|
||||
});
|
||||
let all_optionals = entity_ref
|
||||
.archetype()
|
||||
.map(bevy_ecs::archetype::Archetype::components)
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.filter_map(|component_id| {
|
||||
let info = world.components().get_info(component_id)?;
|
||||
let type_id = info.type_id()?;
|
||||
// Skip required components (already included)
|
||||
if required.iter().any(|(_, cid)| cid == &component_id) {
|
||||
return None;
|
||||
}
|
||||
Some((type_id, Some(component_id)))
|
||||
});
|
||||
components_map.extend(serialize_components(
|
||||
entity_ref,
|
||||
&type_registry,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user