node-insim
Version:
An InSim library for NodeJS with TypeScript support
161 lines (160 loc) • 7.38 kB
JavaScript
;
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.ShiftUInterfaceSubmode = exports.NormalInterfaceSubmode = exports.GarageInterfaceSubmode = exports.InterfaceMode = exports.IS_CIM = void 0;
var decorators_1 = require("../decorators");
var base_1 = require("./base");
var enums_1 = require("./enums");
/**
* Conn Interface Mode
*/
var IS_CIM = /** @class */ (function (_super) {
__extends(IS_CIM, _super);
function IS_CIM() {
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
_this.Size = 8;
_this.Type = enums_1.PacketType.ISP_CIM;
_this.ReqI = 0;
/** Connection's unique id (0 = local) */
_this.UCID = 0;
/** Mode identifier */
_this.Mode = 0;
/** Submode identifier */
_this.SubMode = 0;
/** Selected object type */
_this.SelType = 0;
_this.Sp3 = 0;
return _this;
}
__decorate([
(0, decorators_1.byte)()
], IS_CIM.prototype, "Size", void 0);
__decorate([
(0, decorators_1.byte)()
], IS_CIM.prototype, "Type", void 0);
__decorate([
(0, decorators_1.byte)()
], IS_CIM.prototype, "ReqI", void 0);
__decorate([
(0, decorators_1.byte)()
], IS_CIM.prototype, "UCID", void 0);
__decorate([
(0, decorators_1.byte)()
], IS_CIM.prototype, "Mode", void 0);
__decorate([
(0, decorators_1.byte)()
], IS_CIM.prototype, "SubMode", void 0);
__decorate([
(0, decorators_1.byte)()
], IS_CIM.prototype, "SelType", void 0);
__decorate([
(0, decorators_1.byte)()
], IS_CIM.prototype, "Sp3", void 0);
return IS_CIM;
}(base_1.Packet));
exports.IS_CIM = IS_CIM;
var InterfaceMode;
(function (InterfaceMode) {
/** Not in a special mode */
InterfaceMode[InterfaceMode["CIM_NORMAL"] = 0] = "CIM_NORMAL";
/** In the options menu */
InterfaceMode[InterfaceMode["CIM_OPTIONS"] = 1] = "CIM_OPTIONS";
/** In the host's options menu */
InterfaceMode[InterfaceMode["CIM_HOST_OPTIONS"] = 2] = "CIM_HOST_OPTIONS";
/** In the garage */
InterfaceMode[InterfaceMode["CIM_GARAGE"] = 3] = "CIM_GARAGE";
/** In the car selection menu */
InterfaceMode[InterfaceMode["CIM_CAR_SELECT"] = 4] = "CIM_CAR_SELECT";
/** In the track selection menu */
InterfaceMode[InterfaceMode["CIM_TRACK_SELECT"] = 5] = "CIM_TRACK_SELECT";
/** In the free view mode (SHIT + U) */
InterfaceMode[InterfaceMode["CIM_SHIFTU"] = 6] = "CIM_SHIFTU";
})(InterfaceMode || (exports.InterfaceMode = InterfaceMode = {}));
var GarageInterfaceSubmode;
(function (GarageInterfaceSubmode) {
/** Info tab */
GarageInterfaceSubmode[GarageInterfaceSubmode["GRG_INFO"] = 0] = "GRG_INFO";
/** Colours tab */
GarageInterfaceSubmode[GarageInterfaceSubmode["GRG_COLOURS"] = 1] = "GRG_COLOURS";
/** Brakes / TC tab */
GarageInterfaceSubmode[GarageInterfaceSubmode["GRG_BRAKE_TC"] = 2] = "GRG_BRAKE_TC";
/** Suspension tab */
GarageInterfaceSubmode[GarageInterfaceSubmode["GRG_SUSP"] = 3] = "GRG_SUSP";
/** Steering tab */
GarageInterfaceSubmode[GarageInterfaceSubmode["GRG_STEER"] = 4] = "GRG_STEER";
/** Final Drive tab */
GarageInterfaceSubmode[GarageInterfaceSubmode["GRG_DRIVE"] = 5] = "GRG_DRIVE";
/** Tyres tab */
GarageInterfaceSubmode[GarageInterfaceSubmode["GRG_TYRES"] = 6] = "GRG_TYRES";
/** Downforce tab */
GarageInterfaceSubmode[GarageInterfaceSubmode["GRG_AERO"] = 7] = "GRG_AERO";
/** Undocumented */
GarageInterfaceSubmode[GarageInterfaceSubmode["GRG_PASS"] = 8] = "GRG_PASS";
})(GarageInterfaceSubmode || (exports.GarageInterfaceSubmode = GarageInterfaceSubmode = {}));
var NormalInterfaceSubmode;
(function (NormalInterfaceSubmode) {
/** Not in a specific view */
NormalInterfaceSubmode[NormalInterfaceSubmode["NRM_NORMAL"] = 0] = "NRM_NORMAL";
/** User is viewing the car's wheel temperature (F9) */
NormalInterfaceSubmode[NormalInterfaceSubmode["NRM_WHEEL_TEMPS"] = 1] = "NRM_WHEEL_TEMPS";
/** User is viewing the car's wheel damage (F10) */
NormalInterfaceSubmode[NormalInterfaceSubmode["NRM_WHEEL_DAMAGE"] = 2] = "NRM_WHEEL_DAMAGE";
/** User is viewing the setting pane for the car (F11) */
NormalInterfaceSubmode[NormalInterfaceSubmode["NRM_LIVE_SETTINGS"] = 3] = "NRM_LIVE_SETTINGS";
/** User is viewing the pit instructions pane (F12) */
NormalInterfaceSubmode[NormalInterfaceSubmode["NRM_PIT_INSTRUCTIONS"] = 4] = "NRM_PIT_INSTRUCTIONS";
})(NormalInterfaceSubmode || (exports.NormalInterfaceSubmode = NormalInterfaceSubmode = {}));
var ShiftUInterfaceSubmode;
(function (ShiftUInterfaceSubmode) {
/** No buttons displayed */
ShiftUInterfaceSubmode[ShiftUInterfaceSubmode["FVM_PLAIN"] = 0] = "FVM_PLAIN";
/** Buttons displayed (not editing) */
ShiftUInterfaceSubmode[ShiftUInterfaceSubmode["FVM_BUTTONS"] = 1] = "FVM_BUTTONS";
/** Edit mode */
ShiftUInterfaceSubmode[ShiftUInterfaceSubmode["FVM_EDIT"] = 2] = "FVM_EDIT";
})(ShiftUInterfaceSubmode || (exports.ShiftUInterfaceSubmode = ShiftUInterfaceSubmode = {}));