pub struct ClientWorld {
pub entities: BTreeMap<NetworkId, SabSlot>,
pub player_network_id: Option<NetworkId>,
pub latest_tick: u64,
pub system_manifest: BTreeMap<String, String>,
pub shared_world_ref: Option<usize>,
}Expand description
A simplified client-side world that tracks entity states using SabSlot.
Fields§
§entities: BTreeMap<NetworkId, SabSlot>Map of NetworkId to the last known authoritative state.
player_network_id: Option<NetworkId>The network ID of the player’s own ship, if known.
latest_tick: u64The latest tick received from the server.
system_manifest: BTreeMap<String, String>Manifest of system-wide metadata.
Optional shared world to push room bounds into directly (stored as usize for Send/Sync).
Implementations§
Source§impl ClientWorld
impl ClientWorld
Source§impl ClientWorld
impl ClientWorld
Sourcepub fn handle_game_event(&mut self, event: &GameEvent)
pub fn handle_game_event(&mut self, event: &GameEvent)
Handles discrete game events from the server.
Source§impl ClientWorld
impl ClientWorld
Sourcepub fn playground_apply_input(
&mut self,
move_x: f32,
move_y: f32,
actions_mask: u32,
)
pub fn playground_apply_input( &mut self, move_x: f32, move_y: f32, actions_mask: u32, )
Applies playground input to the local player entity. Used for Sandbox mode simulation.
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 extract_reliable_events(&mut self) -> Vec<(Option<ClientId>, WireEvent)>
fn extract_reliable_events(&mut self) -> Vec<(Option<ClientId>, WireEvent)>
Extracts discrete game events that should be sent reliably. Read more
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.
Source§fn post_extract(&mut self)
fn post_extract(&mut self)
Source§fn spawn_kind_for(
&mut self,
kind: u16,
x: f32,
y: f32,
rot: f32,
_client_id: ClientId,
) -> NetworkId
fn spawn_kind_for( &mut self, kind: u16, x: f32, y: f32, rot: f32, _client_id: ClientId, ) -> NetworkId
Spawns a new network-replicated entity of a specific kind for a specific client.
Source§fn spawn_session_ship(
&mut self,
kind: u16,
x: f32,
y: f32,
rot: f32,
client_id: ClientId,
) -> NetworkId
fn spawn_session_ship( &mut self, kind: u16, x: f32, y: f32, rot: f32, client_id: ClientId, ) -> NetworkId
Spawns the authoritative session ship for a client and marks it as
the possession target. Read more
Source§fn queue_reliable_event(
&mut self,
_client_id: Option<ClientId>,
_event: GameEvent,
)
fn queue_reliable_event( &mut self, _client_id: Option<ClientId>, _event: GameEvent, )
Queues a reliable game event to be sent to a specific client (or all if None).
Source§fn setup_world(&mut self)
fn setup_world(&mut self)
Setups the initial world state (e.g. Master Room).
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