UNPKG

@rflafla/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

55 lines 1.71 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ParticipantDataParser = exports.LiveryColourParser = void 0; const F1Parser_1 = require("../F1Parser"); class LiveryColourParser extends F1Parser_1.F1Parser { constructor() { super(); this.uint8('red') .uint8('blue') .uint8('green'); } } exports.LiveryColourParser = 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'); 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_numColours') .array('m_liveryColours', { length: 4, type: new LiveryColourParser(), }); } } } exports.ParticipantDataParser = ParticipantDataParser; //# sourceMappingURL=ParticipantDataParser.js.map