UNPKG

node-insim

Version:

An InSim library for NodeJS with TypeScript support

89 lines (88 loc) 2.83 kB
import { __decorate } from "tslib"; import { byte, int, short, word } from '../../decorators'; import { Struct } from '../base'; export class CompCar extends Struct { constructor(data) { super(); /** Current path node */ this.Node = 0; /** Current lap */ this.Lap = 0; /** Player's unique id */ this.PLID = 0; /** Current race position: 0 = unknown, 1 = leader, etc... */ this.Position = 0; /** Flags and other info */ this.Info = 0; this.Sp3 = 0; /** X map (65536 = 1 metre) */ this.X = 0; /** Y map (65536 = 1 metre) */ this.Y = 0; /** Z alt (65536 = 1 metre) */ this.Z = 0; /** Speed (32768 = 100 m/s) */ this.Speed = 0; /** car's motion if Speed > 0: 0 = world y direction, 32768 = 180 deg */ this.Direction = 0; /** direction of forward axis: 0 = world y direction, 32768 = 180 deg anticlockwise from above */ this.Heading = 0; /** Signed, rate of change of heading: (8192 = 180 deg/s anticlockwise) */ this.AngVel = 0; this.initialize(data); } } __decorate([ word() ], CompCar.prototype, "Node", void 0); __decorate([ word() ], CompCar.prototype, "Lap", void 0); __decorate([ byte() ], CompCar.prototype, "PLID", void 0); __decorate([ byte() ], CompCar.prototype, "Position", void 0); __decorate([ byte() ], CompCar.prototype, "Info", void 0); __decorate([ byte() ], CompCar.prototype, "Sp3", void 0); __decorate([ int() ], CompCar.prototype, "X", void 0); __decorate([ int() ], CompCar.prototype, "Y", void 0); __decorate([ int() ], CompCar.prototype, "Z", void 0); __decorate([ word() ], CompCar.prototype, "Speed", void 0); __decorate([ word() ], CompCar.prototype, "Direction", void 0); __decorate([ word() ], CompCar.prototype, "Heading", void 0); __decorate([ short() ], CompCar.prototype, "AngVel", void 0); export var CompCarFlags; (function (CompCarFlags) { /** This car is in the way of a driver who is a lap ahead */ CompCarFlags[CompCarFlags["CCI_BLUE"] = 1] = "CCI_BLUE"; /** This car is slow or stopped and in a dangerous place */ CompCarFlags[CompCarFlags["CCI_YELLOW"] = 2] = "CCI_YELLOW"; /** This car is outside the path */ CompCarFlags[CompCarFlags["CCI_OOB"] = 4] = "CCI_OOB"; /** This car is lagging (missing or delayed position packets) */ CompCarFlags[CompCarFlags["CCI_LAG"] = 32] = "CCI_LAG"; /** This is the first compcar in this set of MCI packets */ CompCarFlags[CompCarFlags["CCI_FIRST"] = 64] = "CCI_FIRST"; /** This is the last compcar in this set of MCI packets */ CompCarFlags[CompCarFlags["CCI_LAST"] = 128] = "CCI_LAST"; })(CompCarFlags || (CompCarFlags = {}));