@cybermp/client-types 1.2.1 → 1.2.3

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,67 +1,67 @@
1
- /// <reference path="./enums.d.ts" />
2
-
3
- /**
4
- * Class with custom CyberMP native methods.
5
- */
6
- declare interface CyberMP {
7
- /**
8
- * Removes game object classes (e.g., T extends gameObject, playerPuppet, NpcPuppet) from the map.
9
- * @param objectClassMap Array of class names to delete.
10
- */
11
- DeclareDeletedObjects(objectClassMap: Array<keyof MpClasses>): void;
12
-
13
- /**
14
- * Removes game objects by their unique hashes from the map.
15
- * @param objectHashMap Array of unique game object hashes to delete.
16
- */
17
- DeletedObjectsByUniqueHash(objectHashMap: string[]): void;
18
-
19
- /**
20
- * Enables or disables synchronization of default effects, as defined by the CyberMP platform.
21
- * @param value Whether to use the default effects.
22
- */
23
- UseDefaultEffectsByPlatform(value: boolean): void;
24
- }
25
-
26
- declare interface worldWeatherScriptInterface extends IScriptable {
27
- public SetWeather(
28
- weather: CyberEnums.WeatherState,
29
- blendTime?: number,
30
- priority?: number,
31
- ): void;
32
- public ResetWeather(forceRestore?: boolean, blendTime?: number): void;
33
- public GetWeatherState(): worldWeatherState;
34
- public GetEnvironmentDefinition(): worldEnvironmentDefinition;
35
- }
36
-
37
- declare interface vehicleBaseObject extends gameObject {
38
- public HasGravity(): boolean;
39
- public EnableGravity(is_enable: boolean): boolean;
40
- public AddLinelyVelocity(
41
- velocity: Vector3,
42
- angularVelocity: Vector3,
43
- ): boolean;
44
- public ChangeLinelyVelocity(
45
- velocity: Vector3,
46
- angularVelocity: Vector3,
47
- switchIndex: number,
48
- ): boolean;
49
- public GetVelocity(): Vector3;
50
- public GetAngularVelocity(): Vector3;
51
- public GetPhysicsState(): number;
52
- public IsOnGround(): boolean;
53
- public GetBoundaryBox(): Box;
54
- public VehicleOwnerWasChanged(): void;
55
- }
56
-
57
- declare interface gameMappinSystem extends gamemappinsIMappinSystem {
58
- TrackMappin(id: gameNewMappinID): void;
59
- }
60
-
61
- type OnlyExtendingScriptableSystem<T> = {
62
- [K in keyof T as T[K] extends typeof gameScriptableSystem ? K : never]: T[K];
63
- };
64
-
65
- declare interface gameScriptableSystemsContainer<Map = OnlyExtendingScriptableSystem<MpClasses>> {
66
- "Get"<N extends keyof Map>(systemName: N): UnwrapMpClass<Map[N]>;
67
- }
1
+ /// <reference path="./enums.d.ts" />
2
+
3
+ /**
4
+ * Class with custom CyberMP native methods.
5
+ */
6
+ declare interface CyberMP {
7
+ /**
8
+ * Removes game object classes (e.g., T extends gameObject, playerPuppet, NpcPuppet) from the map.
9
+ * @param objectClassMap Array of class names to delete.
10
+ */
11
+ DeclareDeletedObjects(objectClassMap: Array<keyof MpClasses>): void;
12
+
13
+ /**
14
+ * Removes game objects by their unique hashes from the map.
15
+ * @param objectHashMap Array of unique game object hashes to delete.
16
+ */
17
+ DeletedObjectsByUniqueHash(objectHashMap: string[]): void;
18
+
19
+ /**
20
+ * Enables or disables synchronization of default effects, as defined by the CyberMP platform.
21
+ * @param value Whether to use the default effects.
22
+ */
23
+ UseDefaultEffectsByPlatform(value: boolean): void;
24
+ }
25
+
26
+ declare interface worldWeatherScriptInterface extends IScriptable {
27
+ public SetWeather(
28
+ weather: CyberEnums.WeatherState,
29
+ blendTime?: number,
30
+ priority?: number,
31
+ ): void;
32
+ public ResetWeather(forceRestore?: boolean, blendTime?: number): void;
33
+ public GetWeatherState(): worldWeatherState;
34
+ public GetEnvironmentDefinition(): worldEnvironmentDefinition;
35
+ }
36
+
37
+ declare interface vehicleBaseObject extends gameObject {
38
+ public HasGravity(): boolean;
39
+ public EnableGravity(is_enable: boolean): boolean;
40
+ public AddLinelyVelocity(
41
+ velocity: Vector3,
42
+ angularVelocity: Vector3,
43
+ ): boolean;
44
+ public ChangeLinelyVelocity(
45
+ velocity: Vector3,
46
+ angularVelocity: Vector3,
47
+ switchIndex: number,
48
+ ): boolean;
49
+ public GetVelocity(): Vector3;
50
+ public GetAngularVelocity(): Vector3;
51
+ public GetPhysicsState(): number;
52
+ public IsOnGround(): boolean;
53
+ public GetBoundaryBox(): Box;
54
+ public VehicleOwnerWasChanged(): void;
55
+ }
56
+
57
+ declare interface gameMappinSystem extends gamemappinsIMappinSystem {
58
+ TrackMappin(id: gameNewMappinID): void;
59
+ }
60
+
61
+ type OnlyExtendingScriptableSystem<T> = {
62
+ [K in keyof T as T[K] extends typeof gameScriptableSystem ? K : never]: T[K];
63
+ };
64
+
65
+ declare interface gameScriptableSystemsContainer<Map = OnlyExtendingScriptableSystem<MpClasses>> {
66
+ "Get"<N extends keyof Map>(systemName: N): UnwrapMpClass<Map[N]>;
67
+ }
@@ -28,8 +28,21 @@ interface ObserveFunction {
28
28
  ): void;
29
29
  }
30
30
 
31
+ interface TweakDB {
32
+ getRecords<T = any>(str: string): T[];
33
+ getRecord<T = any>(str: string): T;
34
+ query(str: string): string[];
35
+ getFlat<T = any>(str: string): T;
36
+ setFlats(str: string, arr: any[]): boolean;
37
+ setFlat(str: string, obj: any): boolean;
38
+ setFlatNoUpdate(str: string, obj: any): boolean;
39
+ updateRecord(str: string): boolean;
40
+ createRecord(key: string, value: string): boolean;
41
+ }
42
+
31
43
  declare interface MpGamePrecomputed {
32
44
  CyberMP: CyberMP;
45
+ TweakDB: TweakDB;
33
46
 
34
47
  /**
35
48
  * Method to retrieve input events.
@@ -51,6 +64,11 @@ declare interface MpGamePrecomputed {
51
64
  */
52
65
  onTweak(callback: () => void): void;
53
66
 
67
+ /**
68
+ * Event when tweaks is loaded.
69
+ */
70
+ onInit(callback: () => void): void;
71
+
54
72
  /**
55
73
  * Event when local player has been spawned.
56
74
  */
@@ -132,6 +150,9 @@ declare interface MpGamePrecomputed {
132
150
  */
133
151
  observeRaw: ObserveFunction;
134
152
 
153
+ toVariant<R = {}>(obj: any, str: string): R;
154
+ fromVariant<R = any>(obj: any): R;
155
+
135
156
  isBlackScreenStarted(): boolean;
136
157
 
137
158
  isBlackScreenEnded(): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cybermp/client-types",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "",
5
5
  "main": "./out/index.d.ts",
6
6
  "files": [