@cybermp/client-types 2.2.2 → 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.
@@ -1,558 +1,601 @@
1
- import type * as CyberEnums from '../out/enums';
2
- import type {
3
- Box,
4
- EulerAngles,
5
- entMorphTargetWeightEntry,
6
- MpClasses,
7
- Vector3,
8
- } from '../out/game';
9
-
10
- /**
11
- * Extracts the instance type from a class constructor type, or returns the type itself if it is not a constructor.
12
- * @template T - The type to unwrap.
13
- * @internal
14
- */
15
- type UnwrapClass<T> = T extends { new (): infer U } ? U : T;
16
-
17
- /**
18
- * @internal
19
- */
20
- type AnyFunc = (...args: any[]) => any;
21
-
22
- /**
23
- * @internal
24
- */
25
- type SafeMethod<I, M extends keyof I> = I[M] extends AnyFunc ? I[M] : AnyFunc;
26
-
27
- /**
28
- * Defines a function signature used to completely override a method within a specified game class.
29
- * The callback receives the instance (`self`), the original arguments, and the original method implementation as the final parameter.
30
- * @template C - The class name key from `MpClasses`.
31
- * @template I - The resolved instance type of the class.
32
- * @template M - The method names available on the class instance.
33
- */
34
- export type OverrideFunction = <
35
- C extends keyof MpClasses,
36
- I extends UnwrapClass<MpClasses[C]>,
37
- M extends keyof I,
38
- >(
39
- className: C,
40
- methodName: M,
41
- callback: (
42
- self: I,
43
- ...args: [...Parameters<SafeMethod<I, M>>, origin: SafeMethod<I, M>]
44
- ) => ReturnType<SafeMethod<I, M>>,
45
- ) => void;
46
-
47
- /**
48
- * Defines a function signature used to observe (hook into) a method within a specified game class.
49
- * The callback receives the instance (`self`) and the arguments passed to the method.
50
- * @template C - The class name key from `MpClasses`.
51
- * @template I - The resolved instance type of the class.
52
- * @template M - The method names available on the class instance.
53
- */
54
- export type ObserveFunction = <
55
- C extends keyof MpClasses,
56
- I extends UnwrapClass<MpClasses[C]>,
57
- M extends keyof I,
58
- >(
59
- className: C,
60
- methodName: M,
61
- callback: (self: I, ...args: Parameters<SafeMethod<I, M>>) => void,
62
- ) => void;
63
-
64
- /**
65
- * Interface for interacting with the game's TweakDB database.
66
- * TweakDB contains static game data, tweaks, and entity configurations.
67
- * @category Natives
68
- */
69
- export interface TweakDB {
70
- /**
71
- * Retrieves an array of records matching a specific query or record type.
72
- * @template T - The expected type of the records.
73
- * @param str - The TweakDB record path or type identifier.
74
- * @returns An array of matching records.
75
- */
76
- getRecords<T = any>(str: string): T[];
77
-
78
- /**
79
- * Retrieves a single record from TweakDB.
80
- * @template T - The expected type of the record.
81
- * @param str - The specific TweakDB ID or path string.
82
- * @returns The requested record.
83
- */
84
- getRecord<T = any>(str: string): T;
85
-
86
- /**
87
- * Queries TweakDB paths and returns matching entry keys.
88
- * @param str - The search or query pattern string.
89
- * @returns An array of matching string IDs.
90
- */
91
- query(str: string): string[];
92
-
93
- /**
94
- * Retrieves a "flat" property value directly from TweakDB.
95
- * @template T - The expected type of the flat property.
96
- * @param str - The path to the flat property (e.g., "Items.SomeItem.someProperty").
97
- * @returns The flat property value.
98
- */
99
- getFlat<T = any>(str: string): T;
100
-
101
- /**
102
- * Overwrites an array flat property in TweakDB and updates the engine immediately.
103
- * @param str - The path to the flat property.
104
- * @param arr - The new array of values to assign.
105
- * @returns `true` if the operation was successful, otherwise `false`.
106
- */
107
- setFlats(str: string, arr: any[]): boolean;
108
-
109
- /**
110
- * Overwrites a single flat property value in TweakDB and updates the engine immediately.
111
- * @param str - The path to the flat property.
112
- * @param obj - The new value to assign.
113
- * @returns `true` if the operation was successful, otherwise `false`.
114
- */
115
- setFlat(str: string, obj: any): boolean;
116
-
117
- /**
118
- * Overwrites a flat property value in TweakDB *without* triggering an immediate engine update.
119
- * Useful when batching multiple TweakDB edits before a manual refresh.
120
- * @param str - The path to the flat property.
121
- * @param obj - The new value to assign.
122
- * @returns `true` if the operation was successful, otherwise `false`.
123
- */
124
- setFlatNoUpdate(str: string, obj: any): boolean;
125
-
126
- /**
127
- * Forces the engine to re-read and update a specific record from its current TweakDB state.
128
- * @param str - The path to the record to update.
129
- * @returns `true` if the update succeeded, otherwise `false`.
130
- */
131
- updateRecord(str: string): boolean;
132
-
133
- /**
134
- * Runtime creates a new TweakDB record.
135
- * @param key - The new record identifier key.
136
- * @param value - The record blueprint or type definition key.
137
- * @returns `true` if creation succeeded, otherwise `false`.
138
- */
139
- createRecord(key: string, value: string): boolean;
140
- }
141
-
142
- /**
143
- * Custom CyberMP System managing asset deletion maps, and basic spawn configurations.
144
- * Accessible through `mp.game.ScriptGameInstance.GetMultiplayerSystem()`
145
- * @category Natives
146
- */
147
- export class MultiplayerSystem {
148
- /**
149
- * Removes game object classes (e.g., `GameObject`, `Door`) from the active multiplayer map state.
150
- * @param objectClassMap - Array of class names from `MpClasses` to clear.
151
- */
152
- DeclareDeletedObjects(objectClassMap: Array<keyof MpClasses>): void;
153
-
154
- /**
155
- * Removes specific game objects from the network replication map using their unique hash keys.
156
- * @param objectHashMap - Array of unique entity hashes to delete.
157
- */
158
- DeletedObjectsByUniqueHash(objectHashMap: string[]): void;
159
-
160
- /**
161
- * Enables or disables synchronization of default game effects, as defined by the CyberMP platform.
162
- * @param value - `true` to utilize default synchronization effects, `false` to disable them.
163
- */
164
- UseDefaultEffectsByPlatform(value: boolean): void;
165
-
166
- /**
167
- * Sets the initial default coordinate and orientation fallback position when spawning players.
168
- * @param position - The 3D coordinates vector.
169
- * @param yaw - The horizontal rotation (yaw angle) in degrees/radians.
170
- */
171
- SetDefaultSpawnPosition(position: Vector3, yaw: number): void;
172
- }
173
-
174
- /**
175
- * System providing status and progression access for the game's loading screen interface.
176
- * Accessible through `mp.game.ScriptGameInstance.GetLoadingScreenSystem()`
177
- * @category Natives
178
- */
179
- export class LoadingScreenSystem {
180
- /**
181
- * Retrieves the current explicit state of the loading screen lifecycle.
182
- * @returns The state enum value.
183
- */
184
- GetLoadingScreenState(): CyberEnums.ELoadingScreenState;
185
-
186
- /**
187
- * Gets the numeric loading progression factor.
188
- * @returns A value representing loading progress (from 0 to 100).
189
- */
190
- GetLoadingScreenProgress(): number;
191
-
192
- /**
193
- * Callback fired or invoked when the loading screen switches states.
194
- * @param newState - The new incoming loading screen state enum value.
195
- */
196
- OnLoadingScreenStateChange(newState: CyberEnums.ELoadingScreenState): void;
197
- }
198
-
199
- /**
200
- * Core CyberMP Game Interface linking subsystem instances, runtime overrides, using game natives, engine callbacks, and engine utility tasks.
201
- */
202
- export interface MpGame {
203
- /**
204
- * The global interface instance for TweakDB manipulation.
205
- */
206
- TweakDB: TweakDB;
207
-
208
- /**
209
- * Registers a callback listener tracking real-time keyboard or controller hardware input events.
210
- * @param callback - Function invoked on keystrokes.
211
- */
212
- onInputKeyEvent(
213
- callback: (
214
- action: CyberEnums.EInputAction,
215
- key: CyberEnums.EInputKey,
216
- ) => void,
217
- ): void;
218
-
219
- /**
220
- * Gets the rendering dimensions of the active screen display.
221
- * @returns A tuple format containing `[width, height]` in pixels.
222
- */
223
- getDisplayResolution(): [width: number, height: number];
224
-
225
- /**
226
- * Event hook that fires immediately when the underlying game session finishes initial loading structures.
227
- * @param callback - Execution callback.
228
- */
229
- onGameLoaded(callback: () => void): void;
230
-
231
- /**
232
- * Event hook that fires specifically when tweaks and TweakDB engine patches are loaded and safe to manipulate.
233
- * @param callback - Execution callback.
234
- */
235
- onTweak(callback: () => void): void;
236
-
237
- /**
238
- * Event hook triggered during early initialization phase of the modding script runtime container.
239
- * @param callback - Execution callback.
240
- */
241
- onInit(callback: () => void): void;
242
-
243
- /**
244
- * Event hook that triggers immediately after the local user's player character object spawns in the world space.
245
- * @param callback - Execution callback.
246
- */
247
- onLocalPlayerSpawned(callback: () => void): void;
248
-
249
- /**
250
- * Resolves and fetches an engine singleton class reference safely.
251
- * @template T - The specific key class identifier inside `MpClasses`.
252
- * @param name - The name identifier string of the singleton.
253
- * @returns The active unwrapped instance object of that designated class.
254
- */
255
- getSingleton<T extends keyof MpClasses>(name: T): UnwrapClass<MpClasses[T]>;
256
-
257
- /**
258
- * Directly injects or appends an item template into the player's primary inventory framework.
259
- * @param itemName - The specific TweakDB string ID of the item.
260
- * @param count - Total item quantity stack to add.
261
- */
262
- AddToInventory(itemName: string, count: number): void;
263
-
264
- /**
265
- * Converts a plaintext string model or path identifier name directly into a stable 64-bit unsigned hash representation.
266
- * @param name - Raw item asset or TweakDB blueprint name path string.
267
- * @param type - Parsing method mode targeting either a TweakDB path reference (`tweakdbid`) or an internal engine CName string hash (`cname`).
268
- * @returns The calculated hash string value.
269
- */
270
- getHashFromName(name: string, type: 'tweakdbid' | 'cname'): string;
271
-
272
- /**
273
- * Fully replaces a targeted class method with custom script logic.
274
- * @see {@link OverrideFunction}
275
- */
276
- override: OverrideFunction;
277
-
278
- /**
279
- * Hooks an observation callback that runs immediately **after** the target native class method executes.
280
- * @see {@link ObserveFunction}
281
- */
282
- observeAfter: ObserveFunction;
283
-
284
- /**
285
- * Hooks an observation callback that runs immediately **before** the target native class method executes.
286
- * @see {@link ObserveFunction}
287
- */
288
- observeBefore: ObserveFunction;
289
-
290
- /**
291
- * Standard alias hook pointing to {@link observeBefore}. Evaluates logic prior to core target execution.
292
- * @see {@link ObserveFunction}
293
- */
294
- observe: ObserveFunction;
295
-
296
- /**
297
- * Observes a method inside a selected class after execution. Can only invoke methods native to {@link MpGame}.
298
- * Should be used when it is crucial for performance that the function executes as fast as V8 allows.
299
- * @see {@link ObserveFunction}
300
- */
301
- observeAfterRaw: ObserveFunction;
302
-
303
- /**
304
- * Observes a method inside a selected class before execution. Can only invoke methods native to {@link MpGame}.
305
- * Should be used when it is crucial for performance that the function executes as fast as V8 allows.
306
- * @see {@link ObserveFunction}
307
- */
308
- observeBeforeRaw: ObserveFunction;
309
-
310
- /**
311
- * Standard alias hook pointing to {@link observeBeforeRaw}. Evaluates high-performance raw logic prior to execution.
312
- * @see {@link ObserveFunction}
313
- */
314
- observeRaw: ObserveFunction;
315
-
316
- /**
317
- * Serializes a JavaScript runtime payload object structural value into a native engine container format (`Variant`).
318
- * @template R - The expected return typing output blueprint shape.
319
- * @param obj - Target entity object structure to convert.
320
- * @param str - Native structural reflection mapping blueprint name string.
321
- * @returns The wrapped engine reference asset layout structure.
322
- */
323
- toVariant<R = Record<string, unknown>>(obj: any, str: string): R;
324
-
325
- /**
326
- * Deserializes a native engine container structure layout (`Variant`) back into raw accessible JavaScript object values.
327
- * @template R - The expected target JavaScript shape format.
328
- * @param obj - Variant payload container input from the game engine.
329
- * @returns The unwrapped JavaScript object structure data.
330
- */
331
- fromVariant<R = any>(obj: any): R;
332
- }
333
-
334
- /**
335
- * Extended by CyberMP `inkISystemRequestsHandler` class
336
- * @category Natives
337
- */
338
- export interface extended__inkISystemRequestsHandler {
339
- /**
340
- * Forces the UI context architecture to navigate back out into the main landing splash screen.
341
- */
342
- StartMainMenu(): void;
343
- }
344
-
345
- /**
346
- * Extended by CyberMP `entEntity` class
347
- * @category Natives
348
- */
349
- interface extended__entEntity {
350
- /**
351
- * Obtains lists specifying explicit weight indexes controlling facial custom blendshapes or structural targets.
352
- * @returns Array listing mesh blend weights structures.
353
- */
354
- GetMorphWeights(): entMorphTargetWeightEntry[];
355
-
356
- /**
357
- * Forces the entity container model frame structural layers to assemble and update via selected visual components arrays.
358
- * @param arr - List containing components structures to attach.
359
- */
360
- ReassembleWithComponents(arr: entIComponent[]): void;
361
-
362
- /**
363
- * Teleports a physical game object / Pedestrian directly to specific vector coordinates.
364
- * @param position - Target 3D destination coordinate vector.
365
- * @param rotation - Optional Euler orientation layout coordinates (Pitch, Roll, Yaw).
366
- */
367
- TeleportPed(position: Vector3, rotation?: EulerAngles): void;
368
- }
369
-
370
- /**
371
- * Extended by CyberMP `gameuiICharacterCustomizationSystem` class
372
- * @category Natives
373
- */
374
- interface extended__gameuiICharacterCustomizationSystem {
375
- /**
376
- * Updates player's gender state representation variables directly inside system profiles.
377
- * @param gender - Target gender enum identifier asset option.
378
- * @param savedPos - Optional parameter to persist or retain vector frame state context layout positions.
379
- */
380
- SetPlayerGender(gender: CyberEnums.EPlayerGender, savedPos?: boolean): void;
381
-
382
- /**
383
- * Callback fired immediately following successful adjustments to player character gender states.
384
- * @param gender - The incoming target modified gender enumeration value.
385
- */
386
- OnPlayerGenderChanged(gender: CyberEnums.EPlayerGender): void;
387
- }
388
-
389
- /**
390
- * Extended by CyberMP `worldWeatherScriptInterface` class
391
- * @category Natives
392
- */
393
- interface extended__worldWeatherScriptInterface {
394
- /**
395
- * Commands the environment engine manager to override active weather profiles.
396
- * @param weather - The weather enum state or specific profile asset name path string.
397
- * @param blendTime - Optional transition timeline sequence parameter in seconds.
398
- * @param priority - Optional overlay layer sorting stack index weight level identifier.
399
- * @returns `true` if weather override commands executed, otherwise `false`.
400
- */
401
- SetWeather(
402
- weather: CyberEnums.EWeatherState,
403
- blendTime?: number,
404
- priority?: number,
405
- ): boolean;
406
-
407
- /**
408
- * Clears ongoing script-driven environmental alterations and returns to automated weather loops.
409
- * @param forceRestore - Optional flag bypass to drop timelines and clear immediately.
410
- * @param blendTime - Optional transition timeline layout duration in seconds.
411
- * @returns `true` if successfully reset, otherwise `false`.
412
- */
413
- ResetWeather(forceRestore?: boolean, blendTime?: number): boolean;
414
- }
415
-
416
- /**
417
- * Extended by CyberMP `vehicleBaseObject` class
418
- * @category Natives
419
- */
420
- interface extended__vehicleBaseObject {
421
- /**
422
- * Confirms whether gravity properties are currently influencing the physical vehicle entity.
423
- * @returns `true` if gravity calculations are active, otherwise `false`.
424
- */
425
- HasGravity(): boolean;
426
-
427
- /**
428
- * Enables or disables physics engine gravity forces on this vehicle.
429
- * @param enable - `true` to apply normal downforce gravity, `false` to disable.
430
- * @returns `true` if state adjusted successfully.
431
- */
432
- EnableGravity(enable: boolean): boolean;
433
-
434
- /**
435
- * Imparts instantaneous raw linear velocity vector impulses into the structural entity coordinates frame.
436
- * @param velocity - Linear velocity vector forces factor.
437
- * @param angularVelocity - Angular momentum spinning forces vector.
438
- * @returns `true` if impulse registers onto object layers.
439
- */
440
- AddLinelyVelocity(velocity: Vector3, angularVelocity: Vector3): boolean;
441
-
442
- /**
443
- * Explicitly sets or resets the exact speed vectors tracking ongoing object momentum.
444
- * @param velocity - Target directional speed vector values coordinates.
445
- * @param angularVelocity - Target rotational angular values coordinates.
446
- * @param switchIndex - Index configuration selection identifier flag.
447
- * @returns `true` if velocity state fields successfully updated.
448
- */
449
- ChangeLinelyVelocity(
450
- velocity: Vector3,
451
- angularVelocity: Vector3,
452
- switchIndex: number,
453
- ): boolean;
454
-
455
- /**
456
- * Retrieves the ongoing linear velocity vectors representing forward/lateral speed momentum.
457
- * @returns Directional speed coordinate matrix vector tracking values.
458
- */
459
- GetVelocity(): Vector3;
460
-
461
- /**
462
- * Retrieves the current rotation speed vector parameters tracking operational values.
463
- * @returns Rotational velocity tracking data vector.
464
- */
465
- GetAngularVelocity(): Vector3;
466
-
467
- /**
468
- * Retrieves the physics engine simulation state mask flags from the object tracking loop.
469
- * @returns Numeric evaluation bitmask tracking active states.
470
- */
471
- GetPhysicsState(): number;
472
-
473
- /**
474
- * Checks whether the vehicle tires or frame base are actively making physical contact with terrain/surfaces.
475
- * @returns `true` if supported on terrain boundaries, otherwise `false`.
476
- */
477
- IsOnGround(): boolean;
478
-
479
- /**
480
- * Retrieves structural bounding box spatial calculation variables for collision tracking.
481
- * @returns Object bounding structural frame dimensional properties limits.
482
- */
483
- GetBoundaryBox(): Box;
484
-
485
- /**
486
- * Callback fired or called manually when the driving authority or network owner ID of this vehicle shifts.
487
- */
488
- VehicleOwnerWasChanged(): void;
489
- }
490
-
491
- /**
492
- * Extended by CyberMP `gameMappinSystem` class
493
- * @category Natives
494
- */
495
- interface extended__gameMappinSystem {
496
- /**
497
- * Pins or tracks a UI map indicator landmark tracking profile target pathing point.
498
- * @param id - Unique mapping ID parameter identifier structure.
499
- */
500
- TrackMappin(id: gameNewMappinID): void;
501
- }
502
-
503
- import '../out/game';
504
-
505
- declare module '../out/game' {
506
- interface worldWeatherScriptInterface {
507
- SetWeather(
508
- weather: CyberEnums.EWeatherState,
509
- blendTime?: number,
510
- priority?: number,
511
- ): boolean;
512
- ResetWeather(forceRestore?: boolean, blendTime?: number): boolean;
513
- }
514
-
515
- interface vehicleBaseObject extends extended__vehicleBaseObject {}
516
-
517
- interface gameMappinSystem extends extended__gameMappinSystem {}
518
-
519
- /**
520
- * Filter type mapped strictly to extract fields inheriting properties originating from `gameScriptableSystem`.
521
- * @template T - The baseline target typing mapping block index to scan.
522
- */
523
- type OnlyExtendingScriptableSystem<T> = {
524
- [K in keyof T as T[K] extends typeof gameScriptableSystem
525
- ? K
526
- : never]: T[K];
527
- };
528
-
529
- interface gameScriptableSystemsContainer<
530
- Map = OnlyExtendingScriptableSystem<MpClasses>,
531
- > {
532
- /**
533
- * Resolves an isolated structural execution system script framework block instance module by name.
534
- * @template N - Key matching target extensions inside active scripting layouts.
535
- * @param systemName - The exact structural name of the requested scriptable system.
536
- * @returns The active unwrapped instance structure mapping implementation.
537
- */
538
- Get<N extends keyof Map>(systemName: N): UnwrapClass<Map[N]>;
539
- }
540
-
541
- namespace ScriptGameInstance {
542
- export function GetLoadingScreenSystem(): LoadingScreenSystem;
543
- export function GetMultiplayerSystem(): MultiplayerSystem;
544
- }
545
-
546
- interface inkISystemRequestsHandler
547
- extends extended__inkISystemRequestsHandler {}
548
-
549
- interface gameuiICharacterCustomizationSystem
550
- extends extended__gameuiICharacterCustomizationSystem {}
551
-
552
- interface entEntity extends extended__entEntity {}
553
-
554
- interface MpClasses {
555
- LoadingScreenSystem: typeof LoadingScreenSystem;
556
- MultiplayerSystem: typeof MultiplayerSystem;
557
- }
558
- }
1
+ import type * as CyberEnums from '../out/enums';
2
+ import type {
3
+ Box,
4
+ EulerAngles,
5
+ entMorphTargetWeightEntry,
6
+ MpClasses,
7
+ Vector3,
8
+ } from '../out/game';
9
+
10
+ /**
11
+ * Extracts the instance type from a class constructor type, or returns the type itself if it is not a constructor.
12
+ * @template T - The type to unwrap.
13
+ * @internal
14
+ */
15
+ type UnwrapClass<T> = T extends { new (): infer U } ? U : T;
16
+
17
+ /**
18
+ * @internal
19
+ */
20
+ type AnyFunc = (...args: any[]) => any;
21
+
22
+ /**
23
+ * @internal
24
+ */
25
+ type SafeMethod<I, M extends keyof I> = I[M] extends AnyFunc ? I[M] : AnyFunc;
26
+
27
+ /**
28
+ * Defines a function signature used to completely override a method within a specified game class.
29
+ * The callback receives the instance (`self`), the original arguments, and the original method implementation as the final parameter.
30
+ * @template C - The class name key from `MpClasses`.
31
+ * @template I - The resolved instance type of the class.
32
+ * @template M - The method names available on the class instance.
33
+ */
34
+ export type OverrideFunction = <
35
+ C extends keyof MpClasses,
36
+ I extends UnwrapClass<MpClasses[C]>,
37
+ M extends keyof I,
38
+ >(
39
+ className: C,
40
+ methodName: M,
41
+ callback: (
42
+ self: I,
43
+ ...args: [...Parameters<SafeMethod<I, M>>, origin: SafeMethod<I, M>]
44
+ ) => ReturnType<SafeMethod<I, M>>,
45
+ ) => void;
46
+
47
+ /**
48
+ * Defines a function signature used to observe (hook into) a method within a specified game class.
49
+ * The callback receives the instance (`self`) and the arguments passed to the method.
50
+ * @template C - The class name key from `MpClasses`.
51
+ * @template I - The resolved instance type of the class.
52
+ * @template M - The method names available on the class instance.
53
+ */
54
+ export type ObserveFunction = <
55
+ C extends keyof MpClasses,
56
+ I extends UnwrapClass<MpClasses[C]>,
57
+ M extends keyof I,
58
+ >(
59
+ className: C,
60
+ methodName: M,
61
+ callback: (self: I, ...args: Parameters<SafeMethod<I, M>>) => void,
62
+ ) => void;
63
+
64
+ /**
65
+ * Interface for interacting with the game's TweakDB database.
66
+ * TweakDB contains static game data, tweaks, and entity configurations.
67
+ * @category Natives
68
+ */
69
+ export interface TweakDB {
70
+ /**
71
+ * Retrieves an array of records matching a specific query or record type.
72
+ * @template T - The expected type of the records.
73
+ * @param str - The TweakDB record path or type identifier.
74
+ * @returns An array of matching records.
75
+ */
76
+ getRecords<T = any>(str: string): T[];
77
+
78
+ /**
79
+ * Retrieves a single record from TweakDB.
80
+ * @template T - The expected type of the record.
81
+ * @param str - The specific TweakDB ID or path string.
82
+ * @returns The requested record.
83
+ */
84
+ getRecord<T = any>(str: string): T;
85
+
86
+ /**
87
+ * Queries TweakDB paths and returns matching entry keys.
88
+ * @param str - The search or query pattern string.
89
+ * @returns An array of matching string IDs.
90
+ */
91
+ query(str: string): string[];
92
+
93
+ /**
94
+ * Retrieves a "flat" property value directly from TweakDB.
95
+ * @template T - The expected type of the flat property.
96
+ * @param str - The path to the flat property (e.g., "Items.SomeItem.someProperty").
97
+ * @returns The flat property value.
98
+ */
99
+ getFlat<T = any>(str: string): T;
100
+
101
+ /**
102
+ * Overwrites an array flat property in TweakDB and updates the engine immediately.
103
+ * @param str - The path to the flat property.
104
+ * @param arr - The new array of values to assign.
105
+ * @returns `true` if the operation was successful, otherwise `false`.
106
+ */
107
+ setFlats(str: string, arr: any[]): boolean;
108
+
109
+ /**
110
+ * Overwrites a single flat property value in TweakDB and updates the engine immediately.
111
+ * @param str - The path to the flat property.
112
+ * @param obj - The new value to assign.
113
+ * @returns `true` if the operation was successful, otherwise `false`.
114
+ */
115
+ setFlat(str: string, obj: any): boolean;
116
+
117
+ /**
118
+ * Overwrites a flat property value in TweakDB *without* triggering an immediate engine update.
119
+ * Useful when batching multiple TweakDB edits before a manual refresh.
120
+ * @param str - The path to the flat property.
121
+ * @param obj - The new value to assign.
122
+ * @returns `true` if the operation was successful, otherwise `false`.
123
+ */
124
+ setFlatNoUpdate(str: string, obj: any): boolean;
125
+
126
+ /**
127
+ * Forces the engine to re-read and update a specific record from its current TweakDB state.
128
+ * @param str - The path to the record to update.
129
+ * @returns `true` if the update succeeded, otherwise `false`.
130
+ */
131
+ updateRecord(str: string): boolean;
132
+
133
+ /**
134
+ * Runtime creates a new TweakDB record.
135
+ * @param key - The new record identifier key.
136
+ * @param value - The record blueprint or type definition key.
137
+ * @returns `true` if creation succeeded, otherwise `false`.
138
+ */
139
+ createRecord(key: string, value: string): boolean;
140
+ }
141
+
142
+ /**
143
+ * Utility interface providing bidirectional translation between readable game engine naming string conventions
144
+ * and their encrypted/hashed formats.
145
+ * @category Natives
146
+ */
147
+ export interface MpGameHashes {
148
+ /**
149
+ * Converts a TweakDB record string path into its unique TweakDBID hash signature format.
150
+ * @param name - The text record path string (e.g., `"Items.money"`).
151
+ * @returns The resolved TweakDBID hash string reference.
152
+ */
153
+ toTweakdbid(name: string): string;
154
+
155
+ /**
156
+ * Resolves an internal TweakDBID hash signature string back into its original readable record path string.
157
+ * @param hash - The native TweakDBID hash layout signature.
158
+ * @returns The readable path text description string if found, otherwise an empty or fallback string representation.
159
+ */
160
+ fromTweakdbid(hash: string): string;
161
+
162
+ /**
163
+ * Resolves a resource file route or asset system address string into its designated numeric/hexadecimal Resource Reference (`ResRef`) signature hash.
164
+ * @param name - The full system asset path string (e.g., `"base\\characters\\main_npc\\jackie.ent"`).
165
+ * @returns The matching native ResRef serialization target hash key.
166
+ */
167
+ toResref(name: string): string;
168
+
169
+ /**
170
+ * Translates a native game engine Resource Reference (`ResRef`) asset identifier string back into its readable raw directory path string.
171
+ * @param hash - The target ResRef hash format token layout string.
172
+ * @returns The verified asset resource string path.
173
+ */
174
+ fromResref(hash: string): string;
175
+
176
+ /**
177
+ * Converts a standard text identifier string into its corresponding internal engine unique 64-bit string identifier (`CName`) hash representation.
178
+ * @param name - The plaintext string label configuration name to translate.
179
+ * @returns The matching numeric engine structure string token representation.
180
+ */
181
+ toCname(name: string): string;
182
+
183
+ /**
184
+ * Reverses a native engine 64-bit name identification token identifier (`CName`) back into its human-readable plaintext string label.
185
+ * @param hash - The string representation of the target CName identifier.
186
+ * @returns The corresponding unhashed string literal value.
187
+ */
188
+ fromCname(hash: string): string;
189
+ }
190
+
191
+ /**
192
+ * Custom CyberMP System managing asset deletion maps, and basic spawn configurations.
193
+ * Accessible through `mp.game.ScriptGameInstance.GetMultiplayerSystem()`
194
+ * @category Natives
195
+ */
196
+ export class MultiplayerSystem {
197
+ /**
198
+ * Removes game object classes (e.g., `GameObject`, `Door`) from the active multiplayer map state.
199
+ * @param objectClassMap - Array of class names from `MpClasses` to clear.
200
+ */
201
+ DeclareDeletedObjects(objectClassMap: Array<keyof MpClasses>): void;
202
+
203
+ /**
204
+ * Removes specific game objects from the network replication map using their unique hash keys.
205
+ * @param objectHashMap - Array of unique entity hashes to delete.
206
+ */
207
+ DeletedObjectsByUniqueHash(objectHashMap: string[]): void;
208
+
209
+ /**
210
+ * Enables or disables synchronization of default game effects, as defined by the CyberMP platform.
211
+ * @param value - `true` to utilize default synchronization effects, `false` to disable them.
212
+ */
213
+ UseDefaultEffectsByPlatform(value: boolean): void;
214
+
215
+ /**
216
+ * Sets the initial default coordinate and orientation fallback position when spawning players.
217
+ * @param position - The 3D coordinates vector.
218
+ * @param yaw - The horizontal rotation (yaw angle) in degrees/radians.
219
+ */
220
+ SetDefaultSpawnPosition(position: Vector3, yaw: number): void;
221
+ }
222
+
223
+ /**
224
+ * System providing status and progression access for the game's loading screen interface.
225
+ * Accessible through `mp.game.ScriptGameInstance.GetLoadingScreenSystem()`
226
+ * @category Natives
227
+ */
228
+ export class LoadingScreenSystem {
229
+ /**
230
+ * Retrieves the current explicit state of the loading screen lifecycle.
231
+ * @returns The state enum value.
232
+ */
233
+ GetLoadingScreenState(): CyberEnums.ELoadingScreenState;
234
+
235
+ /**
236
+ * Gets the numeric loading progression factor.
237
+ * @returns A value representing loading progress (from 0 to 100).
238
+ */
239
+ GetLoadingScreenProgress(): number;
240
+
241
+ /**
242
+ * Callback fired or invoked when the loading screen switches states.
243
+ * @param newState - The new incoming loading screen state enum value.
244
+ */
245
+ OnLoadingScreenStateChange(newState: CyberEnums.ELoadingScreenState): void;
246
+ }
247
+
248
+ /**
249
+ * Core CyberMP Game Interface linking subsystem instances, runtime overrides, using game natives, engine callbacks, and engine utility tasks.
250
+ */
251
+ export interface MpGame {
252
+ /**
253
+ * The global interface instance for TweakDB manipulation.
254
+ */
255
+ TweakDB: TweakDB;
256
+
257
+ /**
258
+ * Utility interface providing bidirectional translation between readable game engine naming string conventions
259
+ * and their encrypted/hashed formats.
260
+ */
261
+ hashes: MpGameHashes;
262
+
263
+ /**
264
+ * Registers a callback listener tracking real-time keyboard or controller hardware input events.
265
+ * @param callback - Function invoked on keystrokes.
266
+ */
267
+ onInputKeyEvent(
268
+ callback: (
269
+ action: CyberEnums.EInputAction,
270
+ key: CyberEnums.EInputKey,
271
+ ) => void,
272
+ ): void;
273
+
274
+ /**
275
+ * Gets the rendering dimensions of the active screen display.
276
+ * @returns A tuple format containing `[width, height]` in pixels.
277
+ */
278
+ getDisplayResolution(): [width: number, height: number];
279
+
280
+ /**
281
+ * Event hook that fires immediately when the underlying game session finishes initial loading structures.
282
+ * @param callback - Execution callback.
283
+ */
284
+ onGameLoaded(callback: () => void): void;
285
+
286
+ /**
287
+ * Event hook that fires ONCE immediately when the underlying game session finishes initial loading structures.
288
+ * @param callback - Execution callback.
289
+ */
290
+ onceGameLoaded(callback: () => void): void;
291
+
292
+ /**
293
+ * Event hook that fires specifically when tweaks and TweakDB engine patches are loaded and safe to manipulate.
294
+ * @param callback - Execution callback.
295
+ */
296
+ onTweak(callback: () => void): void;
297
+
298
+ /**
299
+ * Event hook triggered during early initialization phase of the modding script runtime container.
300
+ * @param callback - Execution callback.
301
+ */
302
+ onInit(callback: () => void): void;
303
+
304
+ /**
305
+ * Event hook that triggers immediately after the local user's player character object spawns in the world space.
306
+ * @param callback - Execution callback.
307
+ */
308
+ onLocalPlayerSpawned(callback: () => void): void;
309
+
310
+ /**
311
+ * Resolves and fetches an engine singleton class reference safely.
312
+ * @template T - The specific key class identifier inside `MpClasses`.
313
+ * @param name - The name identifier string of the singleton.
314
+ * @returns The active unwrapped instance object of that designated class.
315
+ */
316
+ getSingleton<T extends keyof MpClasses>(name: T): UnwrapClass<MpClasses[T]>;
317
+
318
+ /**
319
+ * Directly injects or appends an item template into the player's primary inventory framework.
320
+ * @param itemName - The specific TweakDB string ID of the item.
321
+ * @param count - Total item quantity stack to add.
322
+ */
323
+ AddToInventory(itemName: string, count: number): void;
324
+
325
+ /**
326
+ * Fully replaces a targeted class method with custom script logic.
327
+ * @see {@link OverrideFunction}
328
+ */
329
+ override: OverrideFunction;
330
+
331
+ /**
332
+ * Hooks an observation callback that runs immediately **after** the target native class method executes.
333
+ * @see {@link ObserveFunction}
334
+ */
335
+ observeAfter: ObserveFunction;
336
+
337
+ /**
338
+ * Hooks an observation callback that runs immediately **before** the target native class method executes.
339
+ * @see {@link ObserveFunction}
340
+ */
341
+ observeBefore: ObserveFunction;
342
+
343
+ /**
344
+ * Standard alias hook pointing to {@link observeBefore}. Evaluates logic prior to core target execution.
345
+ * @see {@link ObserveFunction}
346
+ */
347
+ observe: ObserveFunction;
348
+
349
+ /**
350
+ * Observes a method inside a selected class after execution. Can only invoke methods native to {@link MpGame}.
351
+ * Should be used when it is crucial for performance that the function executes as fast as V8 allows.
352
+ * @see {@link ObserveFunction}
353
+ */
354
+ observeAfterRaw: ObserveFunction;
355
+
356
+ /**
357
+ * Observes a method inside a selected class before execution. Can only invoke methods native to {@link MpGame}.
358
+ * Should be used when it is crucial for performance that the function executes as fast as V8 allows.
359
+ * @see {@link ObserveFunction}
360
+ */
361
+ observeBeforeRaw: ObserveFunction;
362
+
363
+ /**
364
+ * Standard alias hook pointing to {@link observeBeforeRaw}. Evaluates high-performance raw logic prior to execution.
365
+ * @see {@link ObserveFunction}
366
+ */
367
+ observeRaw: ObserveFunction;
368
+
369
+ /**
370
+ * Serializes a JavaScript runtime payload object structural value into a native engine container format (`Variant`).
371
+ * @template R - The expected return typing output blueprint shape.
372
+ * @param obj - Target entity object structure to convert.
373
+ * @param str - Native structural reflection mapping blueprint name string.
374
+ * @returns The wrapped engine reference asset layout structure.
375
+ */
376
+ toVariant<R = Record<string, unknown>>(obj: any, str: string): R;
377
+
378
+ /**
379
+ * Deserializes a native engine container structure layout (`Variant`) back into raw accessible JavaScript object values.
380
+ * @template R - The expected target JavaScript shape format.
381
+ * @param obj - Variant payload container input from the game engine.
382
+ * @returns The unwrapped JavaScript object structure data.
383
+ */
384
+ fromVariant<R = any>(obj: any): R;
385
+ }
386
+
387
+ /**
388
+ * Extended by CyberMP `inkISystemRequestsHandler` class
389
+ * @category Natives
390
+ */
391
+ export interface extended__inkISystemRequestsHandler {
392
+ /**
393
+ * Forces the UI context architecture to navigate back out into the main landing splash screen.
394
+ */
395
+ StartMainMenu(): void;
396
+ }
397
+
398
+ /**
399
+ * Extended by CyberMP `entEntity` class
400
+ * @category Natives
401
+ */
402
+ interface extended__entEntity {
403
+ /**
404
+ * Obtains lists specifying explicit weight indexes controlling facial custom blendshapes or structural targets.
405
+ * @returns Array listing mesh blend weights structures.
406
+ */
407
+ GetMorphWeights(): entMorphTargetWeightEntry[];
408
+
409
+ /**
410
+ * Forces the entity container model frame structural layers to assemble and update via selected visual components arrays.
411
+ * @param arr - List containing components structures to attach.
412
+ */
413
+ ReassembleWithComponents(arr: entIComponent[]): void;
414
+
415
+ /**
416
+ * Teleports a physical game object / Pedestrian directly to specific vector coordinates.
417
+ * @param position - Target 3D destination coordinate vector.
418
+ * @param rotation - Optional Euler orientation layout coordinates (Pitch, Roll, Yaw).
419
+ */
420
+ TeleportPed(position: Vector3, rotation?: EulerAngles): void;
421
+ }
422
+
423
+ /**
424
+ * Extended by CyberMP `gameuiICharacterCustomizationSystem` class
425
+ * @category Natives
426
+ */
427
+ interface extended__gameuiICharacterCustomizationSystem {
428
+ /**
429
+ * Updates player's gender state representation variables directly inside system profiles.
430
+ * @param gender - Target gender enum identifier asset option.
431
+ * @param savedPos - Optional parameter to persist or retain vector frame state context layout positions.
432
+ */
433
+ SetPlayerGender(gender: CyberEnums.EPlayerGender, savedPos?: boolean): void;
434
+
435
+ /**
436
+ * Callback fired immediately following successful adjustments to player character gender states.
437
+ * @param gender - The incoming target modified gender enumeration value.
438
+ */
439
+ OnPlayerGenderChanged(gender: CyberEnums.EPlayerGender): void;
440
+ }
441
+
442
+ /**
443
+ * Extended by CyberMP `worldWeatherScriptInterface` class
444
+ * @category Natives
445
+ */
446
+ interface extended__worldWeatherScriptInterface {
447
+ /**
448
+ * Commands the environment engine manager to override active weather profiles.
449
+ * @param weather - The weather enum state or specific profile asset name path string.
450
+ * @param blendTime - Optional transition timeline sequence parameter in seconds.
451
+ * @param priority - Optional overlay layer sorting stack index weight level identifier.
452
+ * @returns `true` if weather override commands executed, otherwise `false`.
453
+ */
454
+ SetWeather(
455
+ weather: CyberEnums.EWeatherState,
456
+ blendTime?: number,
457
+ priority?: number,
458
+ ): boolean;
459
+
460
+ /**
461
+ * Clears ongoing script-driven environmental alterations and returns to automated weather loops.
462
+ * @param forceRestore - Optional flag bypass to drop timelines and clear immediately.
463
+ * @param blendTime - Optional transition timeline layout duration in seconds.
464
+ * @returns `true` if successfully reset, otherwise `false`.
465
+ */
466
+ ResetWeather(forceRestore?: boolean, blendTime?: number): boolean;
467
+ }
468
+
469
+ /**
470
+ * Extended by CyberMP `vehicleBaseObject` class
471
+ * @category Natives
472
+ */
473
+ interface extended__vehicleBaseObject {
474
+ /**
475
+ * Confirms whether gravity properties are currently influencing the physical vehicle entity.
476
+ * @returns `true` if gravity calculations are active, otherwise `false`.
477
+ */
478
+ HasGravity(): boolean;
479
+
480
+ /**
481
+ * Enables or disables physics engine gravity forces on this vehicle.
482
+ * @param enable - `true` to apply normal downforce gravity, `false` to disable.
483
+ * @returns `true` if state adjusted successfully.
484
+ */
485
+ EnableGravity(enable: boolean): boolean;
486
+
487
+ /**
488
+ * Imparts instantaneous raw linear velocity vector impulses into the structural entity coordinates frame.
489
+ * @param velocity - Linear velocity vector forces factor.
490
+ * @param angularVelocity - Angular momentum spinning forces vector.
491
+ * @returns `true` if impulse registers onto object layers.
492
+ */
493
+ AddLinelyVelocity(velocity: Vector3, angularVelocity: Vector3): boolean;
494
+
495
+ /**
496
+ * Explicitly sets or resets the exact speed vectors tracking ongoing object momentum.
497
+ * @param velocity - Target directional speed vector values coordinates.
498
+ * @param angularVelocity - Target rotational angular values coordinates.
499
+ * @param switchIndex - Index configuration selection identifier flag.
500
+ * @returns `true` if velocity state fields successfully updated.
501
+ */
502
+ ChangeLinelyVelocity(
503
+ velocity: Vector3,
504
+ angularVelocity: Vector3,
505
+ switchIndex: number,
506
+ ): boolean;
507
+
508
+ /**
509
+ * Retrieves the ongoing linear velocity vectors representing forward/lateral speed momentum.
510
+ * @returns Directional speed coordinate matrix vector tracking values.
511
+ */
512
+ GetVelocity(): Vector3;
513
+
514
+ /**
515
+ * Retrieves the current rotation speed vector parameters tracking operational values.
516
+ * @returns Rotational velocity tracking data vector.
517
+ */
518
+ GetAngularVelocity(): Vector3;
519
+
520
+ /**
521
+ * Retrieves the physics engine simulation state mask flags from the object tracking loop.
522
+ * @returns Numeric evaluation bitmask tracking active states.
523
+ */
524
+ GetPhysicsState(): number;
525
+
526
+ /**
527
+ * Checks whether the vehicle tires or frame base are actively making physical contact with terrain/surfaces.
528
+ * @returns `true` if supported on terrain boundaries, otherwise `false`.
529
+ */
530
+ IsOnGround(): boolean;
531
+
532
+ /**
533
+ * Retrieves structural bounding box spatial calculation variables for collision tracking.
534
+ * @returns Object bounding structural frame dimensional properties limits.
535
+ */
536
+ GetBoundaryBox(): Box;
537
+
538
+ /**
539
+ * Callback fired or called manually when the driving authority or network owner ID of this vehicle shifts.
540
+ */
541
+ VehicleOwnerWasChanged(): void;
542
+ }
543
+
544
+ /**
545
+ * Extended by CyberMP `gameMappinSystem` class
546
+ * @category Natives
547
+ */
548
+ interface extended__gameMappinSystem {
549
+ /**
550
+ * Pins or tracks a UI map indicator landmark tracking profile target pathing point.
551
+ * @param id - Unique mapping ID parameter identifier structure.
552
+ */
553
+ TrackMappin(id: gameNewMappinID): void;
554
+ }
555
+
556
+ import '../out/game';
557
+
558
+ declare module '../out/game' {
559
+ interface worldWeatherScriptInterface {
560
+ SetWeather(
561
+ weather: CyberEnums.EWeatherState,
562
+ blendTime?: number,
563
+ priority?: number,
564
+ ): boolean;
565
+ ResetWeather(forceRestore?: boolean, blendTime?: number): boolean;
566
+ }
567
+
568
+ interface vehicleBaseObject extends extended__vehicleBaseObject {}
569
+
570
+ interface gameMappinSystem extends extended__gameMappinSystem {}
571
+
572
+ type OnlyExtendingScriptableSystem<T> = {
573
+ [K in keyof T as T[K] extends typeof gameScriptableSystem
574
+ ? K
575
+ : never]: T[K];
576
+ };
577
+
578
+ interface gameScriptableSystemsContainer<
579
+ Map = OnlyExtendingScriptableSystem<MpClasses>,
580
+ > {
581
+ Get<N extends keyof Map>(systemName: N): UnwrapClass<Map[N]>;
582
+ }
583
+
584
+ namespace ScriptGameInstance {
585
+ export function GetLoadingScreenSystem(): LoadingScreenSystem;
586
+ export function GetMultiplayerSystem(): MultiplayerSystem;
587
+ }
588
+
589
+ interface inkISystemRequestsHandler
590
+ extends extended__inkISystemRequestsHandler {}
591
+
592
+ interface gameuiICharacterCustomizationSystem
593
+ extends extended__gameuiICharacterCustomizationSystem {}
594
+
595
+ interface entEntity extends extended__entEntity {}
596
+
597
+ interface MpClasses {
598
+ LoadingScreenSystem: typeof LoadingScreenSystem;
599
+ MultiplayerSystem: typeof MultiplayerSystem;
600
+ }
601
+ }