Skip to main content

ed_journals/modules/status/models/
flags2.rs

1use serde::{Deserialize, Serialize};
2
3/// A second flags field which includes flags for the on-foot status of the player.
4#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)]
5pub struct Flags2(u64);
6
7impl Flags2 {
8    /// Whether the current player is currently on-foot.
9    pub fn on_foot(&self) -> bool {
10        self.0 & 1 != 0
11    }
12
13    /// Whether the current player is currently traveling by taxi.
14    pub fn in_taxi(&self) -> bool {
15        self.0 & 2 != 0
16    }
17
18    /// Whether the current player is currently in a multicrew session.
19    pub fn in_multicrew(&self) -> bool {
20        self.0 & 4 != 0
21    }
22
23    /// Whether the player is currently on-foot in a space station.
24    pub fn on_foot_in_station(&self) -> bool {
25        self.0 & 8 != 0
26    }
27
28    /// Whether the player is currently on-foot on a planet.
29    pub fn on_foot_on_planet(&self) -> bool {
30        self.0 & 16 != 0
31    }
32
33    /// Whether the player is currently aiming down the sight of a weapon.
34    pub fn aim_down_sight(&self) -> bool {
35        self.0 & 32 != 0
36    }
37
38    /// Whether the player currently has a low oxygen warning.
39    pub fn low_oxygen(&self) -> bool {
40        self.0 & 64 != 0
41    }
42
43    /// Whether the player currently has a low health.
44    pub fn low_health(&self) -> bool {
45        self.0 & 128 != 0
46    }
47
48    /// Whether the player currently has a cold warning.
49    pub fn cold(&self) -> bool {
50        self.0 & 256 != 0
51    }
52
53    /// Whether the player currently has a heat warning.
54    pub fn hot(&self) -> bool {
55        self.0 & 512 != 0
56    }
57
58    /// Whether the player currently has a very cold warning.
59    pub fn very_cold(&self) -> bool {
60        self.0 & 1024 != 0
61    }
62
63    /// Whether the player currently has an extreme heat warning.
64    pub fn very_hot(&self) -> bool {
65        self.0 & 2048 != 0
66    }
67
68    pub fn glide_mode(&self) -> bool {
69        self.0 & 4096 != 0
70    }
71
72    /// Whether the player is currently on-foot in the ship hangar.
73    pub fn on_foot_in_hangar(&self) -> bool {
74        self.0 & 8192 != 0
75    }
76
77    /// Whether the player is currently on-foot in the social space in a space station.
78    pub fn on_foot_social_space(&self) -> bool {
79        self.0 & 16384 != 0
80    }
81
82    pub fn on_foot_exterior(&self) -> bool {
83        self.0 & 32768 != 0
84    }
85
86    /// Whether there is a breathable atmosphere at the current location of the player.
87    pub fn breathable_atmosphere(&self) -> bool {
88        self.0 & 65536 != 0
89    }
90
91    pub fn telepresence_multicrew(&self) -> bool {
92        self.0 & 131072 != 0
93    }
94
95    pub fn physical_multicrew(&self) -> bool {
96        self.0 & 262144 != 0
97    }
98
99    /// Whether the FSD of the current ship is charging.
100    pub fn fsd_hyperdrive_charging(&self) -> bool {
101        self.0 & 524288 != 0
102    }
103}