UNPKG

node-insim

Version:

An InSim library for NodeJS with TypeScript support

80 lines (79 loc) 2.66 kB
import { __decorate } from "tslib"; import { byte, short } from '../../decorators'; import { SendableStruct } from '../base'; export class ObjectInfo extends SendableStruct { constructor(data) { super(); /** 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); } } __decorate([ short() ], ObjectInfo.prototype, "X", void 0); __decorate([ short() ], ObjectInfo.prototype, "Y", void 0); __decorate([ byte() ], ObjectInfo.prototype, "Zbyte", void 0); __decorate([ byte() ], ObjectInfo.prototype, "Flags", void 0); __decorate([ byte() ], ObjectInfo.prototype, "Index", void 0); __decorate([ byte() ], ObjectInfo.prototype, "Heading", void 0); export 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 || (ObjectFlags = {}));