UNPKG

node-insim

Version:

An InSim library for NodeJS with TypeScript support

126 lines (125 loc) 3.67 kB
import { __decorate } from "tslib"; import { byte, float, stringNull, word } from '../decorators'; import { Packet } from './base'; import { PacketType, ViewIdentifier } from './enums'; /** * STAte * * LFS will send an {@link IS_STA} any time the info in it changes. * * To request an IS_STA at any time, send an {@link IS_TINY} * with {@link IS_TINY.SubT} of {@link TinyType.TINY_SST}. */ export class IS_STA extends Packet { constructor() { super(...arguments); this.Size = 28; this.Type = PacketType.ISP_STA; /** ReqI if replying to a request packet */ this.ReqI = 0; this.Zero = 0; /** 4-byte float - 1.0 is normal speed */ this.ReplaySpeed = 0; /** ISS state flags */ this.Flags = 0; /** Which type of camera is selected (which is still selected * even if LFS is actually in SHIFT+U mode) */ this.InGameCam = ViewIdentifier.VIEW_FOLLOW; /** Unique ID of viewed player (0 = none) */ this.ViewPLID = 0; /** Number of players in race */ this.NumP = 0; /** Number of connections including host */ this.NumConns = 0; /** Number finished or qualified */ this.NumFinished = 0; /** 0 = no race / 1 = race / 2 = qualifying */ this.RaceInProg = 0; /** Qualifying length in minutes */ this.QualMins = 0; /** * RaceLaps (rl): (various meanings depending on range) * * 0 : practice * 1-99 : number of laps... laps = rl * 100-190 : 100 to 1000 laps... laps = (rl - 100) * 10 + 100 * 191-238 : 1 to 48 hours... hours = rl - 190 */ this.RaceLaps = 0; this.Sp2 = 0; /** 0 = unknown / 1 = success / > 1 = fail */ this.ServerStatus = 0; /** Short name for track e.g. FE2R */ this.Track = ''; this.Weather = 0; this.Wind = 0; } } __decorate([ byte() ], IS_STA.prototype, "Size", void 0); __decorate([ byte() ], IS_STA.prototype, "Type", void 0); __decorate([ byte() ], IS_STA.prototype, "ReqI", void 0); __decorate([ byte() ], IS_STA.prototype, "Zero", void 0); __decorate([ float() ], IS_STA.prototype, "ReplaySpeed", void 0); __decorate([ word() ], IS_STA.prototype, "Flags", void 0); __decorate([ byte() ], IS_STA.prototype, "InGameCam", void 0); __decorate([ byte() ], IS_STA.prototype, "ViewPLID", void 0); __decorate([ byte() ], IS_STA.prototype, "NumP", void 0); __decorate([ byte() ], IS_STA.prototype, "NumConns", void 0); __decorate([ byte() ], IS_STA.prototype, "NumFinished", void 0); __decorate([ byte() ], IS_STA.prototype, "RaceInProg", void 0); __decorate([ byte() ], IS_STA.prototype, "QualMins", void 0); __decorate([ byte() ], IS_STA.prototype, "RaceLaps", void 0); __decorate([ byte() ], IS_STA.prototype, "Sp2", void 0); __decorate([ byte() ], IS_STA.prototype, "ServerStatus", void 0); __decorate([ stringNull(6) ], IS_STA.prototype, "Track", void 0); __decorate([ byte() ], IS_STA.prototype, "Weather", void 0); __decorate([ byte() ], IS_STA.prototype, "Wind", void 0); export var RaceState; (function (RaceState) { RaceState[RaceState["NO_RACE"] = 0] = "NO_RACE"; RaceState[RaceState["RACE"] = 1] = "RACE"; RaceState[RaceState["QUALIFYING"] = 2] = "QUALIFYING"; })(RaceState || (RaceState = {})); export var ServerStatus; (function (ServerStatus) { ServerStatus[ServerStatus["UNKNOWN"] = 0] = "UNKNOWN"; ServerStatus[ServerStatus["SUCCESS"] = 1] = "SUCCESS"; })(ServerStatus || (ServerStatus = {}));