UNPKG

node-insim

Version:

An InSim library for NodeJS with TypeScript support

68 lines (67 loc) 2.17 kB
import { __decorate } from "tslib"; import { byte, word } from '../decorators'; import { copyBuffer } from '../lfspack'; import { Packet } from './base'; import { PacketType } from './enums'; import { CarContOBJ } from './structs'; /** * Hot Lap Validity - off track / hit wall / speeding in pits / out of bounds * * Set the {@link ISF_HLV} flag in the {@link IS_ISI} to receive reports of incidents that would violate HLVC. */ export class IS_HLV extends Packet { constructor() { super(...arguments); this.Size = 16; this.Type = PacketType.ISP_HLV; this.ReqI = 0; /** Player's unique id */ this.PLID = 0; /** 0: ground / 1: wall / 4: speeding / 5: out of bounds */ this.HLVC = 0; this.Sp1 = 0; /** Looping time stamp (hundredths - time since reset - like {@link TINY_GTH}) */ this.Time = 0; /** Car contact object */ this.C = new CarContOBJ(); } unpack(buffer) { super.unpack(buffer); const start = this.getFormatSize(); const carContactBuffer = copyBuffer(buffer.slice(start, start + new CarContOBJ().getFormatSize())); this.C = new CarContOBJ().unpack(carContactBuffer); return this; } } __decorate([ byte() ], IS_HLV.prototype, "Size", void 0); __decorate([ byte() ], IS_HLV.prototype, "Type", void 0); __decorate([ byte() ], IS_HLV.prototype, "ReqI", void 0); __decorate([ byte() ], IS_HLV.prototype, "PLID", void 0); __decorate([ byte() ], IS_HLV.prototype, "HLVC", void 0); __decorate([ byte() ], IS_HLV.prototype, "Sp1", void 0); __decorate([ word() ], IS_HLV.prototype, "Time", void 0); export var HLVCViolation; (function (HLVCViolation) { /** Car drove off track */ HLVCViolation[HLVCViolation["GROUND"] = 0] = "GROUND"; /** Car hit a wall */ HLVCViolation[HLVCViolation["WALL"] = 1] = "WALL"; /** Car was speeding in pit lane */ HLVCViolation[HLVCViolation["SPEEDING"] = 4] = "SPEEDING"; /** Car went out of bounds */ HLVCViolation[HLVCViolation["OUT_OF_BOUNDS"] = 5] = "OUT_OF_BOUNDS"; })(HLVCViolation || (HLVCViolation = {}));