1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
use crate::hud::{AutoPressBehavior, PressBehavior};
use serde::{Deserialize, Serialize};

/// `GameplaySettings` contains sensitivity and gameplay options.
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(default)]
pub struct GameplaySettings {
    pub pan_sensitivity: u32,
    pub zoom_sensitivity: u32,
    pub camera_clamp_angle: u32,
    pub walking_speed: f32,
    pub zoom_inversion: bool,
    pub mouse_y_inversion: bool,
    pub smooth_pan_enable: bool,
    pub free_look_behavior: PressBehavior,
    pub auto_walk_behavior: PressBehavior,
    pub walking_speed_behavior: PressBehavior,
    pub camera_clamp_behavior: PressBehavior,
    pub zoom_lock_behavior: AutoPressBehavior,
    pub stop_auto_walk_on_input: bool,
    pub auto_camera: bool,
    pub bow_zoom: bool,
    pub zoom_lock: bool,
    pub aim_offset_x: f32,
    pub aim_offset_y: f32,
    pub show_all_recipes: bool,
}

impl Default for GameplaySettings {
    fn default() -> Self {
        Self {
            pan_sensitivity: 100,
            zoom_sensitivity: 100,
            camera_clamp_angle: 45,
            walking_speed: 0.35,
            zoom_inversion: false,
            mouse_y_inversion: false,
            smooth_pan_enable: false,
            free_look_behavior: PressBehavior::Toggle,
            auto_walk_behavior: PressBehavior::Toggle,
            walking_speed_behavior: PressBehavior::Toggle,
            camera_clamp_behavior: PressBehavior::Toggle,
            zoom_lock_behavior: AutoPressBehavior::Auto,
            stop_auto_walk_on_input: true,
            auto_camera: false,
            bow_zoom: true,
            zoom_lock: false,
            aim_offset_x: 0.6,
            aim_offset_y: 0.0,
            show_all_recipes: false,
        }
    }
}