Trait naia_shared::WorldMutType
source · pub trait WorldMutType<E>: WorldRefType<E> {
Show 14 methods
// Required methods
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<ComponentKind>;
fn component_mut<'a, R: Replicate>(
&'a mut self,
entity: &E
) -> Option<ReplicaMutWrapper<'a, R>>;
fn component_mut_of_kind<'a>(
&'a mut self,
entity: &E,
component_kind: &ComponentKind
) -> Option<ReplicaDynMutWrapper<'a>>;
fn component_apply_update(
&mut self,
converter: &dyn NetEntityHandleConverter,
entity: &E,
component_kind: &ComponentKind,
update: ComponentUpdate
) -> Result<(), SerdeErr>;
fn mirror_entities(&mut self, mutable_entity: &E, immutable_entity: &E);
fn mirror_components(
&mut self,
mutable_entity: &E,
immutable_entity: &E,
component_kind: &ComponentKind
);
fn insert_component<R: Replicate>(&mut self, entity: &E, component_ref: R);
fn insert_boxed_component(
&mut self,
entity: &E,
boxed_component: Box<dyn Replicate>
);
fn remove_component<R: Replicate>(&mut self, entity: &E) -> Option<R>;
fn remove_component_of_kind(
&mut self,
entity: &E,
component_kind: &ComponentKind
) -> Option<Box<dyn Replicate>>;
}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§
sourcefn spawn_entity(&mut self) -> E
fn spawn_entity(&mut self) -> E
spawn an entity
sourcefn duplicate_entity(&mut self, entity: &E) -> E
fn duplicate_entity(&mut self, entity: &E) -> E
duplicate an entity
sourcefn 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
sourcefn despawn_entity(&mut self, entity: &E)
fn despawn_entity(&mut self, entity: &E)
despawn an entity
sourcefn component_kinds(&mut self, entity: &E) -> Vec<ComponentKind>
fn component_kinds(&mut self, entity: &E) -> Vec<ComponentKind>
gets all of an Entity’s Components
sourcefn component_mut<'a, R: Replicate>(
&'a mut self,
entity: &E
) -> Option<ReplicaMutWrapper<'a, R>>
fn component_mut<'a, R: Replicate>( &'a mut self, entity: &E ) -> Option<ReplicaMutWrapper<'a, R>>
gets an entity’s component
sourcefn component_mut_of_kind<'a>(
&'a mut self,
entity: &E,
component_kind: &ComponentKind
) -> Option<ReplicaDynMutWrapper<'a>>
fn component_mut_of_kind<'a>( &'a mut self, entity: &E, component_kind: &ComponentKind ) -> Option<ReplicaDynMutWrapper<'a>>
gets an entity’s component, dynamically
sourcefn component_apply_update(
&mut self,
converter: &dyn NetEntityHandleConverter,
entity: &E,
component_kind: &ComponentKind,
update: ComponentUpdate
) -> Result<(), SerdeErr>
fn component_apply_update( &mut self, converter: &dyn NetEntityHandleConverter, entity: &E, component_kind: &ComponentKind, update: ComponentUpdate ) -> Result<(), SerdeErr>
reads an incoming stream into a component
sourcefn 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)
sourcefn mirror_components(
&mut self,
mutable_entity: &E,
immutable_entity: &E,
component_kind: &ComponentKind
)
fn mirror_components( &mut self, mutable_entity: &E, immutable_entity: &E, component_kind: &ComponentKind )
mirrors the state of the same component of two different entities (setting 1st entity’s component to 2nd entity’s component’s state)
sourcefn insert_component<R: Replicate>(&mut self, entity: &E, component_ref: R)
fn insert_component<R: Replicate>(&mut self, entity: &E, component_ref: R)
insert a component
sourcefn insert_boxed_component(
&mut self,
entity: &E,
boxed_component: Box<dyn Replicate>
)
fn insert_boxed_component( &mut self, entity: &E, boxed_component: Box<dyn Replicate> )
insert a boxed component
sourcefn remove_component<R: Replicate>(&mut self, entity: &E) -> Option<R>
fn remove_component<R: Replicate>(&mut self, entity: &E) -> Option<R>
remove a component
sourcefn remove_component_of_kind(
&mut self,
entity: &E,
component_kind: &ComponentKind
) -> Option<Box<dyn Replicate>>
fn remove_component_of_kind( &mut self, entity: &E, component_kind: &ComponentKind ) -> Option<Box<dyn Replicate>>
remove a component by kind