-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0bb0b30
commit f8aa85f
Showing
3 changed files
with
123 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
Car Setups Packet | ||
|
||
This packet details the car setups for each vehicle in the session. Note that in multiplayer games, other player cars will appear as blank, you will only be able to see your car setup and AI cars. | ||
|
||
Frequency: 2 per second | ||
Size: 1102 bytes | ||
Version: 1 | ||
|
||
struct CarSetupData | ||
{ | ||
uint8 m_frontWing; // Front wing aero | ||
uint8 m_rearWing; // Rear wing aero | ||
uint8 m_onThrottle; // Differential adjustment on throttle (percentage) | ||
uint8 m_offThrottle; // Differential adjustment off throttle (percentage) | ||
float m_frontCamber; // Front camber angle (suspension geometry) | ||
float m_rearCamber; // Rear camber angle (suspension geometry) | ||
float m_frontToe; // Front toe angle (suspension geometry) | ||
float m_rearToe; // Rear toe angle (suspension geometry) | ||
uint8 m_frontSuspension; // Front suspension | ||
uint8 m_rearSuspension; // Rear suspension | ||
uint8 m_frontAntiRollBar; // Front anti-roll bar | ||
uint8 m_rearAntiRollBar; // Front anti-roll bar | ||
uint8 m_frontSuspensionHeight; // Front ride height | ||
uint8 m_rearSuspensionHeight; // Rear ride height | ||
uint8 m_brakePressure; // Brake pressure (percentage) | ||
uint8 m_brakeBias; // Brake bias (percentage) | ||
float m_rearLeftTyrePressure; // Rear left tyre pressure (PSI) | ||
float m_rearRightTyrePressure; // Rear right tyre pressure (PSI) | ||
float m_frontLeftTyrePressure; // Front left tyre pressure (PSI) | ||
float m_frontRightTyrePressure; // Front right tyre pressure (PSI) | ||
uint8 m_ballast; // Ballast | ||
float m_fuelLoad; // Fuel load | ||
}; | ||
|
||
struct PacketCarSetupData | ||
{ | ||
PacketHeader m_header; // Header | ||
|
||
CarSetupData m_carSetups[22]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import {F1Parser} from '../../f1.parser'; | ||
import {PacketHeaderParser} from '../../PacketHeader/parser'; | ||
import {PacketCarSetupData} from '../types'; | ||
|
||
class CarSetupDataParser extends F1Parser { | ||
constructor() { | ||
super(); | ||
this | ||
/*uint8*/ .uint8('m_frontWing') | ||
/*uint8*/ .uint8('m_rearWing') | ||
/*uint8*/ .uint8('m_onThrottle') | ||
/*uint8*/ .uint8('m_offThrottle') | ||
/*float*/ .floatle('m_frontCamber') | ||
/*float*/ .floatle('m_rearCamber') | ||
/*float*/ .floatle('m_frontToe') | ||
/*float*/ .floatle('m_rearToe') | ||
/*uint8*/ .uint8('m_frontSuspension') | ||
/*uint8*/ .uint8('m_rearSuspension') | ||
/*uint8*/ .uint8('m_frontAntiRollBar') | ||
/*uint8*/ .uint8('m_rearAntiRollBar') | ||
/*uint8*/ .uint8('m_frontSuspensionHeight') | ||
/*uint8*/ .uint8('m_rearSuspensionHeight') | ||
/*uint8*/ .uint8('m_brakePressure') | ||
/*uint8*/ .uint8('m_brakeBias') | ||
/*float*/ .floatle('m_rearLeftTyrePressure') | ||
/*float*/ .floatle('m_rearRightTyrePressure') | ||
/*float*/ .floatle('m_frontLeftTyrePressure') | ||
/*float*/ .floatle('m_frontRightTyrePressure') | ||
/*uint8*/ .uint8('m_ballast') | ||
/*float*/ .floatle('m_fuelLoad'); | ||
} | ||
} | ||
|
||
export class PacketCarSetupDataParser extends F1Parser { | ||
data: PacketCarSetupData; | ||
|
||
constructor(buffer: Buffer, bigintEnabled: boolean) { | ||
super(); | ||
|
||
this.endianess('little') | ||
.nest('m_header', { | ||
type: new PacketHeaderParser(bigintEnabled), | ||
}) | ||
.array('m_carSetups', { | ||
length: 22, | ||
type: new CarSetupDataParser(), | ||
}); | ||
|
||
this.data = this.fromBuffer(buffer) as PacketCarSetupData; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import {PacketHeader} from '@Type/PacketHeader'; | ||
|
||
interface CarSetupData { | ||
/*uint8*/ m_frontWing: number; | ||
/*uint8*/ m_rearWing: number; | ||
/*uint8*/ m_onThrottle: number; | ||
/*uint8*/ m_offThrottle: number; | ||
/*float*/ m_frontCamber: number; | ||
/*float*/ m_rearCamber: number; | ||
/*float*/ m_frontToe: number; | ||
/*float*/ m_rearToe: number; | ||
/*uint8*/ m_frontSuspension: number; | ||
/*uint8*/ m_rearSuspension: number; | ||
/*uint8*/ m_frontAntiRollBar: number; | ||
/*uint8*/ m_rearAntiRollBar: number; | ||
/*uint8*/ m_frontSuspensionHeight: number; | ||
/*uint8*/ m_rearSuspensionHeight: number; | ||
/*uint8*/ m_brakePressure: number; | ||
/*uint8*/ m_brakeBias: number; | ||
/*float*/ m_rearLeftTyrePressure: number; | ||
/*float*/ m_rearRightTyrePressure: number; | ||
/*float*/ m_frontLeftTyrePressure: number; | ||
/*float*/ m_frontRightTyrePressure: number; | ||
/*uint8*/ m_ballast: number; | ||
/*float*/ m_fuelLoad: number; | ||
} | ||
|
||
interface PacketCarSetupData { | ||
/*PacketHeader*/ m_header: PacketHeader; | ||
/*CarSetupData*/ m_carSetups: CarSetupData[]; | ||
} |