airmash_protocol/types/upgrades.rs
1/// Upgrade info that a client needs to know about to
2/// calculate movement. This also includes the shielded
3/// state of the player.
4///
5/// Note that since a player should never have more than
6/// 5 upgrades on the official server, `protocol-v5` can
7/// only represent amounts of speed upgrades in the range
8/// 0 to 7.
9///
10/// Used in:
11/// - [`Login`](server/struct.Login.html), specifically
12/// [`LoginPlayer`](server/struct.LoginPlayer.html)
13/// - [`PlayerUpdate`](server/struct.PlayerUpdate.html)
14/// - [`PlayerRespawn`](server/struct.PlayerRespawn.html)
15/// - [`PlayerUpgrade`](server/struct.PlayerUpgrade.html)
16#[derive(Copy, Clone, Debug, Default, Hash, Eq, PartialEq)]
17#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
18pub struct Upgrades {
19 /// The number of speed upgrades that the player currently
20 /// has equipped.
21 ///
22 /// Note that only the first 3 bits of this are used
23 /// in protocol-v5. Any values greater than 7 will be
24 /// mangled.
25 pub speed: u8,
26 /// Whether the player has a shield.
27 ///
28 /// While both this and [`inferno`][0] can be
29 /// set at the same time, that doesn't make
30 /// sense within the framework of the game.
31 ///
32 /// [0]: #structfield.inferno
33 pub shield: bool,
34 /// Whether the player has an inferno.
35 ///
36 /// While both this and [`shield`][0] can be
37 /// set at the same time, that doesn't make
38 /// sense within the framework of the game.
39 ///
40 /// [0]: #structfield.shield
41 pub inferno: bool,
42}