pub struct GameState {Show 21 fields
pub session_id: SessionId,
pub entity_id: EntityId,
pub tick: Tick,
pub chunk_rev: u64,
pub entities: Vec<EntityState>,
pub player: Option<EntityState>,
pub resource_nodes: Vec<ResourceNodeView>,
pub buildings: Vec<BuildingView>,
pub doors: Vec<DoorView>,
pub npcs: Vec<NpcView>,
pub blueprints: Vec<BlueprintView>,
pub world_width_m: f32,
pub world_height_m: f32,
pub inventory: HashMap<String, u32>,
pub logs: VecDeque<String>,
pub intents_sent: u64,
pub ticks_received: u64,
pub connected: bool,
pub show_stats: bool,
pub show_craft_menu: bool,
pub craft_menu_index: usize,
}Fields§
§session_id: SessionId§entity_id: EntityId§tick: Tick§chunk_rev: u64§entities: Vec<EntityState>§player: Option<EntityState>§resource_nodes: Vec<ResourceNodeView>§buildings: Vec<BuildingView>§doors: Vec<DoorView>§npcs: Vec<NpcView>§blueprints: Vec<BlueprintView>§world_width_m: f32§world_height_m: f32§inventory: HashMap<String, u32>§logs: VecDeque<String>§intents_sent: u64§ticks_received: u64§connected: bool§show_stats: boolImplementations§
Source§impl GameState
impl GameState
pub fn push_log(&mut self, line: impl Into<String>)
pub fn is_alive(&self) -> bool
pub fn vitals(&self) -> Option<PlayerVitals>
pub fn can_craft_blueprint(&self, blueprint: &BlueprintView) -> bool
Sourcepub fn craft_missing_hint(&self, blueprint: &BlueprintView) -> Option<String>
pub fn craft_missing_hint(&self, blueprint: &BlueprintView) -> Option<String>
Short hint for UI when a recipe cannot be started.
pub fn player_entity(&self) -> Option<&EntityState>
pub fn player_position(&self) -> (f32, f32)
Sourcepub fn building_interior_at(&self, px: f32, py: f32) -> Option<&BuildingView>
pub fn building_interior_at(&self, px: f32, py: f32) -> Option<&BuildingView>
Building interior the player is standing in, if any (position-based).
Sourcepub fn effective_inside_building(&self) -> Option<String>
pub fn effective_inside_building(&self) -> Option<String>
Interior instance map to render (ignores stale inside_building when outdoors).
pub fn sync_inventory_from_stacks(&mut self, stacks: &[ItemStack])
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GameState
impl RefUnwindSafe for GameState
impl Send for GameState
impl Sync for GameState
impl Unpin for GameState
impl UnsafeUnpin for GameState
impl UnwindSafe for GameState
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