node-insim
Version:
An InSim library for NodeJS with TypeScript support
107 lines (106 loc) • 4.46 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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ObjectFlags = exports.ObjectInfo = void 0;
var decorators_1 = require("../../decorators");
var base_1 = require("../base");
var ObjectInfo = /** @class */ (function (_super) {
__extends(ObjectInfo, _super);
function ObjectInfo(data) {
var _this = _super.call(this) || this;
/** Position (1 metre = 16) */
_this.X = 0;
/** Position (1 metre = 16) */
_this.Y = 0;
/**
* Height (1m = 4)
*
* About Zbyte, the approximate altitude :
*
* LFS does contact checks to place objects accurately on the ground.
*
* For output purposes : Zbyte indicates the approximate altitude with a value
* from 0 to 240 (60 metres).
*
* For input purposes : The ground check is performed with a test ray starting
* from 2 metres above Zbyte. Using a value lower than 240 allows objects to
* be placed on the road below a bridge, for example. If you are creating
* objects from scratch and you are not sure of the approximate altitude, you
* can set Zbyte to its maximum value (240). This will place the object on
* the first physical surface detected below that point.
*/
_this.Zbyte = 0;
/** Flags - see NOTE1 at {@link https://www.lfs.net/programmer/lyt} */
_this.Flags = 0;
/**
* Object index
*
* The first valid object index is 4 (AXO_CHALK_LINE).
* The gaps are to allow for future objects.
* Valid object indices are all less than 192.
*/
_this.Index = 0;
/**
* Heading represents 360 degrees in 256 values.
*
* Heading = (heading_in_degrees + 180) * 256 / 360
*
* - 128 : heading of zero
* - 192 : heading of 90 degrees
* - 0 : heading of 180 degrees
* - 64 : heading of -90 degrees
*/
_this.Heading = 0;
_this.initialize(data);
return _this;
}
__decorate([
(0, decorators_1.short)()
], ObjectInfo.prototype, "X", void 0);
__decorate([
(0, decorators_1.short)()
], ObjectInfo.prototype, "Y", void 0);
__decorate([
(0, decorators_1.byte)()
], ObjectInfo.prototype, "Zbyte", void 0);
__decorate([
(0, decorators_1.byte)()
], ObjectInfo.prototype, "Flags", void 0);
__decorate([
(0, decorators_1.byte)()
], ObjectInfo.prototype, "Index", void 0);
__decorate([
(0, decorators_1.byte)()
], ObjectInfo.prototype, "Heading", void 0);
return ObjectInfo;
}(base_1.SendableStruct));
exports.ObjectInfo = ObjectInfo;
var ObjectFlags;
(function (ObjectFlags) {
/**
* Floating object - remains at altitude specified by Zbyte.
*
* For all objects except the concrete objects {@link AXO_CONCRETE_SLAB} etc.
*/
ObjectFlags[ObjectFlags["FLOATING"] = 128] = "FLOATING";
})(ObjectFlags || (exports.ObjectFlags = ObjectFlags = {}));