f1_api/packet/setup.rs
1//! Data about car setups
2//!
3//! The F1 games publish data about the setups of all cars in a session. In multiplayer sessions,
4//! setups of other players are redacted to prevent anyone from gaining an unfair advantage.
5
6use derive_new::new;
7use getset::{CopyGetters, Getters};
8
9use crate::packet::header::Header;
10
11/// Setup of a car
12///
13/// The setup of a car in the F1 games consists of a set of parameters that players can adjust
14/// before leaving the garage.
15#[derive(new, Debug, CopyGetters, Getters, PartialEq, Copy, Clone, PartialOrd, Default)]
16#[allow(clippy::too_many_arguments)]
17pub struct CarSetup {
18 /// Returns the setting for the front wing aero.
19 #[getset(get_copy = "pub")]
20 front_wing: u8,
21
22 /// Returns the setting for the rear wing aero.
23 #[getset(get_copy = "pub")]
24 rear_wing: u8,
25
26 /// Returns the differential adjustment on throttle as a percentage.
27 #[getset(get_copy = "pub")]
28 on_throttle: u8,
29
30 /// Returns the differential adjustment off throttle as a percentage.
31 #[getset(get_copy = "pub")]
32 off_throttle: u8,
33
34 /// Returns the setting for the front camber angle.
35 #[getset(get_copy = "pub")]
36 front_camber: f32,
37
38 /// Returns the setting for the rear camber angle.
39 #[getset(get_copy = "pub")]
40 rear_camber: f32,
41
42 /// Returns the setting for the front toe angle.
43 #[getset(get_copy = "pub")]
44 front_toe: f32,
45
46 /// Returns the setting for the rear toe angle.
47 #[getset(get_copy = "pub")]
48 rear_toe: f32,
49
50 /// Returns the front suspension setting.
51 #[getset(get_copy = "pub")]
52 front_suspension: u8,
53
54 /// Returns the rear suspension setting.
55 #[getset(get_copy = "pub")]
56 rear_suspension: u8,
57
58 /// Returns the setting for the front anti-roll bar.
59 #[getset(get_copy = "pub")]
60 front_anti_roll_bar: u8,
61
62 /// Returns the setting for the rear anti-roll bar.
63 #[getset(get_copy = "pub")]
64 rear_anti_roll_bar: u8,
65
66 /// Returns the setting for the front ride height.
67 #[getset(get_copy = "pub")]
68 front_suspension_height: u8,
69
70 /// Returns the setting for the rear right height.
71 #[getset(get_copy = "pub")]
72 rear_suspension_height: u8,
73
74 /// Returns the setting for the brake pressure as a percentage.
75 #[getset(get_copy = "pub")]
76 brake_pressure: u8,
77
78 /// Returns the setting for the brake bias as a percentage.
79 #[getset(get_copy = "pub")]
80 brake_bias: u8,
81
82 /// Returns the setting for the front tyre pressure in psi.
83 #[getset(get_copy = "pub")]
84 front_tyre_pressure: f32,
85
86 /// Returns the setting for the rear tyre pressure in psi.
87 #[getset(get_copy = "pub")]
88 rear_tyre_pressure: f32,
89
90 /// Returns the setting for additional ballast.
91 #[getset(get_copy = "pub")]
92 ballast: u8,
93
94 /// Returns the setting for the fuel load.
95 #[getset(get_copy = "pub")]
96 fuel_load: f32,
97}
98
99/// Packet containing the setups of all cars in the session
100///
101/// The F1 games publish the setup of each car in the session in the car setup packet. In
102/// multiplayer sessions, the setups of other players are redacted to prevent anyone from gaining an
103/// unfair advantage.
104#[derive(new, Debug, Getters, PartialEq, Clone, PartialOrd)]
105pub struct CarSetupPacket {
106 /// Returns the packet header prefixing the car setup packet.
107 #[getset(get = "pub")]
108 header: Header,
109
110 /// Returns the setups of all 20 cars in the session.
111 #[getset(get = "pub")]
112 setups: Vec<CarSetup>,
113}