@cybermp/client-types 2.2.1 → 2.2.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/out/game.d.ts CHANGED
@@ -12,7 +12,7 @@ type CurveData<T> = T;
12
12
  type ResRef<T> = T;
13
13
  type MultiChannelCurve<T> = T;
14
14
 
15
- interface MpFuncs {
15
+ export interface MpGlobals {
16
16
  "Abs"(a: number): number;
17
17
  "AbsF"(a: number): number;
18
18
  "AcosF"(a: number): number;
@@ -170539,7 +170539,4 @@ export interface MpClasses {
170539
170539
  ZoomTransitionHelper: typeof ZoomTransitionHelper;
170540
170540
  }
170541
170541
 
170542
- export interface MpGame extends MpFuncs, MpClasses {
170543
- }
170544
-
170545
170542
  export * from "../precomputed/game.d.ts";
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@cybermp/client-types",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "description": "",
5
- "types": "./out/index.d.ts",
5
+ "types": "./precomputed/index.d.ts",
6
6
  "files": [
7
7
  "./out",
8
8
  "./precomputed"
@@ -14,8 +14,8 @@
14
14
  ],
15
15
  "exports": {
16
16
  ".": {
17
- "import": "./precomputed/mp.d.ts",
18
- "types": "./precomputed/mp.d.ts"
17
+ "import": "./precomputed/index.d.ts",
18
+ "types": "./precomputed/index.d.ts"
19
19
  },
20
20
  "./game": {
21
21
  "import": "./out/game.d.ts",
@@ -1,5 +1,24 @@
1
+ /**
2
+ * Interface for managing the game's embedded Chromium Embedded Framework (CEF) web instances.
3
+ * Handles display focus layer switching, mouse pointer capturing, and runtime address navigation.
4
+ */
1
5
  export interface MpCef {
6
+ /**
7
+ * Sets the interaction focus and inputs routing priority over the active browser frame layout.
8
+ * @param focus - `true` to pass keyboard input focus into the web view, `false` to return focus to the game engine.
9
+ * @param cursor - Optional flag. `true` renders and locks the OS cursor over the game window, `false` hides it.
10
+ */
2
11
  setFocus(focus: boolean, cursor?: boolean): void;
12
+
13
+ /**
14
+ * Evaluates whether the user's input focus context is currently actively captured by the CEF interface layer.
15
+ * @returns `true` if the web view is holding input priority focus, otherwise `false`.
16
+ */
3
17
  isInFocus(): boolean;
18
+
19
+ /**
20
+ * Instructs the web view instance frame to perform immediate route navigation to a new target path or web address destination.
21
+ * @param url - The fully qualified target URL or local asset resource file path string to render.
22
+ */
4
23
  setUrl(url: string): void;
5
24
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * See {@link worldWeatherState#name}
2
+ * @category Enums
3
3
  */
4
4
  export enum EWeatherState {
5
5
  SUNNY = '24h_weather_sunny',
@@ -19,17 +19,26 @@ export enum EWeatherState {
19
19
  COURIER_CLOUDS = 'sa_courier_clouds',
20
20
  }
21
21
 
22
+ /**
23
+ * @category Enums
24
+ */
22
25
  export enum EVoiceActivationType {
23
26
  UNDEFINED = 0,
24
27
  VOICE = 1,
25
28
  PUSH_TO_TALK = 2,
26
29
  }
27
30
 
31
+ /**
32
+ * @category Enums
33
+ */
28
34
  export enum EPlayerGender {
29
35
  Female = 1,
30
36
  Male = 2,
31
37
  }
32
38
 
39
+ /**
40
+ * @category Enums
41
+ */
33
42
  export enum ELoadingScreenState {
34
43
  Started = 1,
35
44
  Loading,
@@ -1,61 +1,232 @@
1
+ /**
2
+ * Map of core multiplayer engine events triggered by the client runtime environment.
3
+ * Covers resource lifecycles, network streaming updates, and entity synchronization.
4
+ * @category Events
5
+ */
1
6
  interface MpEventsMap {
7
+ /**
8
+ * Fired when any local resource begins initialization and starts running.
9
+ * @param resourceName - The unique identification name of the started resource.
10
+ */
2
11
  anyResourceStart(resourceName: string): void;
12
+
13
+ /**
14
+ * Fired when any local resource is explicitly terminated or reloaded.
15
+ * @param resourceName - The unique identification name of the stopped resource.
16
+ */
3
17
  anyResourceStop(resourceName: string): void;
18
+
19
+ /**
20
+ * Fired when the server signals that a server-side resource has started.
21
+ * @param resourceName - The unique identification name of the server resource.
22
+ */
4
23
  anyServerResourceStart(resourceName: string): void;
24
+
25
+ /**
26
+ * Fired when the server signals that a server-side resource has stopped running.
27
+ * @param resourceName - The unique identification name of the server resource.
28
+ */
5
29
  anyServerResourceStop(resourceName: string): void;
30
+
31
+ /**
32
+ * Fired specifically when *this* individual script resource completes loading.
33
+ */
6
34
  resourceStart(): void;
35
+
36
+ /**
37
+ * Fired specifically when *this* individual script resource is being shut down.
38
+ */
7
39
  resourceStop(): void;
40
+
41
+ /**
42
+ * Fired when the engine re-scans and refreshes the global resource manifest map.
43
+ */
8
44
  resourcesRefresh(): void;
9
45
 
46
+ /**
47
+ * Fired when a synchronized game object leaves the local player's streaming radius.
48
+ * @param netID - The network-assigned entity identification hash.
49
+ * @param gameID - The native engine entity handling index ID.
50
+ */
10
51
  objectStreamOut(netID: number, gameID: number): void;
52
+
53
+ /**
54
+ * Fired when a synchronized game object enters the local player's streaming radius.
55
+ * @param netID - The network-assigned entity identification hash.
56
+ * @param gameID - The native engine entity handling index ID.
57
+ */
11
58
  objectStreamIn(netID: number, gameID: number): void;
12
-
59
+
60
+ /**
61
+ * Fired when a synchronized pedestrian or NPC leaves the local player's streaming radius.
62
+ * @param netID - The network-assigned entity identification hash.
63
+ * @param gameID - The native engine entity handling index ID.
64
+ */
13
65
  pedStreamOut(netID: number, gameID: number): void;
66
+
67
+ /**
68
+ * Fired when a synchronized pedestrian or NPC enters the local player's streaming radius.
69
+ * @param netID - The network-assigned entity identification hash.
70
+ * @param gameID - The native engine entity handling index ID.
71
+ */
14
72
  pedStreamIn(netID: number, gameID: number): void;
15
-
73
+
74
+ /**
75
+ * Fired when a remote network player leaves the local user's streaming zone.
76
+ * @param netID - The network-assigned player synchronization ID.
77
+ * @param gameID - The native engine entity handling index ID.
78
+ */
16
79
  remotePlayerStreamOut(netID: number, gameID: number): void;
80
+
81
+ /**
82
+ * Fired when a remote network player enters the local user's streaming zone.
83
+ * @param netID - The network-assigned player synchronization ID.
84
+ * @param gameID - The native engine entity handling index ID.
85
+ */
17
86
  remotePlayerStreamIn(netID: number, gameID: number): void;
18
-
87
+
88
+ /**
89
+ * Fired when a synchronized vehicle leaves the local player's streaming radius.
90
+ * @param netID - The network-assigned entity identification hash.
91
+ * @param gameID - The native engine entity handling index ID.
92
+ */
19
93
  vehicleStreamOut(netID: number, gameID: number): void;
94
+
95
+ /**
96
+ * Fired when a synchronized vehicle enters the local player's streaming radius.
97
+ * @param netID - The network-assigned entity identification hash.
98
+ * @param gameID - The native engine entity handling index ID.
99
+ */
20
100
  vehicleStreamIn(netID: number, gameID: number): void;
21
101
  }
22
102
 
103
+ /**
104
+ * Payload structure capturing diagnostic crash or layout execution data when a CEF frame fails to load.
105
+ * @category Events
106
+ */
23
107
  type CefLoadingFailedError = {
108
+ /** The name identifier of the target frame window container. */
24
109
  frameName: string;
110
+ /** Detailed failure description or engine reason statement. */
25
111
  message: string;
112
+ /** File path URL source location string. */
26
113
  source: string;
114
+ /** Line number coordinate mapping source code where compilation or loading dropped. */
27
115
  line: string;
116
+ /** Column horizontal offset coordinate location. */
28
117
  column: string;
118
+ /** Raw interpreter trace log array stack layout details. */
29
119
  stack: string;
30
120
  };
31
121
 
122
+ /**
123
+ * Map containing standard event listeners bound to web context layers (Chromium Embedded Framework).
124
+ * @category Events
125
+ */
32
126
  interface MpCefEventsMap {
127
+ /**
128
+ * Fired when a target browser instance finishes parsing the document structure tree.
129
+ * @param name - Unique registration name tracking the browser frame entity.
130
+ */
33
131
  domReady(name: string): void;
132
+
133
+ /**
134
+ * Fired if the underlying browser layer drops connectivity or triggers initialization errors.
135
+ * @param error - The comprehensive failure metadata payload context object.
136
+ */
34
137
  loadingFailed(error: CefLoadingFailedError): void;
35
138
  }
36
139
 
140
+ /**
141
+ * Primary multi-target Event Emitter interface for managing client, server, and CEF bridge communications.
142
+ * Handles binding event listeners, deregistering handlers, and dispatching payloads across contexts.
143
+ * @category Events
144
+ */
37
145
  export interface MpEvents {
146
+ /**
147
+ * Dispatches a local event across the client resource scope.
148
+ * @param eventName - The target event channel identifier.
149
+ * @param args - Arbitrary payload arguments passed to active handlers.
150
+ */
38
151
  emit(eventName: string, ...args: any[]): void;
152
+
153
+ /**
154
+ * Encapsulates and forwards an event payload across the network socket layer directly to the server host.
155
+ * @param eventName - Target string channel matching server-side listeners.
156
+ * @param args - Data variables to serialize and stream over the network.
157
+ */
39
158
  emitServer(eventName: string, ...args: any[]): void;
159
+
160
+ /**
161
+ * Forwards a tracking event bridge payload straight into the local active Chromium UI browser layouts.
162
+ * @param eventName - The targeted callback hook registered inside your CEF web apps.
163
+ * @param args - Variables passed into web execution loops.
164
+ */
40
165
  emitCef(eventName: string, ...args: any[]): void;
41
166
 
167
+ /**
168
+ * Subscribes a listener function to network event streams dispatched directly from the server.
169
+ * @param eventName - Targeted network channel string key.
170
+ * @param callback - Execution callback running upon packet resolution.
171
+ */
42
172
  onServer(eventName: string, callback: (...args: any[]) => void): void;
43
173
 
174
+ /**
175
+ * Registers a strict event listener tracking core CEF lifecycle mutations.
176
+ * @template E - Strictly bounded keys originating inside `MpCefEventsMap`.
177
+ * @param eventName - The specific target CEF lifecycle event type.
178
+ * @param callback - Type-safe handler function mapping parameters cleanly.
179
+ */
44
180
  onCef<E extends keyof MpCefEventsMap>(
45
181
  eventName: E,
46
182
  callback: MpCefEventsMap[E],
47
183
  ): void;
184
+
185
+ /**
186
+ * Registers a custom user-defined UI bridge event listener tracking incoming notifications dispatched from your web application scripts.
187
+ * @param eventName - Target string channel key matching web executions.
188
+ * @param callback - Arbitrary execution callback running on invocation.
189
+ */
48
190
  onCef(eventName: string, callback: (...args: any[]) => void): void;
49
191
 
192
+ /**
193
+ * Subscribes a type-safe listener function to catch core multiplayer platform tracking engine hooks.
194
+ * @template E - Strictly bounded keys originating inside `MpEventsMap`.
195
+ * @param eventName - The active client engine event name key.
196
+ * @param callback - Handler function whose structural signatures match engine data constraints exactly.
197
+ */
50
198
  on<E extends keyof MpEventsMap>(eventName: E, callback: MpEventsMap[E]): void;
199
+
200
+ /**
201
+ * Subscribes a custom script execution callback tracking local text channels or decoupled system events.
202
+ * @param eventName - The designated custom application event namespace key.
203
+ * @param callback - Handler logic executed immediately upon local triggers.
204
+ */
51
205
  on(eventName: string, callback: (...args: any[]) => void): void;
52
206
 
207
+ /**
208
+ * Detaches and de-allocates an active type-safe engine hook handler reference.
209
+ * @template E - Bounded validation keys linking to engine maps.
210
+ * @param eventName - Target client engine tracking channel name key.
211
+ * @param callback - The original functional reference signature block to tear down.
212
+ */
53
213
  off<E extends keyof MpEventsMap>(
54
214
  eventName: E,
55
215
  callback: MpEventsMap[E],
56
216
  ): void;
217
+
218
+ /**
219
+ * Detaches a general or custom application event string tracking handler layout logic block.
220
+ * @param eventName - The target event namespace string key.
221
+ * @param callback - Functional reference signature block to unbind.
222
+ */
57
223
  off(eventName: string, callback: (...args: any[]) => void): void;
58
224
 
225
+ /**
226
+ * Registers an execution text console command processor linked directly to player chatting or console prompt interactions.
227
+ * @param commandName - The terminal string command literal (e.g., passing `"spawn"` handles requests targeting `/spawn`).
228
+ * @param callback - Callback execution script processing console interactions.
229
+ */
59
230
  addCommand(
60
231
  commandName: string,
61
232
  callback: (id: number, args: string[]) => void,