UNPKG

node-insim

Version:

An InSim library for NodeJS with TypeScript support

188 lines (187 loc) 7.28 kB
import { __decorate } from "tslib"; import { byte, unsigned } from '../decorators'; import { SendablePacket } from './base'; import { PacketType } from './enums'; /** * General purpose 8 byte packet */ export class IS_SMALL extends SendablePacket { constructor(data) { super(); this.Size = 8; this.Type = PacketType.ISP_SMALL; /** 0 unless it is an info request or a reply to an info request */ this.ReqI = 0; /** Subtype */ this.SubT = SmallType.SMALL_NONE; /** Value (e.g. for {@link SMALL_SSP} this would be the OutSim packet rate) */ this.UVal = 0; this.initialize(data); } } /** Stop sending positions */ IS_SMALL.SSP_STOP_SENDING = 0; /** Stop sending gauges */ IS_SMALL.SSG_STOP_SENDING = 0; /** Stop time */ IS_SMALL.TMS_STOP = 1; /** Start time */ IS_SMALL.TMS_CONTINUE = 0; /** Stop sending {@link IS_NLP} or {@link IS_MCI} packets */ IS_SMALL.NLI_STOP = 0; __decorate([ byte() ], IS_SMALL.prototype, "Size", void 0); __decorate([ byte() ], IS_SMALL.prototype, "Type", void 0); __decorate([ byte() ], IS_SMALL.prototype, "ReqI", void 0); __decorate([ byte() ], IS_SMALL.prototype, "SubT", void 0); __decorate([ unsigned() ], IS_SMALL.prototype, "UVal", void 0); export var SmallType; (function (SmallType) { /** Not used */ SmallType[SmallType["SMALL_NONE"] = 0] = "SMALL_NONE"; /** Instruction: start sending positions */ SmallType[SmallType["SMALL_SSP"] = 1] = "SMALL_SSP"; /** Instruction: start sending gauges */ SmallType[SmallType["SMALL_SSG"] = 2] = "SMALL_SSG"; /** Report: vote action */ SmallType[SmallType["SMALL_VTA"] = 3] = "SMALL_VTA"; /** Instruction: time stop */ SmallType[SmallType["SMALL_TMS"] = 4] = "SMALL_TMS"; /** Instruction: time step */ SmallType[SmallType["SMALL_STP"] = 5] = "SMALL_STP"; /** Info: race time packet (reply to {@link TINY_GTH}) */ SmallType[SmallType["SMALL_RTP"] = 6] = "SMALL_RTP"; /** Instruction: set node lap interval */ SmallType[SmallType["SMALL_NLI"] = 7] = "SMALL_NLI"; /** Both ways: set or get allowed cars ({@link TINY_ALC}) */ SmallType[SmallType["SMALL_ALC"] = 8] = "SMALL_ALC"; /** Instruction: set local car switches (flash, horn, siren) */ SmallType[SmallType["SMALL_LCS"] = 9] = "SMALL_LCS"; /** Instruction: set local car lights */ SmallType[SmallType["SMALL_LCL"] = 10] = "SMALL_LCL"; /** Info: Get local AI info */ SmallType[SmallType["SMALL_AII"] = 11] = "SMALL_AII"; })(SmallType || (SmallType = {})); export const SENDABLE_SMALL_TYPES = [ SmallType.SMALL_SSP, SmallType.SMALL_SSG, SmallType.SMALL_TMS, SmallType.SMALL_STP, SmallType.SMALL_NLI, SmallType.SMALL_ALC, SmallType.SMALL_LCS, SmallType.SMALL_LCL, SmallType.SMALL_AII, ]; const LCL_SET_SIGNALS = 1; const LCL_SET_LIGHTS = 4; const LCL_SET_FOG_REAR = 16; const LCL_SET_FOG_FRONT = 32; const LCL_SET_EXTRA = 64; export var LocalCarLights; (function (LocalCarLights) { /** Turn all signals off */ LocalCarLights[LocalCarLights["SIGNALS_OFF"] = 1] = "SIGNALS_OFF"; /** Turn left signals on */ LocalCarLights[LocalCarLights["SIGNALS_LEFT"] = 65537] = "SIGNALS_LEFT"; /** Turn right signals on */ LocalCarLights[LocalCarLights["SIGNALS_RIGHT"] = 131073] = "SIGNALS_RIGHT"; /** Turn hazards on */ LocalCarLights[LocalCarLights["SIGNALS_HAZARD"] = 196609] = "SIGNALS_HAZARD"; /** Turn lights off */ LocalCarLights[LocalCarLights["LIGHTS_OFF"] = 4] = "LIGHTS_OFF"; /** Turn side lights on */ LocalCarLights[LocalCarLights["LIGHTS_SIDE"] = 262148] = "LIGHTS_SIDE"; /** Turn low beam on */ LocalCarLights[LocalCarLights["LIGHTS_LOW"] = 524292] = "LIGHTS_LOW"; /** Turn high beam on */ LocalCarLights[LocalCarLights["LIGHTS_HIGH"] = 786436] = "LIGHTS_HIGH"; /** Turn rear fog light off */ LocalCarLights[LocalCarLights["FOG_REAR_OFF"] = 16] = "FOG_REAR_OFF"; /** Turn rear fog light on */ LocalCarLights[LocalCarLights["FOG_REAR"] = 1048592] = "FOG_REAR"; /** Turn front fog light off */ LocalCarLights[LocalCarLights["FOG_FRONT_OFF"] = 32] = "FOG_FRONT_OFF"; /** Turn front fog light on */ LocalCarLights[LocalCarLights["FOG_FRONT"] = 2097184] = "FOG_FRONT"; /** Turn extra light off */ LocalCarLights[LocalCarLights["EXTRA_OFF"] = 64] = "EXTRA_OFF"; /** Turn extra light on */ LocalCarLights[LocalCarLights["EXTRA"] = 4194368] = "EXTRA"; })(LocalCarLights || (LocalCarLights = {})); const LCS_SET_SIGNALS = 1; const LCS_SET_FLASH = 2; const LCS_SET_HEADLIGHTS = 4; const LCS_SET_HORN = 8; const LCS_SET_SIREN = 16; export var LocalCarSwitches; (function (LocalCarSwitches) { /** * Turn all signals off * * @deprecated Use {@link SMALL_LCL} with {@link LocalCarLights.SIGNALS_OFF} */ LocalCarSwitches[LocalCarSwitches["SIGNALS_OFF"] = 1] = "SIGNALS_OFF"; /** * Turn left signals on * * @deprecated Use {@link SMALL_LCL} with {@link LocalCarLights.SIGNALS_LEFT} */ LocalCarSwitches[LocalCarSwitches["SIGNALS_LEFT"] = 257] = "SIGNALS_LEFT"; /** * Turn right signals on * * @deprecated Use {@link SMALL_LCL} with {@link LocalCarLights.SIGNALS_RIGHT} */ LocalCarSwitches[LocalCarSwitches["SIGNALS_RIGHT"] = 513] = "SIGNALS_RIGHT"; /** * Turn hazards on * * @deprecated Use {@link SMALL_LCL} with {@link LocalCarLights.SIGNALS_HAZARD} */ LocalCarSwitches[LocalCarSwitches["SIGNALS_HAZARD"] = 769] = "SIGNALS_HAZARD"; /** Stop flashing lights */ LocalCarSwitches[LocalCarSwitches["FLASH_OFF"] = 2] = "FLASH_OFF"; /** Start flashing lights */ LocalCarSwitches[LocalCarSwitches["FLASH_ON"] = 1026] = "FLASH_ON"; /** * Turn headlights off * * @deprecated Use {@link SMALL_LCL} with {@link LocalCarLights.LIGHTS_OFF} */ LocalCarSwitches[LocalCarSwitches["HEADLIGHTS_OFF"] = 4] = "HEADLIGHTS_OFF"; /** * Turn headlights on * * @deprecated Use {@link SMALL_LCL} with {@link LocalCarLights.LIGHTS_SIDE}, {@link LocalCarLights.LIGHTS_LOW} or * {@link LocalCarLights.LIGHTS_HIGH} */ LocalCarSwitches[LocalCarSwitches["HEADLIGHTS_ON"] = 2052] = "HEADLIGHTS_ON"; /** Turn horn off */ LocalCarSwitches[LocalCarSwitches["HORN_OFF"] = 8] = "HORN_OFF"; /** Turn on horn sound 1 */ LocalCarSwitches[LocalCarSwitches["HORN_1"] = 65544] = "HORN_1"; /** Turn on horn sound 2 */ LocalCarSwitches[LocalCarSwitches["HORN_2"] = 131080] = "HORN_2"; /** Turn on horn sound 3 */ LocalCarSwitches[LocalCarSwitches["HORN_3"] = 196616] = "HORN_3"; /** Turn on horn sound 4 */ LocalCarSwitches[LocalCarSwitches["HORN_4"] = 262152] = "HORN_4"; /** Turn on horn sound 5 */ LocalCarSwitches[LocalCarSwitches["HORN_5"] = 327688] = "HORN_5"; /** Turn siren off */ LocalCarSwitches[LocalCarSwitches["SIREN_OFF"] = 16] = "SIREN_OFF"; /** Turn fast siren on */ LocalCarSwitches[LocalCarSwitches["SIREN_FAST"] = 1048592] = "SIREN_FAST"; /** Turn slow siren on */ LocalCarSwitches[LocalCarSwitches["SIREN_SLOW"] = 2097168] = "SIREN_SLOW"; })(LocalCarSwitches || (LocalCarSwitches = {}));