flatland_play_loop/
local.rs1use flatland_client_ui::{HudViewMode, MapTargetState, MovementState};
4
5use crate::chat::ChatSession;
6
7#[derive(Debug)]
8pub struct PlayLocalState {
9 pub movement: MovementState,
10 pub map_target: MapTargetState,
11 pub auto_nav_goal: Option<(f32, f32)>,
12 pub chat: ChatSession,
13 pub hud_view: HudViewMode,
14 pub mouse_hover: Option<(f32, f32)>,
15 pub was_harvesting: bool,
16}
17
18impl PlayLocalState {
19 pub fn new(keys: flatland_client_lib::ClientKeyBindings) -> Self {
20 Self {
21 movement: MovementState::with_keys(keys),
22 map_target: MapTargetState::default(),
23 auto_nav_goal: None,
24 chat: ChatSession::default(),
25 hud_view: HudViewMode::default(),
26 mouse_hover: None,
27 was_harvesting: false,
28 }
29 }
30
31 pub fn cycle_hud_view(&mut self) {
32 self.hud_view = self.hud_view.cycle();
33 }
34
35 pub fn clear_nav(&mut self) {
36 self.map_target.deactivate();
37 self.auto_nav_goal = None;
38 self.movement.reset();
39 }
40}