use derive_new::new;
use getset::{CopyGetters, Getters};
use crate::packet::header::Header;
use crate::types::{CornerProperty, Flag};
#[derive(Debug, PartialEq, Copy, Clone, Eq, Ord, PartialOrd, Hash)]
pub enum TractionControl {
Off,
Low,
High,
}
impl Default for TractionControl {
fn default() -> Self {
TractionControl::Off
}
}
#[derive(Debug, PartialEq, Copy, Clone, Eq, Ord, PartialOrd, Hash)]
pub enum FuelMix {
Lean,
Standard,
Rich,
Max,
}
impl Default for FuelMix {
fn default() -> Self {
FuelMix::Standard
}
}
#[derive(Debug, PartialEq, Copy, Clone, Eq, Ord, PartialOrd, Hash)]
pub enum DrsSetting {
Unknown,
NotAllowed,
Allowed,
}
impl Default for DrsSetting {
fn default() -> Self {
DrsSetting::Unknown
}
}
#[derive(Debug, PartialEq, Copy, Clone, Eq, Ord, PartialOrd, Hash)]
pub enum PhysicalTyreCompound {
ClassicDry,
ClassicWet,
F1C1,
F1C2,
F1C3,
F1C4,
F1C5,
F1HyperSoft,
F1UltraSoft,
F1SuperSoft,
F1Soft,
F1Medium,
F1Hard,
F1SuperHard,
F1Intermediate,
F1Wet,
F2SuperSoft,
F2Soft,
F2Medium,
F2Hard,
F2Wet,
}
impl Default for PhysicalTyreCompound {
fn default() -> Self {
PhysicalTyreCompound::F1C1
}
}
#[derive(Debug, PartialEq, Copy, Clone, Eq, Ord, PartialOrd, Hash)]
pub enum VisualTyreCompound {
ClassicDry,
ClassicWet,
F1HyperSoft,
F1UltraSoft,
F1SuperSoft,
F1Soft,
F1Medium,
F1Hard,
F1SuperHard,
F1Intermediate,
F1Wet,
F2SuperSoft,
F2Soft,
F2Medium,
F2Hard,
F2Wet,
}
impl Default for VisualTyreCompound {
fn default() -> Self {
VisualTyreCompound::F1Soft
}
}
#[derive(Debug, PartialEq, Copy, Clone, Eq, Ord, PartialOrd, Hash)]
pub enum ErsDeployMode {
None,
Low,
Medium,
High,
Overtake,
Hotlap,
}
impl Default for ErsDeployMode {
fn default() -> Self {
ErsDeployMode::Low
}
}
#[derive(new, Debug, CopyGetters, Getters, PartialEq, Copy, Clone, PartialOrd, Default)]
#[allow(clippy::too_many_arguments)]
pub struct CarStatus {
#[getset(get_copy = "pub")]
traction_control: TractionControl,
#[getset(get_copy = "pub")]
abs: bool,
#[getset(get_copy = "pub")]
fuel_mix: FuelMix,
#[getset(get_copy = "pub")]
brake_bias: u8,
#[getset(get_copy = "pub")]
pit_limiter: bool,
#[getset(get_copy = "pub")]
fuel_remaining: f32,
#[getset(get_copy = "pub")]
fuel_capacity: f32,
#[getset(get_copy = "pub")]
fuel_remaining_laps: f32,
#[getset(get_copy = "pub")]
max_rpm: u16,
#[getset(get_copy = "pub")]
idle_rpm: u16,
#[getset(get_copy = "pub")]
gear_count: u8,
#[getset(get_copy = "pub")]
drs: DrsSetting,
#[getset(get = "pub")]
tyre_wear: CornerProperty<u8>,
#[getset(get_copy = "pub")]
physical_tyre_compound: PhysicalTyreCompound,
#[getset(get_copy = "pub")]
visual_tyre_compound: VisualTyreCompound,
#[getset(get = "pub")]
tyre_damage: CornerProperty<u8>,
#[getset(get_copy = "pub")]
front_left_wing_damage: u8,
#[getset(get_copy = "pub")]
front_right_wing_damage: u8,
#[getset(get_copy = "pub")]
rear_wing_damage: u8,
#[getset(get_copy = "pub")]
engine_damage: u8,
#[getset(get_copy = "pub")]
gear_box_damage: u8,
#[getset(get_copy = "pub")]
vehicle_flags: Flag,
#[getset(get_copy = "pub")]
ers_energy: f32,
#[getset(get_copy = "pub")]
ers_deploy_mode: ErsDeployMode,
#[getset(get_copy = "pub")]
ers_harvest_mgu_k: f32,
#[getset(get_copy = "pub")]
ers_harvest_mgu_h: f32,
#[getset(get_copy = "pub")]
ers_deployed: f32,
}
#[derive(new, Debug, Getters, PartialEq, Clone, PartialOrd)]
pub struct CarStatusPacket {
#[getset(get = "pub")]
header: Header,
#[getset(get = "pub")]
statuses: Vec<CarStatus>,
}