Struct naia_shared::HostWorldManager
source · pub struct HostWorldManager<E: Copy + Eq + Hash + Send + Sync> {
pub world_channel: WorldChannel<E>,
pub sent_action_packets: SequenceList<(Instant, Vec<(MessageIndex, EntityAction<E>)>)>,
pub sent_updates: HashMap<PacketIndex, (Instant, HashMap<(E, ComponentKind), DiffMask>)>,
pub last_update_packet_index: PacketIndex,
}
Expand description
Manages Entities for a given Client connection and keeps them in sync on the Client
Fields§
§world_channel: WorldChannel<E>
§sent_action_packets: SequenceList<(Instant, Vec<(MessageIndex, EntityAction<E>)>)>
§sent_updates: HashMap<PacketIndex, (Instant, HashMap<(E, ComponentKind), DiffMask>)>
Map of component updates and DiffMask
that were written into each packet
last_update_packet_index: PacketIndex
Last PacketIndex
where a component update was written by the server
Implementations§
source§impl<E: Copy + Eq + Hash + Send + Sync> HostWorldManager<E>
impl<E: Copy + Eq + Hash + Send + Sync> HostWorldManager<E>
sourcepub fn new(
address: &Option<SocketAddr>,
global_world_manager: &dyn GlobalWorldManagerType<E>
) -> Self
pub fn new( address: &Option<SocketAddr>, global_world_manager: &dyn GlobalWorldManagerType<E> ) -> Self
Create a new HostWorldManager, given the client’s address
pub fn init_entity( &mut self, world_manager: &mut LocalWorldManager<E>, entity: &E, component_kinds: Vec<ComponentKind> )
pub fn spawn_entity( &mut self, world_manager: &mut LocalWorldManager<E>, entity: &E, component_kinds: &Vec<ComponentKind> )
pub fn despawn_entity(&mut self, entity: &E)
pub fn client_initiated_despawn(&mut self, entity: &E)
pub fn insert_component(&mut self, entity: &E, component_kind: &ComponentKind)
pub fn remove_component(&mut self, entity: &E, component_kind: &ComponentKind)
pub fn host_has_entity(&self, entity: &E) -> bool
pub fn track_remote_entity( &mut self, local_world_manager: &mut LocalWorldManager<E>, entity: &E, component_kinds: Vec<ComponentKind> ) -> HostEntity
pub fn untrack_remote_entity( &mut self, local_world_manager: &mut LocalWorldManager<E>, entity: &E )
pub fn track_remote_component( &mut self, entity: &E, component_kind: &ComponentKind )
pub fn handle_dropped_packets(&mut self, rtt_millis: &f32)
pub fn take_outgoing_events<W: WorldRefType<E>>( &mut self, world: &W, global_world_manager: &dyn GlobalWorldManagerType<E>, now: &Instant, rtt_millis: &f32 ) -> HostWorldEvents<E>
source§impl<E: Copy + Eq + Hash + Send + Sync> HostWorldManager<E>
impl<E: Copy + Eq + Hash + Send + Sync> HostWorldManager<E>
pub fn notify_packet_delivered( &mut self, packet_index: PacketIndex, local_world_manager: &mut LocalWorldManager<E> )
Auto Trait Implementations§
impl<E> RefUnwindSafe for HostWorldManager<E>where
E: RefUnwindSafe,
impl<E> Send for HostWorldManager<E>
impl<E> Sync for HostWorldManager<E>
impl<E> Unpin for HostWorldManager<E>where
E: Unpin,
impl<E> UnwindSafe for HostWorldManager<E>where
E: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more