@deltazeroproduction/f1-udp-parser
Version:
The F1 series of games support the outputting of key game data via a UDP data stream. This data can be interpreted by external apps or connected peripherals for a range of different uses, including providing additional telemetry information, customised HU
49 lines • 1.74 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ParticipantDataParser = void 0;
const F1Parser_1 = require("../F1Parser");
const LiveryColourParser_1 = require("./LiveryColourParser");
class ParticipantDataParser extends F1Parser_1.F1Parser {
constructor(packetFormat) {
super();
this.uint8('m_aiControlled')
.uint8('m_driverId')
.uint8('m_networkId')
.uint8('m_teamId')
.uint8('m_myTeam')
.uint8('m_raceNumber')
.uint8('m_nationality');
// Name length: 32 in 2025, 48 in 2024 and earlier
if (packetFormat === 2025) {
this.string('m_name', {
length: 32,
stripNull: true,
});
}
else {
this.string('m_name', {
length: 48,
stripNull: true,
});
}
this.uint8('m_yourTelemetry');
if (packetFormat === 2023) {
this.uint8('m_showOnlineNames')
.uint8('m_platform');
}
if (packetFormat === 2024) {
this.uint8('m_showOnlineNames')
.uint16le('m_techLevel')
.uint8('m_platform');
}
if (packetFormat === 2025) {
this.uint8('m_showOnlineNames')
.uint16le('m_techLevel')
.uint8('m_platform')
.uint8('m_numColours')
.array('m_liveryColour', { length: 4, type: new LiveryColourParser_1.LiveryColourParser() });
}
}
}
exports.ParticipantDataParser = ParticipantDataParser;
//# sourceMappingURL=ParticipantDataParser.js.map