@nativewrappers/common-game 0.0.156 → 0.0.158
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/common/net/Net.d.ts +1 -0
- package/common/net/Net.js +6 -0
- package/package.json +1 -1
package/common/net/Net.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare class Net {
|
|
|
11
11
|
export declare class NetServer extends Net {
|
|
12
12
|
static emitNet(eventName: string, source: number, ...args: any[]): void;
|
|
13
13
|
static emitProto<T>(source: number, message: MessageTypeEncoder<T>): void;
|
|
14
|
+
static emitProtoToPlayers<T>(sources: number[], message: MessageTypeEncoder<T>): void;
|
|
14
15
|
static emitRawNet(eventName: string, source: number, data: Uint8Array): void;
|
|
15
16
|
}
|
|
16
17
|
export declare class NetClient extends Net {
|
package/common/net/Net.js
CHANGED
|
@@ -33,6 +33,12 @@ class NetServer extends Net {
|
|
|
33
33
|
const encoded = message.encode(message);
|
|
34
34
|
NetServer.emitRawNet(message.name, source, encoded);
|
|
35
35
|
}
|
|
36
|
+
static emitProtoToPlayers(sources, message) {
|
|
37
|
+
const encoded = message.encode(message);
|
|
38
|
+
for (const source of sources) {
|
|
39
|
+
NetServer.emitRawNet(message.name, source, encoded);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
36
42
|
static emitRawNet(eventName, source, data) {
|
|
37
43
|
TriggerClientEventInternal(eventName, source, data, data.byteLength);
|
|
38
44
|
}
|