Skip to main content

GameState

Struct GameState 

Source
pub struct GameState {
Show 74 fields pub session_id: SessionId, pub entity_id: EntityId, pub character_id: Option<Uuid>, pub tick: Tick, pub chunk_rev: u64, pub content_rev: u64, pub entities: Vec<EntityState>, pub player: Option<EntityState>, pub resource_nodes: Vec<ResourceNodeView>, pub ground_drops: Vec<GroundDropView>, pub placed_containers: Vec<PlacedContainerView>, 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 terrain_zones: Vec<TerrainZoneView>, pub world_clock: WorldClock, pub inventory: HashMap<String, u32>, pub inventory_hints: HashMap<String, InventoryHint>, pub logs: VecDeque<String>, pub intents_sent: u64, pub ticks_received: u64, pub connected: bool, pub disconnect_reason: Option<String>, pub show_stats: bool, pub show_craft_menu: bool, pub craft_menu_index: usize, pub craft_batch_quantity: u32, pub show_shop_menu: bool, pub shop_catalog: Option<ShopCatalog>, pub shop_tab: ShopTab, pub shop_menu_index: usize, pub shop_quantity: u32, pub show_inventory_menu: bool, pub inventory_menu_index: usize, pub show_move_picker: bool, pub move_picker_index: usize, pub move_picker: Option<MovePicker>, pub show_destroy_picker: bool, pub destroy_confirm_pending: bool, pub destroy_picker: Option<DestroyPicker>, pub show_rename_prompt: bool, pub rename_buffer: String, pub combat_target: Option<EntityId>, pub combat_target_label: Option<String>, pub in_combat: bool, pub auto_attack: bool, pub combat_has_los: bool, pub attack_cd_ticks: u64, pub gcd_ticks: u64, pub weapon_ability_id: String, pub mainhand_template_id: Option<String>, pub mainhand_label: Option<String>, pub worn: BTreeMap<BodySlot, ItemStack>, pub carry_mass: f32, pub carry_mass_max: f32, pub encumbrance: EncumbranceState, pub inventory_stacks: Vec<ItemStack>, pub combat_target_detail: Option<CombatTargetHud>, pub cast_progress: Option<CastProgressHud>, pub ability_cooldowns: Vec<AbilityCooldownHud>, pub blocking_active: bool, pub max_target_slots: u8, pub combat_slots: Vec<CombatSlotHud>, pub rotation_presets: Vec<RotationPreset>, pub show_loadout_menu: bool, pub show_rotation_editor: bool, pub loadout_menu_index: usize, pub rotation_editor: RotationEditorState, pub harvest_in_progress: bool, pub harvest_started_at: Option<Instant>, pub pending_craft_ack: Option<(u32, String, u32)>,
}

Fields§

§session_id: SessionId§entity_id: EntityId§character_id: Option<Uuid>

Logged-in character — used to show owner-only container labels.

§tick: Tick§chunk_rev: u64§content_rev: u64§entities: Vec<EntityState>§player: Option<EntityState>§resource_nodes: Vec<ResourceNodeView>§ground_drops: Vec<GroundDropView>§placed_containers: Vec<PlacedContainerView>§buildings: Vec<BuildingView>§doors: Vec<DoorView>§npcs: Vec<NpcView>§blueprints: Vec<BlueprintView>§world_width_m: f32§world_height_m: f32§terrain_zones: Vec<TerrainZoneView>§world_clock: WorldClock§inventory: HashMap<String, u32>§inventory_hints: HashMap<String, InventoryHint>§logs: VecDeque<String>§intents_sent: u64§ticks_received: u64§connected: bool§disconnect_reason: Option<String>§show_stats: bool§show_craft_menu: bool§craft_menu_index: usize§craft_batch_quantity: u32

How many timed crafts to queue when confirming the craft menu.

§show_shop_menu: bool§shop_catalog: Option<ShopCatalog>§shop_tab: ShopTab§shop_menu_index: usize§shop_quantity: u32§show_inventory_menu: bool§inventory_menu_index: usize§show_move_picker: bool§move_picker_index: usize§move_picker: Option<MovePicker>§show_destroy_picker: bool§destroy_confirm_pending: bool§destroy_picker: Option<DestroyPicker>§show_rename_prompt: bool

Rename prompt for a selected container (n in inventory).

§rename_buffer: String§combat_target: Option<EntityId>

