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>

source

pub fn new( address: &Option<SocketAddr>, global_world_manager: &dyn GlobalWorldManagerType<E> ) -> Self

Create a new HostWorldManager, given the client’s address

source

pub fn init_entity( &mut self, world_manager: &mut LocalWorldManager<E>, entity: &E, component_kinds: Vec<ComponentKind> )

source

pub fn spawn_entity( &mut self, world_manager: &mut LocalWorldManager<E>, entity: &E, component_kinds: &Vec<ComponentKind> )

source

pub fn despawn_entity(&mut self, entity: &E)

source

pub fn client_initiated_despawn(&mut self, entity: &E)

source

pub fn insert_component(&mut self, entity: &E, component_kind: &ComponentKind)

source

pub fn remove_component(&mut self, entity: &E, component_kind: &ComponentKind)

source

pub fn host_has_entity(&self, entity: &E) -> bool

source

pub fn track_remote_entity( &mut self, local_world_manager: &mut LocalWorldManager<E>, entity: &E, component_kinds: Vec<ComponentKind> ) -> HostEntity

source

pub fn untrack_remote_entity( &mut self, local_world_manager: &mut LocalWorldManager<E>, entity: &E )

source

pub fn track_remote_component( &mut self, entity: &E, component_kind: &ComponentKind )

source

pub fn handle_dropped_packets(&mut self, rtt_millis: &f32)

source

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>

source

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V