csgo_gsi_builder/
components.rs

1/// Components available.
2///
3/// You can find exemples of what each component does [here] _([archive])_.
4///
5/// [here]: https://www.reddit.com/r/GlobalOffensive/comments/cjhcpy/game_state_integration_a_very_large_and_indepth/
6/// [archive]: https://web.archive.org/web/20220906050651/https://www.reddit.com/r/GlobalOffensive/comments/cjhcpy/game_state_integration_a_very_large_and_indepth/
7#[derive(Eq, PartialEq)]
8pub enum Components {
9    /// General info about the client being listened to, the most import one
10    /// being it's SteamID64.
11    Provider,
12    /// General info about the player being spectated (yourself if you are
13    /// playing and alive).
14    PlayerId,
15    /// Current state about the player being spectated (i.e. health, armor,
16    /// money, ...).
17    PlayerState,
18    /// Match statistics about the player being spectated (i.e. kills, assists, ...).
19    PlayerMatchStats,
20    /// Weapons held by the player being spectated.
21    PlayerWeapons,
22    /// Map and game information (i.e. map name, round number, teams score, ...).
23    Map,
24    /// Winning condition of every round played.
25    MapRoundWins,
26    /// Current round information, similar to [`Components::PhaseCountdowns`].
27    Round,
28    /// State of every grenades on the map (i.e. coordinates, lifetime, velocity,
29    /// ...).
30    AllGrenages,
31    /// See [`Components::PlayerId`].
32    AllPlayersId,
33    /// See [`Components::PlayerMatchStats`].
34    AllPlayersMatchStats,
35    /// See [`Components::PlayerPosition`].
36    AllPlayersPosition,
37    /// See [`Components::PlayerState`].
38    AllPlayersStates,
39    /// See [`Components::PlayerWeapons`].
40    AllPlayersWeapons,
41    /// State, position, and other information about the bomb.
42    Bomb,
43    /// Current phase of the round information, similar to [`Components::Round`].
44    PhaseCountdowns,
45    /// Coordinates of the player being spectated.
46    PlayerPosition,
47}
48
49impl Components {
50    /// Components containing information about the currently spectated player
51    /// (or the one playing if he's alive).
52    pub const PLAYER_POV: &[Components] = &[
53        Components::Provider,
54        Components::PlayerId,
55        Components::PlayerState,
56        Components::Map,
57        Components::MapRoundWins,
58        Components::PlayerMatchStats,
59        Components::PlayerWeapons,
60        Components::Round,
61    ];
62
63    /// Components only available for spectators.
64    pub const SPECTATOR_POV: &[Components] = &[
65        Components::AllGrenages,
66        Components::AllPlayersId,
67        Components::AllPlayersMatchStats,
68        Components::AllPlayersPosition,
69        Components::AllPlayersStates,
70        Components::AllPlayersWeapons,
71        Components::Bomb,
72        Components::PhaseCountdowns,
73        Components::PlayerPosition,
74    ];
75
76    /// All the components.
77    pub const ALL: &[Components] = &[
78        Components::Provider,
79        Components::PlayerId,
80        Components::PlayerState,
81        Components::Map,
82        Components::MapRoundWins,
83        Components::PlayerMatchStats,
84        Components::PlayerWeapons,
85        Components::Round,
86        Components::AllGrenages,
87        Components::AllPlayersId,
88        Components::AllPlayersMatchStats,
89        Components::AllPlayersPosition,
90        Components::AllPlayersStates,
91        Components::AllPlayersWeapons,
92        Components::Bomb,
93        Components::PhaseCountdowns,
94        Components::PlayerPosition,
95    ];
96}