@nativewrappers/common-game 0.0.148 → 0.0.157

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.
@@ -7,16 +7,12 @@ export type MessageTypeEncoder<T> = {
7
7
  name: string;
8
8
  };
9
9
  type ProtoCallback<Message> = (message: Message) => Promise<void> | void;
10
- type NetProtoCallback<Message> = (source: number, message: Message) => Promise<void> | void;
10
+ type NetProtoCallback<Message> = (message: Message, source: number) => Promise<void> | void;
11
11
  /**
12
12
  * PMA uses ts-proto to define our types, you can see that here: https://github.com/stephenh/ts-proto
13
13
  * You will have to modify the generator to add `name` or just use {@param eventName}
14
14
  *
15
- * We use this:
16
- * content = content.replace(/export const (\w+)[^=]*= \{/g, 'export const $1 = {\n name: "$1" as const,');
17
- *
18
15
  * This makes it very nice to handle events since we only have to give it the Protobuf Object
19
- *
20
16
  */
21
17
  export declare function OnProto<T>(messageType: MessageTypeDecoder<T>, eventName?: string): (originalMethod: ProtoCallback<T>, context: ClassMethodDecoratorContext) => void;
22
18
  /**
@@ -35,7 +35,7 @@ function OnProtoNet(messageType, eventName) {
35
35
  Net.onRawNet(event, async (data, source) => {
36
36
  try {
37
37
  const message = messageType.decode(data);
38
- return await originalMethod.call(this, parseSource(source), message);
38
+ return await originalMethod.call(this, message, parseSource(source));
39
39
  } catch (e) {
40
40
  globalThis.printError?.("proto event", e);
41
41
  }
@@ -1 +1,2 @@
1
+ export declare function randomFloat(min: number, max: number): number;
1
2
  export declare function randomInt(min: number, max: number): number;
@@ -1,9 +1,14 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- function randomInt(min, max) {
3
+ function randomFloat(min, max) {
4
4
  return Math.random() * (max - min) + min;
5
5
  }
6
+ __name(randomFloat, "randomFloat");
7
+ function randomInt(min, max) {
8
+ return Math.floor(randomFloat(min, max));
9
+ }
6
10
  __name(randomInt, "randomInt");
7
11
  export {
12
+ randomFloat,
8
13
  randomInt
9
14
  };
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  ],
9
9
  "license": "MIT",
10
10
  "type": "module",
11
- "version": "0.0.148",
11
+ "version": "0.0.157",
12
12
  "repository": {
13
13
  "type": "git",
14
14
  "url": "https://github.com/nativewrappers/nativewrappers.git"