UNPKG

node-insim

Version:

An InSim library for NodeJS with TypeScript support

146 lines (145 loc) 5.56 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __read = (this && this.__read) || function (o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; }; var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (ar || !(i in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i); ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.AIFlags = exports.IS_AII = void 0; var decorators_1 = require("../decorators"); var OutSimMain_1 = require("../out/OutSimMain"); var base_1 = require("./base"); var enums_1 = require("./enums"); var IS_AIC_1 = require("./IS_AIC"); /** * AI car info * * Send a {@link SMALL_AII} with UVal set to PLID to receive current information about a local car. */ var IS_AII = /** @class */ (function (_super) { __extends(IS_AII, _super); function IS_AII() { var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this; _this.Size = 96; _this.Type = enums_1.PacketType.ISP_AII; /** ReqI from the {@link SMALL_AII} request packet */ _this.ReqI = 0; _this.PLID = 0; /** Identical to {@link OutSimMain} */ _this.OSData = new OutSimMain_1.OutSimMain(); _this.Flags = 0; /** Reverse: 0, Neutral: 1, First: 2... */ _this.Gear = IS_AIC_1.AICGear.REVERSE; _this.Sp2 = 0; _this.Sp3 = 0; _this.RPM = 0; _this.SpF0 = 0; _this.SpF1 = 0; /** Dash lights currently switched on (see DL_x in OutGauge section below) */ _this.ShowLights = 0; _this.SPU1 = 0; _this.SPU2 = 0; _this.SPU3 = 0; return _this; } __decorate([ (0, decorators_1.byte)() ], IS_AII.prototype, "Size", void 0); __decorate([ (0, decorators_1.byte)() ], IS_AII.prototype, "Type", void 0); __decorate([ (0, decorators_1.byte)() ], IS_AII.prototype, "ReqI", void 0); __decorate([ (0, decorators_1.byte)() ], IS_AII.prototype, "PLID", void 0); __decorate([ (0, decorators_1.struct)(OutSimMain_1.OutSimMain) ], IS_AII.prototype, "OSData", void 0); __decorate([ (0, decorators_1.byte)() ], IS_AII.prototype, "Flags", void 0); __decorate([ (0, decorators_1.byte)() ], IS_AII.prototype, "Gear", void 0); __decorate([ (0, decorators_1.byte)() ], IS_AII.prototype, "Sp2", void 0); __decorate([ (0, decorators_1.byte)() ], IS_AII.prototype, "Sp3", void 0); __decorate([ (0, decorators_1.float)() ], IS_AII.prototype, "RPM", void 0); __decorate([ (0, decorators_1.float)() ], IS_AII.prototype, "SpF0", void 0); __decorate([ (0, decorators_1.float)() ], IS_AII.prototype, "SpF1", void 0); __decorate([ (0, decorators_1.unsigned)() ], IS_AII.prototype, "ShowLights", void 0); __decorate([ (0, decorators_1.unsigned)() ], IS_AII.prototype, "SPU1", void 0); __decorate([ (0, decorators_1.unsigned)() ], IS_AII.prototype, "SPU2", void 0); __decorate([ (0, decorators_1.unsigned)() ], IS_AII.prototype, "SPU3", void 0); return IS_AII; }(base_1.Packet)); exports.IS_AII = IS_AII; var AIFlags; (function (AIFlags) { /** Detect if engine running */ AIFlags[AIFlags["AIFLAGS_IGNITION"] = 1] = "AIFLAGS_IGNITION"; /** Upshift lever currently held */ AIFlags[AIFlags["AIFLAGS_CHUP"] = 4] = "AIFLAGS_CHUP"; /** Downshift lever currently held */ AIFlags[AIFlags["AIFLAGS_CHDN"] = 8] = "AIFLAGS_CHDN"; })(AIFlags || (exports.AIFlags = AIFlags = {}));