node-insim
Version:
An InSim library for NodeJS with TypeScript support
87 lines (86 loc) • 2.75 kB
JavaScript
import { __decorate } from "tslib";
import { byte, char, short } from '../../decorators';
import { Struct } from '../base';
export class CarContact extends Struct {
constructor(data) {
super();
this.PLID = 0;
/** Like Info byte in {@link CompCar} (CCI_BLUE / CCI_YELLOW / CCI_LAG) */
this.Info = 0;
this.Sp2 = 0;
/** Front wheel steer in degrees (right positive) */
this.Steer = 0;
/** High 4 bits: throttle / low 4 bits: brake (0 to 15) */
this.ThrBrk = 0;
/** High 4 bits: clutch / low 4 bits: handbrake (0 to 15) */
this.CluHan = 0;
/** High 4 bits: gear (15=R) / low 4 bits: spare */
this.GearSp = 0;
/** m/s */
this.Speed = 0;
/** Car's motion if Speed > 0: 0 = world y direction, 128 = 180 deg */
this.Direction = 0;
/** Direction of forward axis: 0 = world y direction, 128 = 180 deg */
this.Heading = 0;
/** m/s^2 longitudinal acceleration (forward positive) */
this.AccelF = 0;
/** m/s^2 lateral acceleration (right positive) */
this.AccelR = 0;
/** Position (1 metre = 16) */
this.X = 0;
/** Position (1 metre = 16) */
this.Y = 0;
this.initialize(data);
}
}
__decorate([
byte()
], CarContact.prototype, "PLID", void 0);
__decorate([
byte()
], CarContact.prototype, "Info", void 0);
__decorate([
byte()
], CarContact.prototype, "Sp2", void 0);
__decorate([
char()
], CarContact.prototype, "Steer", void 0);
__decorate([
byte()
], CarContact.prototype, "ThrBrk", void 0);
__decorate([
byte()
], CarContact.prototype, "CluHan", void 0);
__decorate([
byte()
], CarContact.prototype, "GearSp", void 0);
__decorate([
byte()
], CarContact.prototype, "Speed", void 0);
__decorate([
byte()
], CarContact.prototype, "Direction", void 0);
__decorate([
byte()
], CarContact.prototype, "Heading", void 0);
__decorate([
char()
], CarContact.prototype, "AccelF", void 0);
__decorate([
char()
], CarContact.prototype, "AccelR", void 0);
__decorate([
short()
], CarContact.prototype, "X", void 0);
__decorate([
short()
], CarContact.prototype, "Y", void 0);
export var CarContactFlags;
(function (CarContactFlags) {
/** This car is in the way of a driver who is a lap ahead */
CarContactFlags[CarContactFlags["CCI_BLUE"] = 1] = "CCI_BLUE";
/** This car is slow or stopped and in a dangerous place */
CarContactFlags[CarContactFlags["CCI_YELLOW"] = 2] = "CCI_YELLOW";
/** This car is lagging (missing or delayed position packets) */
CarContactFlags[CarContactFlags["CCI_LAG"] = 32] = "CCI_LAG";
})(CarContactFlags || (CarContactFlags = {}));