node-insim
Version:
An InSim library for NodeJS with TypeScript support
71 lines (70 loc) • 1.96 kB
JavaScript
import { __decorate } from "tslib";
import { byte, stringNull } from '../decorators';
import { Packet } from './base';
import { PacketType } from './enums';
/**
* InSim Multi
*
* LFS will send this packet when a host is started or joined.
*
* On ending or leaving a host, LFS will send this {@link IS_TINY}:
*
* - ReqI: 0
* - SubT: {@link TINY_MPE} (MultiPlayerEnd)
*
* To request an {@link IS_ISM} packet at any time, send this {@link IS_TINY}:
*
* - ReqI: non-zero (returned in the reply)
* - SubT: {@link TINY_ISM} (request an {@link IS_ISM})
*
* NOTE: If LFS is not in multiplayer mode, the host name in the ISM will be empty.
*/
export class IS_ISM extends Packet {
constructor() {
super(...arguments);
this.Size = 40;
this.Type = PacketType.ISP_ISM;
/** Usually 0 / or if a reply: ReqI as received in the {@link TINY_ISM} */
this.ReqI = 0;
this.Zero = 0;
/** 0 = guest / 1 = host */
this.Host = 0;
this.Sp1 = 0;
this.Sp2 = 0;
this.Sp3 = 0;
/** The name of the host joined or started */
this.HName = '';
}
}
__decorate([
byte()
], IS_ISM.prototype, "Size", void 0);
__decorate([
byte()
], IS_ISM.prototype, "Type", void 0);
__decorate([
byte()
], IS_ISM.prototype, "ReqI", void 0);
__decorate([
byte()
], IS_ISM.prototype, "Zero", void 0);
__decorate([
byte()
], IS_ISM.prototype, "Host", void 0);
__decorate([
byte()
], IS_ISM.prototype, "Sp1", void 0);
__decorate([
byte()
], IS_ISM.prototype, "Sp2", void 0);
__decorate([
byte()
], IS_ISM.prototype, "Sp3", void 0);
__decorate([
stringNull(32)
], IS_ISM.prototype, "HName", void 0);
export var MultiplayerHostMode;
(function (MultiplayerHostMode) {
MultiplayerHostMode[MultiplayerHostMode["GUEST"] = 0] = "GUEST";
MultiplayerHostMode[MultiplayerHostMode["HOST"] = 1] = "HOST";
})(MultiplayerHostMode || (MultiplayerHostMode = {}));