f1_game_packet_parser/packets/
lobby.rs

1use super::{read_name, u8_to_bool};
2use crate::constants::{Nationality, Platform, ReadyStatus, YourTelemetry};
3
4use binrw::BinRead;
5use serde::{Deserialize, Serialize};
6
7#[non_exhaustive]
8#[derive(
9    BinRead, Eq, PartialEq, Ord, PartialOrd, Clone, Debug, Serialize, Deserialize,
10)]
11#[br(little, import(packet_format: u16))]
12pub struct LobbyInfoData {
13    /// Whether the vehicle is controlled by AI.
14    #[br(try_map(u8_to_bool))]
15    pub ai_controlled: bool,
16    /// Team's ID.
17    /// See [`team_id`](mod@crate::constants::team_id) for possible values.
18    pub team_id: u8,
19    /// Driver's nationality.
20    pub nationality: Nationality,
21    /// Player's platform.
22    /// Available from the 2023 format onwards.
23    #[br(if(packet_format >= 2023))]
24    pub platform: Option<Platform>,
25    /// Driver's name.
26    #[br(try_map(read_name))]
27    pub name: String,
28    /// Player's car number.
29    pub car_number: u8,
30    /// The player's "Your Telemetry" visibility setting.
31    /// Available from the 2024 format onwards.
32    #[br(if(packet_format >= 2024))]
33    pub your_telemetry: Option<YourTelemetry>,
34    /// Whether the player has enabled the "Show online names" setting.
35    /// Available from the 2024 format onwards.
36    #[br(if(packet_format >= 2024), try_map(u8_to_bool))]
37    pub show_online_names: bool,
38    /// F1 World tech level.
39    /// Available from the 2024 format onwards.
40    #[br(if(packet_format >= 2024))]
41    pub tech_level: u16,
42    /// Readiness status.
43    pub ready_status: ReadyStatus,
44}