Trait naia_shared::WorldMutType
source · [−]pub trait WorldMutType<P: Protocolize, E>: WorldRefType<P, E> + ProtocolInserter<P, E> {
fn spawn_entity(&mut self) -> E;
fn duplicate_entity(&mut self, entity: &E) -> E;
fn duplicate_components(&mut self, mutable_entity: &E, immutable_entity: &E);
fn despawn_entity(&mut self, entity: &E);
fn component_kinds(&mut self, entity: &E) -> Vec<P::Kind>;
fn component_mut<'a, R: ReplicateSafe<P>>(
&'a mut self,
entity: &E
) -> Option<ReplicaMutWrapper<'a, P, R>>;
fn component_apply_update(
&mut self,
converter: &dyn NetEntityHandleConverter,
entity: &E,
component_kind: &P::Kind,
update: ComponentUpdate<P::Kind>
);
fn mirror_entities(&mut self, mutable_entity: &E, immutable_entity: &E);
fn mirror_components(
&mut self,
mutable_entity: &E,
immutable_entity: &E,
component_kind: &P::Kind
);
fn insert_component<R: ReplicateSafe<P>>(
&mut self,
entity: &E,
component_ref: R
);
fn remove_component<R: Replicate<P>>(&mut self, entity: &E) -> Option<R>;
fn remove_component_of_kind(
&mut self,
entity: &E,
component_kind: &P::Kind
) -> Option<P>;
}
Expand description
Structures that implement the WorldMutType trait will be able to be loaded into the Server at which point the Server will use this interface to keep the WorldMutType in-sync with it’s own Entities/Components
Required Methods
fn spawn_entity(&mut self) -> E
fn spawn_entity(&mut self) -> E
spawn an entity
fn duplicate_entity(&mut self, entity: &E) -> E
fn duplicate_entity(&mut self, entity: &E) -> E
duplicate an entity
fn duplicate_components(&mut self, mutable_entity: &E, immutable_entity: &E)
fn duplicate_components(&mut self, mutable_entity: &E, immutable_entity: &E)
make it so one entity has all the same components as another
fn despawn_entity(&mut self, entity: &E)
fn despawn_entity(&mut self, entity: &E)
despawn an entity
fn component_kinds(&mut self, entity: &E) -> Vec<P::Kind>
fn component_kinds(&mut self, entity: &E) -> Vec<P::Kind>
gets all of an Entity’s Components as a list of Kinds
fn component_mut<'a, R: ReplicateSafe<P>>(
&'a mut self,
entity: &E
) -> Option<ReplicaMutWrapper<'a, P, R>>
fn component_mut<'a, R: ReplicateSafe<P>>(
&'a mut self,
entity: &E
) -> Option<ReplicaMutWrapper<'a, P, R>>
gets an entity’s component
fn component_apply_update(
&mut self,
converter: &dyn NetEntityHandleConverter,
entity: &E,
component_kind: &P::Kind,
update: ComponentUpdate<P::Kind>
)
fn component_apply_update(
&mut self,
converter: &dyn NetEntityHandleConverter,
entity: &E,
component_kind: &P::Kind,
update: ComponentUpdate<P::Kind>
)
reads an incoming stream into a component
fn mirror_entities(&mut self, mutable_entity: &E, immutable_entity: &E)
fn mirror_entities(&mut self, mutable_entity: &E, immutable_entity: &E)
mirrors the whole state of two different entities (setting 1st entity’s component to 2nd entity’s component’s state)
fn mirror_components(
&mut self,
mutable_entity: &E,
immutable_entity: &E,
component_kind: &P::Kind
)
fn mirror_components(
&mut self,
mutable_entity: &E,
immutable_entity: &E,
component_kind: &P::Kind
)
mirrors the state of the same component of two different entities (setting 1st entity’s component to 2nd entity’s component’s state)
fn insert_component<R: ReplicateSafe<P>>(&mut self, entity: &E, component_ref: R)
fn insert_component<R: ReplicateSafe<P>>(&mut self, entity: &E, component_ref: R)
insert a component
fn remove_component<R: Replicate<P>>(&mut self, entity: &E) -> Option<R>
fn remove_component<R: Replicate<P>>(&mut self, entity: &E) -> Option<R>
remove a component
fn remove_component_of_kind(
&mut self,
entity: &E,
component_kind: &P::Kind
) -> Option<P>
fn remove_component_of_kind(
&mut self,
entity: &E,
component_kind: &P::Kind
) -> Option<P>
remove a component by kind