use std::collections::BTreeMap;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Penalty {
None,
DriveThroughCutting,
StopAndGo10Cutting,
StopAndGo20Cutting,
StopAndGo30Cutting,
DisqualifiedCutting,
RemoveBestLaptimeCutting,
DriveThroughPitSpeeding,
StopAndGo10PitSpeeding,
StopAndGo20PitSpeeding,
StopAndGo30PitSpeeding,
DisqualifiedPitSpeeding,
RemoveBestLaptimePitSpeeding,
DisqualifiedIgnoredMandatoryPit,
PostRaceTime,
DisqualifiedTrolling,
DisqualifiedPitEntry,
DisqualifiedPitExit,
DisqualifiedWrongWay,
DriveThroughIgnoredDriverStint,
DisqualifiedIgnoredDriverStint,
DisqualifiedExceededDriverStintLimit,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Status {
Off,
Replay,
Live,
Pause,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum SessionType {
Unknown,
Practice,
Qualify,
Race,
Hotlap,
TimeAttack,
Drift,
Drag,
HotStint,
HotlapSuperPole,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum FlagType {
None,
Blue,
Yellow,
Black,
White,
Checkered,
Penalty,
Green,
Orange,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum TrackGripStatus {
Green,
Fast,
Optimum,
Greasy,
Damp,
Wet,
Flooded,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum RainIntensity {
NoRain,
Drizzle,
LightRain,
MediumRain,
HeavyRain,
Thunderstorm,
}
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct Wheels<T> {
pub front_left: T,
pub front_right: T,
pub rear_left: T,
pub rear_right: T,
}
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct Vector3<T> {
pub x: T,
pub y: T,
pub z: T,
}
#[derive(Clone, Debug, PartialEq)]
pub struct CarDamage {
pub front: f32,
pub rear: f32,
pub left: f32,
pub right: f32,
pub center: f32,
}
#[derive(Clone, Debug, PartialEq)]
pub struct Aids {
pub fuel_rate: f32,
pub tyre_rate: f32,
pub mechanical_damage: f32,
pub allow_tyre_blankets: f32,
pub stability: f32,
pub auto_clutch: bool,
pub auto_blip: bool,
}
#[derive(Clone, Debug, PartialEq)]
pub struct GlobalFlags {
pub yellow: bool,
pub yellow1: bool,
pub yellow2: bool,
pub yellow3: bool,
pub white: bool,
pub green: bool,
pub chequered: bool,
pub red: bool,
}
#[derive(Clone, Debug, PartialEq)]
pub struct MfdPitstop {
pub tyre_set: i32,
pub fuel_to_add: f32,
pub tyre_pressures: Wheels<f32>,
}
#[derive(Clone, Debug, PartialEq)]
pub struct Time {
pub millis: i32,
pub text: String,
}
#[derive(Clone, Debug, PartialEq)]
pub struct WheelInfo {
pub tyre_pressure: f32,
pub angular_speed: f32,
pub suspension_travel: f32,
pub tyre_core_temperature: f32,
pub brake_temperature: f32,
pub tyre_contact_point: Vector3<f32>,
pub tyre_contact_normal: Vector3<f32>,
pub tyre_contact_heading: Vector3<f32>,
pub slip: f32,
pub slip_ratio: f32,
pub slip_angle: f32,
pub brake_pressure: f32,
pub pad_life: f32,
pub disc_life: f32,
}
#[derive(Clone, Debug, PartialEq)]
pub struct Physics {
pub packet_id: i32,
pub gas: f32,
pub brake: f32,
pub clutch: f32,
pub steer_angle: f32,
pub gear: i32,
pub rpm: i32,
pub fuel: f32,
pub speed_kmh: f32,
pub velocity: Vector3<f32>,
pub acc_g: Vector3<f32>,
pub wheels: Wheels<WheelInfo>,
pub tc: f32,
pub abs: f32,
pub heading: f32,
pub pitch: f32,
pub roll: f32,
pub car_damage: CarDamage,
pub pit_limiter_on: bool,
pub auto_shifter_on: bool,
pub turbo_boost: f32,
pub air_temperature: f32,
pub road_temperature: f32,
pub local_angular_velocity: Vector3<f32>,
pub final_ff: f32,
pub is_ai_controlled: bool,
pub brake_bias: f32,
pub local_velocity: Vector3<f32>,
pub water_temperature: f32,
pub front_brake_compound: i32,
pub rear_brake_compound: i32,
pub ignition_on: bool,
pub starter_engine_on: bool,
pub engine_running: bool,
pub kerb_vibration: f32,
pub slip_vibrations: f32,
pub g_vibrations: f32,
pub abs_vibrations: f32,
}
#[derive(Clone, Debug, PartialEq)]
pub struct LapTiming {
pub current: Time,
pub last: Time,
pub best: Time,
pub split: Time,
pub delta_lap: Time,
pub estimated_lap: Time,
pub last_sector_ms: i32,
}
#[derive(Clone, Debug, PartialEq)]
pub struct Graphics {
pub packet_id: i32,
pub status: Status,
pub session: SessionType,
pub lap_timing: LapTiming,
pub completed_laps: i32,
pub position: i32,
pub session_time_left: f32,
pub distance_traveled: f32,
pub is_in_pit: bool,
pub current_sector_index: i32,
pub tyre_compound: String,
pub normalized_car_position: f32,
pub car_coordinates: BTreeMap<i32, Vector3<f32>>,
pub player_car_id: i32,
pub penalty_time: f32,
pub flag: FlagType,
pub penalty: Penalty,
pub ideal_line_on: bool,
pub is_in_pit_lane: bool,
pub mandatory_pit_done: bool,
pub wind_speed: f32,
pub wind_direction: f32,
pub is_setup_menu_visible: bool,
pub main_display_index: i32,
pub secondary_display_index: i32,
pub tc: i32,
pub tc_cut: i32,
pub engine_map: i32,
pub abs: i32,
pub fuel_used_per_lap: f32,
pub rain_lights: bool,
pub flashing_lights: bool,
pub lights_stage: i32,
pub exhaust_temperature: f32,
pub wiper_stage: i32,
pub driver_stint_total_time_left: i32,
pub driver_stint_time_left: i32,
pub rain_tyres: bool,
pub session_index: i32,
pub used_fuel: f32,
pub is_delta_positive: bool,
pub is_valid_lap: bool,
pub fuel_estimated_laps: f32,
pub track_status: String,
pub missing_mandatory_pits: i32,
pub clock: f32,
pub direction_lights_left: bool,
pub direction_lights_right: bool,
pub global_flags: GlobalFlags,
pub mfd_pitstop: MfdPitstop,
pub track_grip_status: TrackGripStatus,
pub rain_intensity: RainIntensity,
pub rain_intensity_in_10m: RainIntensity,
pub rain_intensity_in_30m: RainIntensity,
pub current_tyre_set: i32,
pub strategy_tyre_set: i32,
}
#[derive(Clone, Debug, PartialEq)]
pub struct StaticData {
pub sm_version: String,
pub ac_version: String,
pub number_of_sessions: i32,
pub num_cars: i32,
pub car_model: String,
pub track: String,
pub track_configuration: String,
pub player_name: String,
pub player_surname: String,
pub player_nick: String,
pub sector_count: i32,
pub max_rpm: i32,
pub max_fuel: f32,
pub penalties_enabled: i32,
pub aids: Aids,
pub pit_window_start: i32,
pub pit_window_end: i32,
pub is_online: bool,
pub dry_tyres_name: String,
pub wet_tyres_name: String,
}