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