@falloutmp/types 0.1.0 → 0.2.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@falloutmp/types",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "TypeScript declarations for the Fallout Multiplayer scripting API: @falloutmp/types/server and @falloutmp/types/client",
5
5
  "license": "UNLICENSED",
6
6
  "exports": {
package/shared.d.ts CHANGED
@@ -1,10 +1,13 @@
1
1
  /**
2
2
  * Structural TypeScript types that are not runtime globals.
3
3
  *
4
- * These describe what the MafiaHub Framework itself provides -- the base entity and player handles
5
- * FMP's own `Player` extends, and the value types they exchange. The generated declarations import
6
- * from here; nothing in this file is produced by the exporter, so it is edited by hand when the
7
- * framework's own surface changes.
4
+ * These describe what the MafiaHub Framework itself provides and the generated declarations have no
5
+ * counterpart for: handler signatures, and the base entity handle on the client, whose API declares
6
+ * no Entity class. The generated declarations import from here; nothing in this file is produced by
7
+ * the exporter, so it is edited by hand when the framework's own surface changes.
8
+ *
9
+ * Value types (Vector2, Vector3, Quaternion, Color) and the server's Entity are generated global
10
+ * classes. Never redeclare them here: an import of a weaker copy would shadow the real class.
8
11
  *
9
12
  * A binding may only declare a named type, never an inline `(...) => ...`, so a handler parameter
10
13
  * has nowhere else it can be spelled.
@@ -22,47 +25,6 @@ export type MessageReply = (value: unknown) => void;
22
25
  /** Handler for a request addressed to a resource, given the payload and a reply callback. */
23
26
  export type MessageHandler = (payload: unknown, reply: MessageReply) => void;
24
27
 
25
- /** A two-dimensional vector. */
26
- export interface Vector2 {
27
- x: number;
28
- y: number;
29
- }
30
-
31
- /** A normalized RGBA color. */
32
- export interface Color {
33
- r: number;
34
- g: number;
35
- b: number;
36
- a: number;
37
- }
38
-
39
- /** A mutable three-dimensional vector used for world positions and Euler angles. */
40
- export interface Vector3 {
41
- x: number;
42
- y: number;
43
- z: number;
44
- add(other: Vector3): this;
45
- sub(other: Vector3): this;
46
- mul(scalar: number): this;
47
- div(scalar: number): this;
48
- normalize(): this;
49
- dot(other: Vector3): number;
50
- cross(other: Vector3): this;
51
- distance(other: Vector3): number;
52
- lerp(target: Vector3, t: number): this;
53
- set(x: number, y: number, z: number): this;
54
- clone(): Vector3;
55
- }
56
-
57
- /** Quaternion used for entity rotations. */
58
- export interface Quaternion {
59
- w: number;
60
- x: number;
61
- y: number;
62
- z: number;
63
- }
64
-
65
-
66
28
  /** Handler registered with `Key.bind`, provided by the MafiaHub Framework. */
67
29
  export type KeyHandler = (key: string, state: "down" | "up") => void;
68
30
 
@@ -72,7 +34,7 @@ export type KeyHandler = (key: string, state: "down" | "up") => void;
72
34
  */
73
35
  export type WebEventHandler = (payload?: unknown) => void;
74
36
 
75
- /** Base networked entity handle, provided by the MafiaHub Framework. */
37
+ /** Base networked entity handle on the client, provided by the MafiaHub Framework. Vector3 and Quaternion are the generated globals. */
76
38
  export interface Entity {
77
39
  /** Network id, stable for the entity's lifetime. */
78
40
  readonly id: number;