pub struct ClientWorld {
pub entities: HashMap<NetworkId, SabSlot>,
pub latest_tick: u64,
}Expand description
A simplified client-side world that tracks entity states using SabSlot.
Fields§
§entities: HashMap<NetworkId, SabSlot>Map of NetworkId to the last known authoritative state.
latest_tick: u64The latest tick received from the server.
Implementations§
Source§impl ClientWorld
impl ClientWorld
Trait Implementations§
Source§impl Debug for ClientWorld
impl Debug for ClientWorld
Source§impl Default for ClientWorld
impl Default for ClientWorld
Source§impl WorldState for ClientWorld
impl WorldState for ClientWorld
Source§fn get_local_id(&self, network_id: NetworkId) -> Option<LocalId>
fn get_local_id(&self, network_id: NetworkId) -> Option<LocalId>
Maps a protocol-level
NetworkId to the ECS’s local entity handle. Read moreSource§fn get_network_id(&self, local_id: LocalId) -> Option<NetworkId>
fn get_network_id(&self, local_id: LocalId) -> Option<NetworkId>
Maps a local ECS entity handle back to its protocol-level
NetworkId. Read moreSource§fn extract_deltas(&mut self) -> Vec<ReplicationEvent>
fn extract_deltas(&mut self) -> Vec<ReplicationEvent>
Extracts replication deltas for all components modified since the last tick. Read more
Source§fn apply_updates(&mut self, updates: &[(ClientId, ComponentUpdate)])
fn apply_updates(&mut self, updates: &[(ClientId, ComponentUpdate)])
Injects parsed state updates from the network into the ECS. Read more
Source§fn spawn_networked(&mut self) -> NetworkId
fn spawn_networked(&mut self) -> NetworkId
Spawns a new network-replicated entity and returns its
NetworkId.Source§fn spawn_networked_for(&mut self, _client_id: ClientId) -> NetworkId
fn spawn_networked_for(&mut self, _client_id: ClientId) -> NetworkId
Spawns a new network-replicated entity owned by a specific client.
Source§fn despawn_networked(&mut self, network_id: NetworkId) -> Result<(), WorldError>
fn despawn_networked(&mut self, network_id: NetworkId) -> Result<(), WorldError>
Despawn a network-replicated entity by its
NetworkId. Read moreSource§fn stress_test(&mut self, _count: u16, _rotate: bool)
fn stress_test(&mut self, _count: u16, _rotate: bool)
Triggers a bulk spawn of entities for stress testing.
Source§fn spawn_kind(&mut self, _kind: u16, _x: f32, _y: f32, _rot: f32) -> NetworkId
fn spawn_kind(&mut self, _kind: u16, _x: f32, _y: f32, _rot: f32) -> NetworkId
Spawns a new network-replicated entity of a specific kind.
Source§fn clear_world(&mut self)
fn clear_world(&mut self)
Despawns all entities from the world.
Source§fn advance_tick(&mut self)
fn advance_tick(&mut self)
Advances the world change tick at the start of each server tick, before inputs are applied.
Auto Trait Implementations§
impl Freeze for ClientWorld
impl RefUnwindSafe for ClientWorld
impl Send for ClientWorld
impl Sync for ClientWorld
impl Unpin for ClientWorld
impl UnsafeUnpin for ClientWorld
impl UnwindSafe for ClientWorld
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request