node-insim
Version:
An InSim library for NodeJS with TypeScript support
95 lines (94 loc) • 2.92 kB
JavaScript
import { __decorate } from "tslib";
import { byte, struct, unsigned } from '../decorators';
import { Packet } from './base';
import { PacketType } from './enums';
import { CarContOBJ, ObjectInfo } from './structs';
/**
* User Control Object
*
* Reports crossing an InSim checkpoint / entering an InSim circle (from layout).
*/
export class IS_UCO extends Packet {
constructor() {
super(...arguments);
this.Size = 28;
this.Type = PacketType.ISP_UCO;
this.ReqI = 0;
/** Player's unique id */
this.PLID = 0;
this.Sp0 = 0;
/** Entering/leaving a circle or crossing a checkpoint */
this.UCOAction = 0;
this.Sp2 = 0;
this.Sp3 = 0;
/** Hundredths of a second since start (as in {@link SMALL_RTP}) */
this.Time = 0;
/** Car contact object */
this.C = new CarContOBJ();
/**
* Info about the checkpoint or circle
*
* Identifying an InSim checkpoint:
*
* Index is 252. Checkpoint index (seen in the layout editor) is stored in Flags
* bits 0 and 1.
*
* - 00 = finish line
* - 01 = 1st checkpoint
* - 10 = 2nd checkpoint
* - 11 = 3rd checkpoint
*
* Note that the checkpoint index has no meaning in LFS and is provided only for your convenience.
* If you use many InSim checkpoints you may need to identify them with the X and Y values.
*
* Identifying an InSim circle:
*
* Index is 253. The circle index (seen in the layout editor) is stored in the Heading byte.
*/
this.Info = new ObjectInfo();
}
}
__decorate([
byte()
], IS_UCO.prototype, "Size", void 0);
__decorate([
byte()
], IS_UCO.prototype, "Type", void 0);
__decorate([
byte()
], IS_UCO.prototype, "ReqI", void 0);
__decorate([
byte()
], IS_UCO.prototype, "PLID", void 0);
__decorate([
byte()
], IS_UCO.prototype, "Sp0", void 0);
__decorate([
byte()
], IS_UCO.prototype, "UCOAction", void 0);
__decorate([
byte()
], IS_UCO.prototype, "Sp2", void 0);
__decorate([
byte()
], IS_UCO.prototype, "Sp3", void 0);
__decorate([
unsigned()
], IS_UCO.prototype, "Time", void 0);
__decorate([
struct(CarContOBJ)
], IS_UCO.prototype, "C", void 0);
__decorate([
struct(ObjectInfo)
], IS_UCO.prototype, "Info", void 0);
export var UCOAction;
(function (UCOAction) {
/** Etered a circle */
UCOAction[UCOAction["UCO_CIRCLE_ENTER"] = 0] = "UCO_CIRCLE_ENTER";
/** Left a circle */
UCOAction[UCOAction["UCO_CIRCLE_LEAVE"] = 1] = "UCO_CIRCLE_LEAVE";
/** Crossed a checkpoint in forward direction */
UCOAction[UCOAction["UCO_CP_FWD"] = 2] = "UCO_CP_FWD";
/** Crossed a checkpoint in reverse direction */
UCOAction[UCOAction["UCO_CP_REV"] = 3] = "UCO_CP_REV";
})(UCOAction || (UCOAction = {}));