Trait naia_server::WorldMutType [−][src]
pub trait WorldMutType<P, E>: WorldRefType<P, E> + ProtocolInserter<P, E> where
P: ProtocolType, {
fn spawn_entity(&mut self) -> E;
fn despawn_entity(&mut self, entity: &E);
fn get_component_kinds(
&mut self,
entity: &E
) -> Vec<<P as ProtocolType>::Kind, Global>ⓘ;
fn get_component_mut<R>(
&'a mut self,
entity: &E
) -> Option<ReplicaMutWrapper<'a, P, R>>
where
R: ReplicateSafe<P>;
fn component_read_partial(
&mut self,
entity: &E,
component_kind: &<P as ProtocolType>::Kind,
diff_mask: &DiffMask,
reader: &mut PacketReader<'_>,
packet_index: u16
);
fn mirror_components(
&mut self,
mutable_entity: &E,
immutable_entity: &E,
component_kind: &<P as ProtocolType>::Kind
);
fn insert_component<R>(&mut self, entity: &E, component_ref: R)
where
R: ReplicateSafe<P>;
fn remove_component<R>(&mut self, entity: &E) -> Option<R>
where
R: Replicate<P>;
fn remove_component_of_kind(
&mut self,
entity: &E,
component_kind: &<P as ProtocolType>::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 despawn_entity(&mut self, entity: &E)
fn despawn_entity(&mut self, entity: &E)
despawn an entity
gets all of an Entity’s Components as a list of Kinds
fn get_component_mut<R>(
&'a mut self,
entity: &E
) -> Option<ReplicaMutWrapper<'a, P, R>> where
R: ReplicateSafe<P>,
fn get_component_mut<R>(
&'a mut self,
entity: &E
) -> Option<ReplicaMutWrapper<'a, P, R>> where
R: ReplicateSafe<P>,
gets an entity’s component
fn component_read_partial(
&mut self,
entity: &E,
component_kind: &<P as ProtocolType>::Kind,
diff_mask: &DiffMask,
reader: &mut PacketReader<'_>,
packet_index: u16
)
fn component_read_partial(
&mut self,
entity: &E,
component_kind: &<P as ProtocolType>::Kind,
diff_mask: &DiffMask,
reader: &mut PacketReader<'_>,
packet_index: u16
)
reads an incoming stream into a component
fn mirror_components(
&mut self,
mutable_entity: &E,
immutable_entity: &E,
component_kind: &<P as ProtocolType>::Kind
)
fn mirror_components(
&mut self,
mutable_entity: &E,
immutable_entity: &E,
component_kind: &<P as ProtocolType>::Kind
)
mirrors the state of the same component owned by two different entities (setting 1st entity’s component to 2nd entity’s component’s state)
fn insert_component<R>(&mut self, entity: &E, component_ref: R) where
R: ReplicateSafe<P>,
fn insert_component<R>(&mut self, entity: &E, component_ref: R) where
R: ReplicateSafe<P>,
insert a component
fn remove_component<R>(&mut self, entity: &E) -> Option<R> where
R: Replicate<P>,
fn remove_component<R>(&mut self, entity: &E) -> Option<R> where
R: Replicate<P>,
remove a component
fn remove_component_of_kind(
&mut self,
entity: &E,
component_kind: &<P as ProtocolType>::Kind
) -> Option<P>
fn remove_component_of_kind(
&mut self,
entity: &E,
component_kind: &<P as ProtocolType>::Kind
) -> Option<P>
remove a component by kind