UNPKG

node-insim

Version:

An InSim library for NodeJS with TypeScript support

88 lines (87 loc) 3.91 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; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.IS_REO = void 0; var decorators_1 = require("../decorators"); var base_1 = require("./base"); var enums_1 = require("./enums"); /** * REOrder (when race restarts after qualifying) * * This packet can be sent in either direction * * LFS sends one at the start of every race or qualifying session, listing the start order * * You can send one to LFS in two different ways, to specify the starting order: * - In the race setup screen, to immediately rearrange the grid when the packet arrives * - In game, just before a restart or exit, to specify the order on the restart or exit * * If you are sending an {@link IS_REO} in game, you should send it when you receive the {@link SMALL_VTA} * informing you that the Vote Action ({@link VOTE_END} / {@link VOTE_RESTART} / {@link VOTE_QUALIFY}) is about * to take place. Any {@link IS_REO} received before the {@link SMALL_VTA} is sent will be ignored. * * To request an {@link IS_REO} packet at any time, send this {@link IS_TINY}: * * - ReqI: non-zero (returned in the reply) * - SubT: {@link TINY_REO} (request an IS_REO) */ var IS_REO = /** @class */ (function (_super) { __extends(IS_REO, _super); function IS_REO(data) { var _this = _super.call(this) || this; _this.Size = 52; _this.Type = enums_1.PacketType.ISP_REO; /** 0 unless this is a reply to an {@link TINY_REO} request */ _this.ReqI = 0; /** Number of players in race */ _this.NumP = 0; /** All PLIDs in new order */ _this.PLID = Array(40).fill(0); _this.initialize(data); return _this; } IS_REO.prototype.pack = function () { if (this.PLID.length > IS_REO.REO_MAX_PLAYERS) { throw new RangeError("IS_REO - Too many players (max is ".concat(IS_REO.REO_MAX_PLAYERS)); } return _super.prototype.pack.call(this); }; IS_REO.REO_MAX_PLAYERS = 48; __decorate([ (0, decorators_1.byte)() ], IS_REO.prototype, "Size", void 0); __decorate([ (0, decorators_1.byte)() ], IS_REO.prototype, "Type", void 0); __decorate([ (0, decorators_1.byte)() ], IS_REO.prototype, "ReqI", void 0); __decorate([ (0, decorators_1.byte)() ], IS_REO.prototype, "NumP", void 0); __decorate([ (0, decorators_1.byteArray)(IS_REO.REO_MAX_PLAYERS) ], IS_REO.prototype, "PLID", void 0); return IS_REO; }(base_1.SendablePacket)); exports.IS_REO = IS_REO;