Slot-1 combat target (mirrors server after SetTarget).

§combat_target_label: Option<String>§in_combat: bool§auto_attack: bool§combat_has_los: bool§attack_cd_ticks: u64§gcd_ticks: u64§weapon_ability_id: String§mainhand_template_id: Option<String>§mainhand_label: Option<String>§worn: BTreeMap<BodySlot, ItemStack>

Worn body-slot items — backpack (Back), belt w/ clipped pouches (Waist), and future armor. At most one item per slot (plans/08 §4.1).

§carry_mass: f32§carry_mass_max: f32§encumbrance: EncumbranceState§inventory_stacks: Vec<ItemStack>

Full nested inventory stacks from the server (root only; worn are separate).

§combat_target_detail: Option<CombatTargetHud>§cast_progress: Option<CastProgressHud>§ability_cooldowns: Vec<AbilityCooldownHud>§blocking_active: bool§max_target_slots: u8§combat_slots: Vec<CombatSlotHud>§rotation_presets: Vec<RotationPreset>§show_loadout_menu: bool§show_rotation_editor: bool§loadout_menu_index: usize§rotation_editor: RotationEditorState§harvest_in_progress: bool

True after a harvest intent is accepted until result/reject/disconnect.

§harvest_started_at: Option<Instant>

Wall-clock start of the current harvest; clears stale client state on timeout.

§pending_craft_ack: Option<(u32, String, u32)>

Craft log deferred until the server acks the craft intent.

Implementations§

Source§

impl GameState

Source

pub fn push_log(&mut self, line: impl Into<String>)

Source

pub fn is_alive(&self) -> bool

Source

pub fn clear_harvest_state(&mut self)

Source

pub fn vitals(&self) -> Option<PlayerVitals>

Source

pub fn can_craft_blueprint(&self, blueprint: &BlueprintView) -> bool

Source

pub fn max_craft_batches(&self, blueprint: &BlueprintView) -> u32

Source

pub fn clamp_craft_batch_quantity(&mut self)

Source

pub fn craft_batch_adjust_quantity(&mut self, delta: i32)

Source

pub fn craft_batch_set_max(&mut self)

Source

pub fn apply_shop_catalog(&mut self, catalog: ShopCatalog)

Source

pub fn shop_list_len(&self) -> usize

Source

pub fn shop_menu_move(&mut self, delta: i32)

Source

pub fn shop_quantity_adjust(&mut self, delta: i32)

Source

pub fn shop_quantity_set_max(&mut self)

Source

pub fn player_at_station_tag(&self, tag: &str) -> bool

Source

pub fn craft_missing_hint(&self, blueprint: &BlueprintView) -> Option<String>

Short hint for UI when a recipe cannot be started.

Source

pub fn player_entity(&self) -> Option<&EntityState>

Source

pub fn player_position(&self) -> (f32, f32)

Source

pub fn sorted_inventory(&self) -> Vec<(String, u32, String)>

Source

pub fn inventory_item_category(&self, template_id: &str) -> Option<&str>

Source

pub fn item_base_mass(&self, template_id: &str) -> f32

Source

pub fn item_base_volume(&self, template_id: &str) -> f32

Source

pub fn stack_mass(&self, stack: &ItemStack) -> f32

Source

pub fn container_volume_label(&self, row: &InventoryRow) -> String

Volume used / capacity / free space label for storage containers in the inventory UI.

Source

pub fn row_is_renameable_container(&self, row: &InventoryRow) -> bool

Source

pub fn max_movable_to( &self, template_id: &str, stack_qty: u32, from: &InventoryLocation, to: &InventoryLocation, parent_instance_id: Option<Uuid>, ) -> u32

Client-side estimate of how many units can move to to (server clamps authoritatively).

Source

pub fn move_picker_max_at_selection(&self) -> u32

Source

pub fn clamp_move_picker_quantity(&mut self)

Source

pub fn move_picker_adjust_quantity(&mut self, delta: i32)

Source

pub fn move_picker_set_quantity_max(&mut self)

Source

pub fn destroy_picker_adjust_quantity(&mut self, delta: i32)

Source

pub fn destroy_picker_set_quantity_max(&mut self)

Source

pub fn ingredient_status(&self, template_id: &str, need: u32) -> (u32, bool)

Source

pub fn currency_display(&self) -> String

Source

pub fn in_shallow_water(&self) -> bool

True when standing in a shallow-water terrain zone from the segment snapshot.

