pub struct EntityMut<'s, E: Copy + Eq + Hash + Send + Sync, W: WorldMutType<E>> { /* private fields */ }Expand description
Scoped mutable handle for a client-owned entity.
Obtained from Client::entity_mut. Borrows Client for the duration of
the handle, so only one EntityMut can be live at a time.
Unlike the server counterpart, the client has no static-entity concept — components may be inserted or removed freely while the client holds authority over the entity.
Implementations§
Source§impl<'s, E: Copy + Eq + Hash + Send + Sync, W: WorldMutType<E>> EntityMut<'s, E, W>
impl<'s, E: Copy + Eq + Hash + Send + Sync, W: WorldMutType<E>> EntityMut<'s, E, W>
Sourcepub fn despawn(&mut self)
pub fn despawn(&mut self)
Despawns the entity locally and removes it from the replication layer.
Sourcepub fn has_component<R: ReplicatedComponent>(&self) -> bool
pub fn has_component<R: ReplicatedComponent>(&self) -> bool
Returns true if the entity currently carries component R.
Sourcepub fn component<R: ReplicatedComponent>(
&mut self,
) -> Option<ReplicaMutWrapper<'_, R>>
pub fn component<R: ReplicatedComponent>( &mut self, ) -> Option<ReplicaMutWrapper<'_, R>>
Returns a mutable accessor for component R, or None if the entity
does not carry it.
Sourcepub fn insert_component<R: ReplicatedComponent>(
&mut self,
component_ref: R,
) -> &mut Self
pub fn insert_component<R: ReplicatedComponent>( &mut self, component_ref: R, ) -> &mut Self
Inserts component R onto the entity and registers it for replication.
Sourcepub fn remove_component<R: ReplicatedComponent>(&mut self) -> Option<R>
pub fn remove_component<R: ReplicatedComponent>(&mut self) -> Option<R>
Removes component R from the entity, returning its value if present.
Sourcepub fn configure_replication(&mut self, config: Publicity) -> &mut Self
pub fn configure_replication(&mut self, config: Publicity) -> &mut Self
Updates the Publicity for this entity. Returns &mut Self for
chaining.
Sourcepub fn replication_config(&self) -> Option<Publicity>
pub fn replication_config(&self) -> Option<Publicity>
Returns the current Publicity, or None if the entity is not
registered with the replication layer.
Returns the current authority status for this entity, or None if the
entity is not configured as Delegated.
Sourcepub fn owner(&self) -> EntityOwner
pub fn owner(&self) -> EntityOwner
Returns the current EntityOwner — who holds authoritative control
over this entity right now.
Sends an authority request to the server for this delegated entity.
The server responds asynchronously with an EntityAuthGrantedEvent or
EntityAuthDeniedEvent.
§Errors
Returns AuthorityError if the entity is not in a requestable state.
Releases the client’s authority over this entity back to the server.
§Errors
Returns AuthorityError if the entity is not currently
client-authoritative.