teeworlds 2.3.1 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.js +4 -1
- package/lib/client.ts +7 -3
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -111,7 +111,6 @@ var Client = /** @class */ (function (_super) {
|
|
|
111
111
|
_this.SnapUnpacker = new snapshot_1.Snapshot();
|
|
112
112
|
// this.eSnapHolder = [];
|
|
113
113
|
_this.requestResend = false;
|
|
114
|
-
_this.pingStart = 0;
|
|
115
114
|
if (options)
|
|
116
115
|
_this.options = options;
|
|
117
116
|
_this.timer = 0;
|
|
@@ -405,6 +404,10 @@ var Client = /** @class */ (function (_super) {
|
|
|
405
404
|
}
|
|
406
405
|
}
|
|
407
406
|
});
|
|
407
|
+
unpacked.chunks.filter(function (a) { return a.msgid == NETMSGTYPE.SV_BROADCAST && a.type == 'game'; }).forEach(function (a) {
|
|
408
|
+
var unpacker = new MsgUnpacker_1.MsgUnpacker(a.raw.toJSON().data);
|
|
409
|
+
_this.emit("broadcast", unpacker.unpackString());
|
|
410
|
+
});
|
|
408
411
|
_this.sentChunkQueue.forEach(function (buff, i) {
|
|
409
412
|
var chunk = _this.MsgToChunk(buff);
|
|
410
413
|
if (chunk.flags & 1) {
|
package/lib/client.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { unpackString, MsgUnpacker } from "./MsgUnpacker";
|
|
|
8
8
|
import Movement from './movement';
|
|
9
9
|
|
|
10
10
|
import { MsgPacker } from './MsgPacker';
|
|
11
|
-
import {
|
|
11
|
+
import { Snapshot } from './snapshot';
|
|
12
12
|
import Huffman from "./huffman";
|
|
13
13
|
|
|
14
14
|
const huff = new Huffman();
|
|
@@ -175,7 +175,6 @@ export declare interface Client {
|
|
|
175
175
|
|
|
176
176
|
// eSnapHolder: eSnap[];
|
|
177
177
|
|
|
178
|
-
pingStart: number;
|
|
179
178
|
|
|
180
179
|
options?: iOptions;
|
|
181
180
|
|
|
@@ -183,6 +182,7 @@ export declare interface Client {
|
|
|
183
182
|
on(event: 'disconnect', listener: (reason: string) => void): this;
|
|
184
183
|
|
|
185
184
|
on(event: 'message', listener: (message: iMessage) => void): this;
|
|
185
|
+
on(event: 'broadcast', listener: (message: string) => void): this;
|
|
186
186
|
on(event: 'kill', listener: (kill: iKillMsg) => void): this;
|
|
187
187
|
requestResend: boolean;
|
|
188
188
|
}
|
|
@@ -203,7 +203,6 @@ export class Client extends EventEmitter {
|
|
|
203
203
|
this.SnapUnpacker = new Snapshot();
|
|
204
204
|
// this.eSnapHolder = [];
|
|
205
205
|
this.requestResend = false;
|
|
206
|
-
this.pingStart = 0;
|
|
207
206
|
|
|
208
207
|
if (options)
|
|
209
208
|
this.options = options;
|
|
@@ -529,6 +528,11 @@ export class Client extends EventEmitter {
|
|
|
529
528
|
}
|
|
530
529
|
}
|
|
531
530
|
})
|
|
531
|
+
unpacked.chunks.filter(a => a.msgid == NETMSGTYPE.SV_BROADCAST && a.type == 'game').forEach(a => {
|
|
532
|
+
let unpacker = new MsgUnpacker(a.raw.toJSON().data);
|
|
533
|
+
|
|
534
|
+
this.emit("broadcast", unpacker.unpackString());
|
|
535
|
+
})
|
|
532
536
|
this.sentChunkQueue.forEach((buff, i) => {
|
|
533
537
|
let chunk = this.MsgToChunk(buff);
|
|
534
538
|
if (chunk.flags & 1) {
|