pub struct CarStatus { /* private fields */ }
Expand description
Data describing the status of a car
The status of each car is a collection of properties that can change over time. It includes data about the fuel, the engine, the various assistance systems like ABS, DRS, and ERS, and the damage the car has sustained. In multiplayer sessions, some of this data is restricted and only shown for the player’s own car.
Implementations§
Source§impl CarStatus
impl CarStatus
Sourcepub fn new(
traction_control: TractionControl,
abs: bool,
fuel_mix: FuelMix,
brake_bias: u8,
pit_limiter: bool,
fuel_remaining: f32,
fuel_capacity: f32,
fuel_remaining_laps: f32,
max_rpm: u16,
idle_rpm: u16,
gear_count: u8,
drs: DrsSetting,
tyre_wear: CornerProperty<u8>,
physical_tyre_compound: PhysicalTyreCompound,
visual_tyre_compound: VisualTyreCompound,
tyre_damage: CornerProperty<u8>,
front_left_wing_damage: u8,
front_right_wing_damage: u8,
rear_wing_damage: u8,
engine_damage: u8,
gear_box_damage: u8,
vehicle_flags: Flag,
ers_energy: f32,
ers_deploy_mode: ErsDeployMode,
ers_harvest_mgu_k: f32,
ers_harvest_mgu_h: f32,
ers_deployed: f32,
) -> Self
pub fn new( traction_control: TractionControl, abs: bool, fuel_mix: FuelMix, brake_bias: u8, pit_limiter: bool, fuel_remaining: f32, fuel_capacity: f32, fuel_remaining_laps: f32, max_rpm: u16, idle_rpm: u16, gear_count: u8, drs: DrsSetting, tyre_wear: CornerProperty<u8>, physical_tyre_compound: PhysicalTyreCompound, visual_tyre_compound: VisualTyreCompound, tyre_damage: CornerProperty<u8>, front_left_wing_damage: u8, front_right_wing_damage: u8, rear_wing_damage: u8, engine_damage: u8, gear_box_damage: u8, vehicle_flags: Flag, ers_energy: f32, ers_deploy_mode: ErsDeployMode, ers_harvest_mgu_k: f32, ers_harvest_mgu_h: f32, ers_deployed: f32, ) -> Self
Constructs a new CarStatus
.
Source§impl CarStatus
impl CarStatus
Sourcepub fn traction_control(&self) -> TractionControl
pub fn traction_control(&self) -> TractionControl
Returns the traction control setting.
Sourcepub fn brake_bias(&self) -> u8
pub fn brake_bias(&self) -> u8
Returns the front brake bias (percentage).
Sourcepub fn pit_limiter(&self) -> bool
pub fn pit_limiter(&self) -> bool
Returns whether the pit speed limiter is engaged.
Sourcepub fn fuel_remaining(&self) -> f32
pub fn fuel_remaining(&self) -> f32
Returns the remaining fuel mass in tank.
Sourcepub fn fuel_capacity(&self) -> f32
pub fn fuel_capacity(&self) -> f32
Returns the fuel capacity.
Sourcepub fn fuel_remaining_laps(&self) -> f32
pub fn fuel_remaining_laps(&self) -> f32
Returns the remaining fuel in terms of laps.
Sourcepub fn gear_count(&self) -> u8
pub fn gear_count(&self) -> u8
Returns the car’s number of gears.
Sourcepub fn drs(&self) -> DrsSetting
pub fn drs(&self) -> DrsSetting
Returns the status of DRS.
Sourcepub fn physical_tyre_compound(&self) -> PhysicalTyreCompound
pub fn physical_tyre_compound(&self) -> PhysicalTyreCompound
Returns the physical compound of the tyres.
Sourcepub fn visual_tyre_compound(&self) -> VisualTyreCompound
pub fn visual_tyre_compound(&self) -> VisualTyreCompound
Returns the visual compound of the tyres.
Sourcepub fn front_left_wing_damage(&self) -> u8
pub fn front_left_wing_damage(&self) -> u8
Returns the damage to the left front wing in percent.
Sourcepub fn front_right_wing_damage(&self) -> u8
pub fn front_right_wing_damage(&self) -> u8
Returns the damage to the right front wing in percent.
Sourcepub fn rear_wing_damage(&self) -> u8
pub fn rear_wing_damage(&self) -> u8
Returns the damage to the rear wing in percent.
Sourcepub fn engine_damage(&self) -> u8
pub fn engine_damage(&self) -> u8
Returns the damage to the engine in percent.
Sourcepub fn gear_box_damage(&self) -> u8
pub fn gear_box_damage(&self) -> u8
Returns the damage to the gear box in percent.
Sourcepub fn vehicle_flags(&self) -> Flag
pub fn vehicle_flags(&self) -> Flag
Returns the flags that are being shown to the current car.
Sourcepub fn ers_energy(&self) -> f32
pub fn ers_energy(&self) -> f32
Returns the ERS energy store in Joules.
Sourcepub fn ers_deploy_mode(&self) -> ErsDeployMode
pub fn ers_deploy_mode(&self) -> ErsDeployMode
Returns the ERS deploy mode.
Sourcepub fn ers_harvest_mgu_k(&self) -> f32
pub fn ers_harvest_mgu_k(&self) -> f32
Returns the ERS energy harvested this lap by the MGU-K.
Sourcepub fn ers_harvest_mgu_h(&self) -> f32
pub fn ers_harvest_mgu_h(&self) -> f32
Returns the ERS energy harvested this lap by the MGU-H.
Sourcepub fn ers_deployed(&self) -> f32
pub fn ers_deployed(&self) -> f32
Returns the ERS energy deployed this lap.
Source§impl CarStatus
impl CarStatus
Sourcepub fn tyre_wear(&self) -> &CornerProperty<u8>
pub fn tyre_wear(&self) -> &CornerProperty<u8>
Returns the tyre wear at each corner of the car in percent.
Sourcepub fn tyre_damage(&self) -> &CornerProperty<u8>
pub fn tyre_damage(&self) -> &CornerProperty<u8>
Returns the tyre damage at each corner of the car in percent.