Source

pub fn terrain_at(&self, x: f32, y: f32) -> Option<TerrainKindView>

Source

pub fn building_interior_at(&self, px: f32, py: f32) -> Option<&BuildingView>

Building interior the player is standing in, if any (position-based).

Source

pub fn effective_inside_building(&self) -> Option<String>

Interior instance map to render (ignores stale inside_building when outdoors).

Source

pub fn sync_inventory_from_stacks(&mut self, stacks: &[ItemStack])

Source

pub fn worn_rows(&self) -> Vec<InventoryRow>

Worn body-slot items — each shown as a shell row (unequip via Enter) followed by its nested contents (e.g. pouches clipped onto a worn belt). BodySlot derives Ord in display order (Head/Body/Arms/Legs/Feet/Back/Waist), so BTreeMap iteration alone gives a stable row order.

Source

pub fn person_rows(&self) -> Vec<InventoryRow>

Loose on-person inventory (not worn, not inside a placed chest).

Source

pub fn inventory_tree_rows(&self) -> Vec<(usize, ItemStack)>

Legacy alias used by the HUD sidebar summary (worn + on-person, unchanged).

Source

pub fn nearby_containers(&self) -> Vec<NearbyContainer>

Placed chests within CONTAINER_RANGE_M, nearest first. Contents are only populated when accessible — this is what makes a chest’s contents disappear the moment you walk away or it’s locked without your key.

Source

pub fn nearest_placed_container( &self, max_dist: f32, ) -> Option<PlacedContainerView>

Nearest placed chest within max_dist, regardless of accessibility.

Source

pub fn inventory_selectable_rows(&self) -> Vec<InventoryRow>

Full ordered list of selectable rows: worn ++ on-person ++ each nearby accessible chest’s contents (nearest chest first). This single order drives inventory_menu_index; the renderer must build its grouped headers by walking worn_rows() / person_rows() / nearby_containers() in the same sequence so the highlighted row always matches.

Source

pub fn inventory_selected_row(&self) -> Option<InventoryRow>

Source

pub fn move_destinations_for( &self, from: &InventoryLocation, from_parent_instance_id: Option<Uuid>, moving_instance_id: Option<Uuid>, moving_template_id: &str, ) -> Vec<MoveOption>

Build the “move to…” destination list for an item currently at from.

Source

pub fn target_for_slot(&self, slot: u8) -> Option<EntityId>

Entity id assigned to a combat slot (from server HUD).

Source

pub fn t1_candidates(&self) -> Vec<(EntityId, String)>

Hostile wildlife / monsters for T1 (Tab).

Source

pub fn t2_candidates(&self) -> Vec<(EntityId, String)>

Allies first, then monsters, for T2 (Shift+Tab). Includes self for heals.

Source

pub fn combat_candidates(&self) -> Vec<(EntityId, String)>

Wildlife and other combat targets visible in AOI (NpcView.entity_id).

Source

pub fn refresh_combat_target_label(&mut self)

Source

pub fn nearest_interact_target(&self) -> Option<String>

Nearest interactable target for f (doors, NPCs, well, shallow water).

Source

pub fn template_display_name(&self, template_id: &str) -> String

Human-readable template name from synced catalog hints.

Source

pub fn placed_container_public_label(&self, c: &PlacedContainerView) -> String

Chest label for the location panel — generic type unless this player owns it.

Source

pub fn key_pair_chest_label(&self, stack: &ItemStack) -> Option<String>

Display name of the chest a container_key opens, when known on the client.

Source

pub fn key_inventory_label(&self, stack: &ItemStack) -> String

Keys always show the catalog name — never a chest rename or stray custom_name.

Source

pub fn key_inventory_hint(&self, stack: &ItemStack) -> String

Hint suffix for a key row ([key for …] or [key — unpaired]).

Source

pub fn container_name_for_lock_id(&self, lock: &str) -> Option<String>

Resolve a lock id to a container label (placed chest or one still on your person).

Source

pub fn key_drop_blocked(&self, stack: &ItemStack) -> bool

Keys cannot be dropped while their paired chest is locked.

Source

pub fn location_context_lines(&self) -> Vec<ContextLine>

Terrain, interactables, and map objects near the player for the HUD location panel.

Trait Implementations§

Source§

impl Clone for GameState

Source§

fn clone(&self) -> GameState

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GameState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

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>,

Source§

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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more