node-insim
Version:
An InSim library for NodeJS with TypeScript support
202 lines (201 loc) • 6.19 kB
JavaScript
import { __decorate } from "tslib";
import { byte, carName, string, stringNull, word } from '../decorators';
import { Packet } from './base';
import { PacketType } from './enums';
/**
* New PLayer joining race (if PLID already exists, then leaving pits)
*/
export class IS_NPL extends Packet {
constructor() {
super(...arguments);
this.Size = 76;
this.Type = PacketType.ISP_NPL;
/** 0 unless this is a reply to a {@link TINY_NPL} */
this.ReqI = 0;
/** Player's newly assigned unique id */
this.PLID = 0;
/** Connection's unique id */
this.UCID = 0;
/** Bit 0: female / bit 1: AI / bit 2: remote */
this.PType = 0;
/** Player flags */
this.Flags = 0;
/** Nickname */
this.PName = '';
/** Number plate - NO ZERO AT END! */
this.Plate = '';
/**
* Car name
*
* The value can be one of these:
* - a 3-character abbreviation of an official LFS car (e.g. XRT)
* - a hexadecimal string representation of a car mod's SkinID (e.g. 5882E6)
*/
this.CName = '';
/** Skin name - MAX_CAR_TEX_NAME */
this.SName = '';
/** Rear left tyre compound */
this.TyreRL = 0;
/** Rear right tyre compound */
this.TyreRR = 0;
/** Front left tyre compound */
this.TyreFL = 0;
/** Front right tyre compound */
this.TyreFR = 0;
/** Added mass (kg) */
this.H_Mass = 0;
/** Intake restriction */
this.H_TRes = 0;
/** Driver model */
this.Model = 0;
/** Passengers byte */
this.Pass = 0;
/** Low 4 bits: tyre width reduction (rear) */
this.RWAdj = 0;
/** Low 4 bits: tyre width reduction (front) */
this.FWAdj = 0;
this.Sp2 = 0;
this.Sp3 = 0;
/** Setup flags */
this.SetF = 0;
/** Number in race - ZERO if this is a join request */
this.NumP = 0;
/**
* Configuration
*
* - UF1 / LX4 / LX6: 0 = DEFAULT / 1 = OPEN ROOF
* - GTR racing cars: 0 = DEFAULT / 1 = ALTERNATE
*/
this.Config = CarConfiguration.DEFAULT;
/** /showfuel yes: fuel percent / no: 255 */
this.Fuel = 0;
}
}
__decorate([
byte()
], IS_NPL.prototype, "Size", void 0);
__decorate([
byte()
], IS_NPL.prototype, "Type", void 0);
__decorate([
byte()
], IS_NPL.prototype, "ReqI", void 0);
__decorate([
byte()
], IS_NPL.prototype, "PLID", void 0);
__decorate([
byte()
], IS_NPL.prototype, "UCID", void 0);
__decorate([
byte()
], IS_NPL.prototype, "PType", void 0);
__decorate([
word()
], IS_NPL.prototype, "Flags", void 0);
__decorate([
stringNull(24)
], IS_NPL.prototype, "PName", void 0);
__decorate([
string(8)
], IS_NPL.prototype, "Plate", void 0);
__decorate([
carName()
], IS_NPL.prototype, "CName", void 0);
__decorate([
stringNull(16)
], IS_NPL.prototype, "SName", void 0);
__decorate([
byte()
], IS_NPL.prototype, "TyreRL", void 0);
__decorate([
byte()
], IS_NPL.prototype, "TyreRR", void 0);
__decorate([
byte()
], IS_NPL.prototype, "TyreFL", void 0);
__decorate([
byte()
], IS_NPL.prototype, "TyreFR", void 0);
__decorate([
byte()
], IS_NPL.prototype, "H_Mass", void 0);
__decorate([
byte()
], IS_NPL.prototype, "H_TRes", void 0);
__decorate([
byte()
], IS_NPL.prototype, "Model", void 0);
__decorate([
byte()
], IS_NPL.prototype, "Pass", void 0);
__decorate([
byte()
], IS_NPL.prototype, "RWAdj", void 0);
__decorate([
byte()
], IS_NPL.prototype, "FWAdj", void 0);
__decorate([
byte()
], IS_NPL.prototype, "Sp2", void 0);
__decorate([
byte()
], IS_NPL.prototype, "Sp3", void 0);
__decorate([
byte()
], IS_NPL.prototype, "SetF", void 0);
__decorate([
byte()
], IS_NPL.prototype, "NumP", void 0);
__decorate([
byte()
], IS_NPL.prototype, "Config", void 0);
__decorate([
byte()
], IS_NPL.prototype, "Fuel", void 0);
export var CarConfiguration;
(function (CarConfiguration) {
/** Default */
CarConfiguration[CarConfiguration["DEFAULT"] = 0] = "DEFAULT";
/**
* UF1 / LX4 / LX6 = open roof
* GTR racing cars = alternate
*/
CarConfiguration[CarConfiguration["OPEN_ROOF_OR_ALTERNATE"] = 1] = "OPEN_ROOF_OR_ALTERNATE";
})(CarConfiguration || (CarConfiguration = {}));
export var PassengerFlags;
(function (PassengerFlags) {
/** Front passenger is male */
PassengerFlags[PassengerFlags["FRONT_MALE"] = 1] = "FRONT_MALE";
/** Front passenger is female */
PassengerFlags[PassengerFlags["FRONT_FEMALE"] = 2] = "FRONT_FEMALE";
/** Rear-left passenger is male */
PassengerFlags[PassengerFlags["REAR_LEFT_MALE"] = 4] = "REAR_LEFT_MALE";
/** Rear-left passenger is female */
PassengerFlags[PassengerFlags["REAR_LEFT_FEMALE"] = 8] = "REAR_LEFT_FEMALE";
/** Rear-middle passenger is male */
PassengerFlags[PassengerFlags["REAR_MIDDLE_MALE"] = 16] = "REAR_MIDDLE_MALE";
/** Rear-middle passenger is female */
PassengerFlags[PassengerFlags["REAR_MIDDLE_FEMALE"] = 32] = "REAR_MIDDLE_FEMALE";
/** Rear-right passenger is male */
PassengerFlags[PassengerFlags["REAR_RIGHT_MALE"] = 64] = "REAR_RIGHT_MALE";
/** Rear-right passenger is female */
PassengerFlags[PassengerFlags["REAR_RIGHT_FEMALE"] = 128] = "REAR_RIGHT_FEMALE";
})(PassengerFlags || (PassengerFlags = {}));
export var PlayerType;
(function (PlayerType) {
/** Female */
PlayerType[PlayerType["FEMALE"] = 1] = "FEMALE";
/** AI */
PlayerType[PlayerType["AI"] = 2] = "AI";
/** Remote */
PlayerType[PlayerType["REMOTE"] = 4] = "REMOTE";
})(PlayerType || (PlayerType = {}));
export var SetupFlags;
(function (SetupFlags) {
/** Symmetrical wheels */
SetupFlags[SetupFlags["SETF_SYMM_WHEELS"] = 1] = "SETF_SYMM_WHEELS";
/** Traction control enabled */
SetupFlags[SetupFlags["SETF_TC_ENABLE"] = 2] = "SETF_TC_ENABLE";
/** Anti-lock brakes enabled */
SetupFlags[SetupFlags["SETF_ABS_ENABLE"] = 4] = "SETF_ABS_ENABLE";
})(SetupFlags || (SetupFlags = {}));