@nativewrappers/redm 0.0.122 → 0.0.123

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.
Files changed (72) hide show
  1. package/Task.js +2 -1
  2. package/common/decors/ConVar.d.ts +14 -0
  3. package/common/decors/ConVar.js +70 -0
  4. package/common/decors/Events.d.ts +29 -28
  5. package/common/decors/Events.js +76 -121
  6. package/common/decors/Exports.d.ts +1 -0
  7. package/common/decors/Exports.js +53 -0
  8. package/common/decors/Permissions.d.ts +3 -0
  9. package/common/decors/Permissions.js +49 -0
  10. package/common/decors/Resources.d.ts +8 -0
  11. package/common/decors/Resources.js +83 -0
  12. package/common/decors/Ticks.d.ts +9 -0
  13. package/common/decors/Ticks.js +32 -0
  14. package/common-game/CommonGameConstants.d.ts +7 -0
  15. package/common-game/CommonGameConstants.js +24 -0
  16. package/common-game/CommonModel.d.ts +99 -0
  17. package/common-game/CommonModel.js +172 -0
  18. package/common-game/CommonTasks.d.ts +44 -0
  19. package/common-game/CommonTasks.js +233 -0
  20. package/common-game/cfx/StateBagChangeHandler.d.ts +1 -0
  21. package/common-game/cfx/StateBagChangeHandler.js +0 -0
  22. package/common-game/cfx/cfx.d.ts +6 -0
  23. package/common-game/cfx/cfx.js +4 -0
  24. package/common-game/definitions/index.d.js +0 -0
  25. package/common-game/definitions/redm.d.js +0 -0
  26. package/common-game/entities/CommonBaseEntity.d.ts +116 -0
  27. package/common-game/entities/CommonBaseEntity.js +266 -0
  28. package/common-game/entities/CommonBaseEntityBone.d.ts +11 -0
  29. package/common-game/entities/CommonBaseEntityBone.js +32 -0
  30. package/common-game/entities/CommonBaseEntityBoneCollection.d.ts +9 -0
  31. package/common-game/entities/CommonBaseEntityBoneCollection.js +17 -0
  32. package/common-game/entities/CommonEntityBone.d.ts +5 -0
  33. package/common-game/entities/CommonEntityBone.js +14 -0
  34. package/common-game/entities/CommonEntityBoneCollection.d.ts +9 -0
  35. package/common-game/entities/CommonEntityBoneCollection.js +24 -0
  36. package/common-game/entities/CommonEntityType.d.ts +4 -0
  37. package/common-game/entities/CommonEntityType.js +0 -0
  38. package/common-game/entities/CommonPed.d.ts +16 -0
  39. package/common-game/entities/CommonPed.js +52 -0
  40. package/common-game/entities/CommonPedBone.d.ts +6 -0
  41. package/common-game/entities/CommonPedBone.js +17 -0
  42. package/common-game/entities/CommonPedBoneCollection.d.ts +10 -0
  43. package/common-game/entities/CommonPedBoneCollection.js +31 -0
  44. package/common-game/entities/CommonPlayer.d.ts +61 -0
  45. package/common-game/entities/CommonPlayer.js +156 -0
  46. package/common-game/entities/CommonProp.d.ts +15 -0
  47. package/common-game/entities/CommonProp.js +43 -0
  48. package/common-game/entities/CommonVehicle.d.ts +11 -0
  49. package/common-game/entities/CommonVehicle.js +36 -0
  50. package/common-game/entities/GetEntityClassIdFromHandle.d.ts +2 -0
  51. package/common-game/entities/GetEntityClassIdFromHandle.js +23 -0
  52. package/common-game/entities/IHandle.d.ts +6 -0
  53. package/common-game/entities/IHandle.js +20 -0
  54. package/common-game/enums/VehicleSeat.d.ts +13 -0
  55. package/common-game/enums/VehicleSeat.js +17 -0
  56. package/common-game/interfaces/Dimension.d.ts +5 -0
  57. package/common-game/interfaces/Dimension.js +0 -0
  58. package/common-game/utils/Animations.d.ts +19 -0
  59. package/common-game/utils/Animations.js +43 -0
  60. package/entities/BaseEntity.d.ts +2 -70
  61. package/entities/BaseEntity.js +2 -95
  62. package/entities/Entity.d.ts +4 -0
  63. package/entities/Entity.js +3 -0
  64. package/entities/Ped.d.ts +6 -1
  65. package/entities/Ped.js +11 -5
  66. package/entities/Prop.d.ts +5 -0
  67. package/entities/Prop.js +9 -0
  68. package/entities/Vehicle.d.ts +4 -2
  69. package/entities/Vehicle.js +5 -1
  70. package/index.d.ts +30 -1
  71. package/index.js +30 -1
  72. package/package.json +1 -1
@@ -0,0 +1,61 @@
1
+ import type { StateBagChangeHandler } from "../cfx/StateBagChangeHandler";
2
+ import { CommonPed } from "./CommonPed";
3
+ import type { CommonEntity } from "./CommonEntityType";
4
+ export declare class CommonPlayer {
5
+ private handle;
6
+ private ped?;
7
+ private pvp;
8
+ private stateBagCookies;
9
+ private source;
10
+ private type;
11
+ static AllPlayers(excludeLocalPlayer?: boolean): IterableIterator<CommonPlayer>;
12
+ /**
13
+ * @param handle the handoe of the ped to get the player of
14
+ * @returns the player, or null if the player doesn't exist
15
+ */
16
+ static fromPedHandle(handle: number): CommonPlayer | null;
17
+ /**
18
+ * @param serverId the server id to get the player of
19
+ * @returns the player, or null if the player doesn't exist
20
+ */
21
+ static fromServerId(serverId: number): CommonPlayer | null;
22
+ /**
23
+ * @param [minimumDistance=Number.MAX_VALUE] the minimum distance this should check
24
+ * @param [fromPlayer=GameConstants.Player] the player to get the distance from
25
+ * @returns the closest player from {@param fromPlayer} and the distance the player was
26
+ */
27
+ static getClosestPlayerPedWithDistance(minimumDistance?: number, fromPlayer?: CommonPlayer): [CommonPed | null, number];
28
+ /**
29
+ * @param [minimumDistance=Number.MAX_VALUE] the minimum distance this should check
30
+ * @param [fromPlayer=GameConstants.Player] the player to get the distance from
31
+ * @returns the closest player from {@param fromPlayer} and the distance the player was
32
+ */
33
+ static getClosestPlayerPed(minimumDistance?: number, fromPlayer?: CommonPlayer): CommonPed | null;
34
+ /**
35
+ * @param handle the player handle, or if on the server, their source.
36
+ */
37
+ constructor(handle?: number);
38
+ get Handle(): number;
39
+ /**
40
+ * This is here for compatibility with older versions.
41
+ */
42
+ get Character(): CommonPed;
43
+ get Ped(): CommonPed;
44
+ get ServerId(): number;
45
+ get State(): StateBagInterface;
46
+ AddStateBagChangeHandler(keyFilter: string | null, handler: StateBagChangeHandler<unknown>): number;
47
+ /**
48
+ * A short hand function for AddStateBagChangeHandler, this gets automatically cleaned up on entity deletion.
49
+ * @param keyFilter the key to filter for or null
50
+ * @param handler the function to handle the change
51
+ * @returns a cookie to be used in RemoveStateBagChangeHandler
52
+ */
53
+ listenForStateChange(keyFilter: string | null, handler: StateBagChangeHandler<unknown>): number;
54
+ removeStateListener(tgtCookie: number): void;
55
+ removeAllStateListeners(): void;
56
+ get Name(): string;
57
+ get IsDead(): boolean;
58
+ set DisableFiring(value: boolean);
59
+ get EntityPlayerIsAimingAt(): CommonEntity | null;
60
+ get StealthNoise(): number;
61
+ }
@@ -0,0 +1,156 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { CommonPed } from "./CommonPed";
4
+ import { ClassTypes } from "../../common/utils/ClassTypes";
5
+ import { GetEntityClassFromHandle } from "./GetEntityClassIdFromHandle";
6
+ import cfx from "../cfx/cfx";
7
+ import { GameConstants } from "../CommonGameConstants";
8
+ class CommonPlayer {
9
+ static {
10
+ __name(this, "CommonPlayer");
11
+ }
12
+ handle;
13
+ ped;
14
+ pvp = false;
15
+ stateBagCookies = [];
16
+ source;
17
+ type = ClassTypes.Player;
18
+ static *AllPlayers(excludeLocalPlayer = true) {
19
+ for (const ply of GetActivePlayers()) {
20
+ if (excludeLocalPlayer && ply === GameConstants.PlayerId) {
21
+ continue;
22
+ }
23
+ yield new CommonPlayer(ply);
24
+ }
25
+ }
26
+ /**
27
+ * @param handle the handoe of the ped to get the player of
28
+ * @returns the player, or null if the player doesn't exist
29
+ */
30
+ static fromPedHandle(handle) {
31
+ const playerHandle = NetworkGetPlayerIndexFromPed(handle);
32
+ if (!handle) {
33
+ return null;
34
+ }
35
+ return new CommonPlayer(playerHandle);
36
+ }
37
+ /**
38
+ * @param serverId the server id to get the player of
39
+ * @returns the player, or null if the player doesn't exist
40
+ */
41
+ static fromServerId(serverId) {
42
+ const player = GetPlayerFromServerId(serverId);
43
+ if (player === -1) {
44
+ return null;
45
+ }
46
+ return new CommonPlayer(player);
47
+ }
48
+ /**
49
+ * @param [minimumDistance=Number.MAX_VALUE] the minimum distance this should check
50
+ * @param [fromPlayer=GameConstants.Player] the player to get the distance from
51
+ * @returns the closest player from {@param fromPlayer} and the distance the player was
52
+ */
53
+ static getClosestPlayerPedWithDistance(minimumDistance = Number.MAX_VALUE, fromPlayer = GameConstants.Player) {
54
+ const ped = fromPlayer.Ped;
55
+ const pos = ped.Position;
56
+ const data = [null, Number.MAX_VALUE];
57
+ for (const ply of CommonPlayer.AllPlayers(true)) {
58
+ const tgtPed = ply.Ped;
59
+ const dist = pos.distance(tgtPed.Position);
60
+ if (dist < data[1] && dist < minimumDistance) {
61
+ data[0] = tgtPed;
62
+ data[1] = dist;
63
+ }
64
+ }
65
+ return data;
66
+ }
67
+ /**
68
+ * @param [minimumDistance=Number.MAX_VALUE] the minimum distance this should check
69
+ * @param [fromPlayer=GameConstants.Player] the player to get the distance from
70
+ * @returns the closest player from {@param fromPlayer} and the distance the player was
71
+ */
72
+ static getClosestPlayerPed(minimumDistance = Number.MAX_VALUE, fromPlayer = GameConstants.Player) {
73
+ const data = this.getClosestPlayerPedWithDistance(minimumDistance, fromPlayer);
74
+ return data[0];
75
+ }
76
+ /**
77
+ * @param handle the player handle, or if on the server, their source.
78
+ */
79
+ constructor(handle = -1) {
80
+ this.handle = handle;
81
+ this.source = this.ServerId;
82
+ }
83
+ get Handle() {
84
+ return this.handle;
85
+ }
86
+ /**
87
+ * This is here for compatibility with older versions.
88
+ */
89
+ get Character() {
90
+ return this.Ped;
91
+ }
92
+ get Ped() {
93
+ const handle = GetPlayerPed(this.handle);
94
+ if (typeof this.ped === "undefined" || handle !== this.ped.Handle) {
95
+ this.ped = new CommonPed(handle);
96
+ }
97
+ return this.ped;
98
+ }
99
+ get ServerId() {
100
+ if (this.source) {
101
+ return this.source;
102
+ }
103
+ return GetPlayerServerId(this.handle);
104
+ }
105
+ get State() {
106
+ return cfx.Player(this.ServerId).state;
107
+ }
108
+ AddStateBagChangeHandler(keyFilter, handler) {
109
+ const cookie = AddStateBagChangeHandler(keyFilter, `player:${this.ServerId}`, handler);
110
+ this.stateBagCookies.push(cookie);
111
+ return cookie;
112
+ }
113
+ /**
114
+ * A short hand function for AddStateBagChangeHandler, this gets automatically cleaned up on entity deletion.
115
+ * @param keyFilter the key to filter for or null
116
+ * @param handler the function to handle the change
117
+ * @returns a cookie to be used in RemoveStateBagChangeHandler
118
+ */
119
+ listenForStateChange(keyFilter, handler) {
120
+ return this.AddStateBagChangeHandler(keyFilter, handler);
121
+ }
122
+ removeStateListener(tgtCookie) {
123
+ this.stateBagCookies = this.stateBagCookies.filter((cookie) => {
124
+ const isCookie = cookie === tgtCookie;
125
+ if (isCookie) RemoveStateBagChangeHandler(cookie);
126
+ return isCookie;
127
+ });
128
+ }
129
+ removeAllStateListeners() {
130
+ for (const cookie of this.stateBagCookies) {
131
+ RemoveStateBagChangeHandler(cookie);
132
+ }
133
+ }
134
+ get Name() {
135
+ return GetPlayerName(this.handle);
136
+ }
137
+ get IsDead() {
138
+ return IsPlayerDead(this.handle);
139
+ }
140
+ set DisableFiring(value) {
141
+ DisablePlayerFiring(this.handle, value);
142
+ }
143
+ get EntityPlayerIsAimingAt() {
144
+ const [entityHit, entity] = GetEntityPlayerIsFreeAimingAt(this.handle);
145
+ if (entityHit) {
146
+ return GetEntityClassFromHandle(entity);
147
+ }
148
+ return null;
149
+ }
150
+ get StealthNoise() {
151
+ return GetPlayerCurrentStealthNoise(this.handle);
152
+ }
153
+ }
154
+ export {
155
+ CommonPlayer
156
+ };
@@ -0,0 +1,15 @@
1
+ import { ClassTypes } from "../../common/utils/ClassTypes";
2
+ import { CommonBaseEntity } from "./CommonBaseEntity";
3
+ import { CommonEntityBoneCollection } from "./CommonEntityBoneCollection";
4
+ import type { CommonEntity } from "./CommonEntityType";
5
+ export declare class CommonProp extends CommonBaseEntity {
6
+ static fromHandle(handle: number): CommonProp | null;
7
+ static fromNetworkId(networkId: number): CommonProp | null;
8
+ protected type: ClassTypes;
9
+ protected bones?: CommonEntityBoneCollection | undefined;
10
+ constructor(handle: number);
11
+ exists(): boolean;
12
+ placeOnGround(): void;
13
+ getEntityAttachedTo(): CommonEntity;
14
+ get Bones(): CommonEntityBoneCollection;
15
+ }
@@ -0,0 +1,43 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { ClassTypes } from "../../common/utils/ClassTypes";
4
+ import { CommonBaseEntity } from "./CommonBaseEntity";
5
+ import { CommonEntityBoneCollection } from "./CommonEntityBoneCollection";
6
+ import { GetEntityClassFromHandle } from "./GetEntityClassIdFromHandle";
7
+ class CommonProp extends CommonBaseEntity {
8
+ static {
9
+ __name(this, "CommonProp");
10
+ }
11
+ static fromHandle(handle) {
12
+ return new this(handle);
13
+ }
14
+ static fromNetworkId(networkId) {
15
+ if (!NetworkDoesEntityExistWithNetworkId(networkId)) {
16
+ return null;
17
+ }
18
+ return new this(NetworkGetEntityFromNetworkId(networkId));
19
+ }
20
+ type = ClassTypes.Prop;
21
+ bones;
22
+ constructor(handle) {
23
+ super(handle);
24
+ }
25
+ exists() {
26
+ return super.exists() && GetEntityType(this.handle) === 3;
27
+ }
28
+ placeOnGround() {
29
+ PlaceObjectOnGroundProperly(this.handle);
30
+ }
31
+ getEntityAttachedTo() {
32
+ return GetEntityClassFromHandle(this.handle);
33
+ }
34
+ get Bones() {
35
+ if (!this.bones) {
36
+ this.bones = new CommonEntityBoneCollection(this);
37
+ }
38
+ return this.bones;
39
+ }
40
+ }
41
+ export {
42
+ CommonProp
43
+ };
@@ -0,0 +1,11 @@
1
+ import { ClassTypes } from "../../common/utils/ClassTypes";
2
+ import { CommonBaseEntity } from "./CommonBaseEntity";
3
+ import { CommonEntityBoneCollection } from "./CommonEntityBoneCollection";
4
+ export declare class CommonVehicle extends CommonBaseEntity {
5
+ static fromHandle(handle: number): CommonVehicle | null;
6
+ static fromNetworkId(networkId: number): CommonVehicle | null;
7
+ protected type: ClassTypes;
8
+ protected bones?: CommonEntityBoneCollection;
9
+ constructor(handle: number);
10
+ get Bones(): CommonEntityBoneCollection;
11
+ }
@@ -0,0 +1,36 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { ClassTypes } from "../../common/utils/ClassTypes";
4
+ import { CommonBaseEntity } from "./CommonBaseEntity";
5
+ import { CommonEntityBoneCollection } from "./CommonEntityBoneCollection";
6
+ class CommonVehicle extends CommonBaseEntity {
7
+ static {
8
+ __name(this, "CommonVehicle");
9
+ }
10
+ static fromHandle(handle) {
11
+ if (handle === 0 || !DoesEntityExist(handle)) {
12
+ return null;
13
+ }
14
+ return new this(handle);
15
+ }
16
+ static fromNetworkId(networkId) {
17
+ if (!NetworkDoesEntityExistWithNetworkId(networkId)) {
18
+ return null;
19
+ }
20
+ return new this(NetworkGetEntityFromNetworkId(networkId));
21
+ }
22
+ type = ClassTypes.Vehicle;
23
+ bones;
24
+ constructor(handle) {
25
+ super(handle);
26
+ }
27
+ get Bones() {
28
+ if (!this.bones) {
29
+ this.bones = new CommonEntityBoneCollection(this);
30
+ }
31
+ return this.bones;
32
+ }
33
+ }
34
+ export {
35
+ CommonVehicle
36
+ };
@@ -0,0 +1,2 @@
1
+ import type { CommonEntity } from "./CommonEntityType";
2
+ export declare function GetEntityClassFromHandle(entityId: number): CommonEntity;
@@ -0,0 +1,23 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { CommonPed } from "./CommonPed";
4
+ import { CommonProp } from "./CommonProp";
5
+ import { CommonVehicle } from "./CommonVehicle";
6
+ function GetEntityClassFromHandle(entityId) {
7
+ switch (GetEntityType(entityId)) {
8
+ case 1: {
9
+ return CommonPed.fromHandle(entityId);
10
+ }
11
+ case 2: {
12
+ return CommonVehicle.fromHandle(entityId);
13
+ }
14
+ case 3: {
15
+ return CommonProp.fromHandle(entityId);
16
+ }
17
+ }
18
+ return null;
19
+ }
20
+ __name(GetEntityClassFromHandle, "GetEntityClassFromHandle");
21
+ export {
22
+ GetEntityClassFromHandle
23
+ };
@@ -0,0 +1,6 @@
1
+ export declare class IHandle {
2
+ protected handle: number;
3
+ constructor(handle: number);
4
+ exists(): boolean;
5
+ get Handle(): number;
6
+ }
@@ -0,0 +1,20 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ class IHandle {
4
+ static {
5
+ __name(this, "IHandle");
6
+ }
7
+ handle;
8
+ constructor(handle) {
9
+ this.handle = handle;
10
+ }
11
+ exists() {
12
+ return DoesEntityExist(this.handle);
13
+ }
14
+ get Handle() {
15
+ return this.handle;
16
+ }
17
+ }
18
+ export {
19
+ IHandle
20
+ };
@@ -0,0 +1,13 @@
1
+ export declare enum VehicleSeat {
2
+ AnyPassenger = -2,
3
+ Driver = -1,
4
+ FrontRight = 0,
5
+ BackLeft = 1,
6
+ BackRight = 2,
7
+ ExtraLeft1 = 3,
8
+ ExtraRight1 = 4,
9
+ ExtraLeft2 = 5,
10
+ ExtraRight2 = 6,
11
+ ExtraLeft3 = 7,
12
+ ExtraRight3 = 8
13
+ }
@@ -0,0 +1,17 @@
1
+ var VehicleSeat = /* @__PURE__ */ ((VehicleSeat2) => {
2
+ VehicleSeat2[VehicleSeat2["AnyPassenger"] = -2] = "AnyPassenger";
3
+ VehicleSeat2[VehicleSeat2["Driver"] = -1] = "Driver";
4
+ VehicleSeat2[VehicleSeat2["FrontRight"] = 0] = "FrontRight";
5
+ VehicleSeat2[VehicleSeat2["BackLeft"] = 1] = "BackLeft";
6
+ VehicleSeat2[VehicleSeat2["BackRight"] = 2] = "BackRight";
7
+ VehicleSeat2[VehicleSeat2["ExtraLeft1"] = 3] = "ExtraLeft1";
8
+ VehicleSeat2[VehicleSeat2["ExtraRight1"] = 4] = "ExtraRight1";
9
+ VehicleSeat2[VehicleSeat2["ExtraLeft2"] = 5] = "ExtraLeft2";
10
+ VehicleSeat2[VehicleSeat2["ExtraRight2"] = 6] = "ExtraRight2";
11
+ VehicleSeat2[VehicleSeat2["ExtraLeft3"] = 7] = "ExtraLeft3";
12
+ VehicleSeat2[VehicleSeat2["ExtraRight3"] = 8] = "ExtraRight3";
13
+ return VehicleSeat2;
14
+ })(VehicleSeat || {});
15
+ export {
16
+ VehicleSeat
17
+ };
@@ -0,0 +1,5 @@
1
+ import type { Vector3 } from "../../common/utils/Vector";
2
+ export interface Dimensions {
3
+ min: Vector3;
4
+ max: Vector3;
5
+ }
File without changes
@@ -0,0 +1,19 @@
1
+ /**
2
+ * A utility to load an animation dictionary, anything that loads an animation should RemoveAnimDict after its finish being used.
3
+ * @param animDict the animation dictionary to load
4
+ * @param waitTime how long to wait for the dictionary to load
5
+ * @returns {boolean} if the animation successfully loaded
6
+ */
7
+ export declare const LoadAnimDict: (animDict: string, waitTime?: number) => Promise<boolean>;
8
+ /**
9
+ * A utility to load multiple animation dictionary, anything that loads an animation should RemoveAnimDict after its finish being used.
10
+ * @param animDict the animation dictionary to load
11
+ * @param waitTime how long to wait for the dictionary to load
12
+ * @returns if the animation successfully loaded, if the animation failed to load it will return an array of animations that failed to load
13
+ */
14
+ export declare const LoadAnimDictArray: (animDict: string[], waitTime?: number) => Promise<[boolean, string[] | null]>;
15
+ /**
16
+ * A utility to unload multiple animation dictionary
17
+ * @param animDict the animation dictionaries to unload
18
+ */
19
+ export declare const RemoveAnimDictArray: (animDict: string[]) => void;
@@ -0,0 +1,43 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { Delay } from "../../common/utils/Delay";
4
+ const LoadAnimDict = /* @__PURE__ */ __name(async (animDict, waitTime = 1e3) => {
5
+ const start = GetGameTimer();
6
+ if (!HasAnimDictLoaded(animDict)) {
7
+ RequestAnimDict(animDict);
8
+ }
9
+ while (!HasAnimDictLoaded(animDict)) {
10
+ if (GetGameTimer() - start >= waitTime) return false;
11
+ await Delay(0);
12
+ }
13
+ return true;
14
+ }, "LoadAnimDict");
15
+ const LoadAnimDictArray = /* @__PURE__ */ __name(async (animDict, waitTime = 1e3) => {
16
+ const start = GetGameTimer();
17
+ for (const dict of animDict) {
18
+ if (!HasAnimDictLoaded(dict)) {
19
+ RequestAnimDict(dict);
20
+ }
21
+ }
22
+ const animsLoaded = /* @__PURE__ */ new Set();
23
+ while (animsLoaded.size !== animDict.length) {
24
+ for (const dict of animDict) {
25
+ if (!animsLoaded.has(dict) && HasAnimDictLoaded(dict)) {
26
+ animsLoaded.add(dict);
27
+ }
28
+ }
29
+ if (GetGameTimer() - start >= waitTime) return [false, animDict.filter((dict) => !animsLoaded.has(dict))];
30
+ await Delay(0);
31
+ }
32
+ return [true, null];
33
+ }, "LoadAnimDictArray");
34
+ const RemoveAnimDictArray = /* @__PURE__ */ __name((animDict) => {
35
+ for (const dict of animDict) {
36
+ RemoveAnimDict(dict);
37
+ }
38
+ }, "RemoveAnimDictArray");
39
+ export {
40
+ LoadAnimDict,
41
+ LoadAnimDictArray,
42
+ RemoveAnimDictArray
43
+ };
@@ -1,71 +1,3 @@
1
- import { Vector3 } from "../common/utils/Vector";
2
- export declare class BaseEntity {
3
- protected handle: number;
4
- constructor(entHandle: number);
5
- /**
6
- * Replaces the current handle for the entity used on, this hsould be used sparringly, mainly
7
- * in situations where you're going to reuse an entity over and over and don't want to make a
8
- * new entity every time.
9
- *
10
- * **WARNING**: This does no checks, if you provide it an invalid entity it will use it
11
- *
12
- * ```ts
13
- * const REUSABLE_ENTITY = new Entity(entityHandle);
14
- *
15
- * onNet("entityHandler", (entNetId: number) => {
16
- * // if no net entity we should ignore
17
- * if (!NetworkDoesEntityExistWithNetworkId(entNetId)) return;
18
- *
19
- * // Reuse our entity so we don't have to initialize a new one
20
- * REUSABLE_ENTITY.replaceHandle(NetworkGetEntityFromNetworkId(entNetId));
21
- * // Do something with REUSABLE_ENTITY entity
22
- * })
23
- ```
24
- */
25
- replaceHandle(newHandle: number): void;
26
- /**
27
- * @returns the network for the specified entity, this doesn't check if the entity is networked, you should use {@link IsNetworked}
28
- */
29
- get NetworkId(): number;
30
- /**
31
- * @returns `true` if the current entity is networked, false otherwise
32
- */
33
- get IsNetworked(): boolean;
34
- /**
35
- * @returns Returns true if the entity handle is not 0 and exists in the game engine
36
- */
37
- get Exists(): boolean;
38
- /**
39
- * @returns Returns true if the entity is dead
40
- */
41
- get IsDead(): boolean;
42
- /**
43
- * @returns The entitys current handle.
44
- */
45
- get Handle(): number;
46
- /**
47
- * @param amount the health to set the health to, setting to `0` will kill the entity, if using on a {@link Ped} you should check the MaxHealth before setting.
48
- */
49
- set Health(amount: number);
50
- /**
51
- * @returns the amount of health the current {@link BaseEntity} has
52
- */
53
- get Health(): number;
54
- /**
55
- * @returns the heading of the current {@link BaseEntity}
56
- */
57
- get Heading(): number;
58
- /**
59
- * @param heading sets the entitys heading to the specified heading, this can be in the range of 0..360
60
- */
61
- set Heading(heading: number);
62
- /**
63
- * @returns the position of the current Entity
64
- */
65
- get Position(): Vector3;
66
- /**
67
- * You should (almost) always try to load the collisions before setting the entitys position if going a long distance.
68
- * @param pos sets the position for the current ped
69
- */
70
- set Position(pos: Vector3);
1
+ import { CommonBaseEntity } from "../common-game/entities/CommonBaseEntity";
2
+ export declare abstract class BaseEntity extends CommonBaseEntity {
71
3
  }
@@ -1,104 +1,11 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
  import { Vector3 } from "../common/utils/Vector";
4
- class BaseEntity {
4
+ import { CommonBaseEntity } from "../common-game/entities/CommonBaseEntity";
5
+ class BaseEntity extends CommonBaseEntity {
5
6
  static {
6
7
  __name(this, "BaseEntity");
7
8
  }
8
- handle;
9
- constructor(entHandle) {
10
- this.handle = entHandle;
11
- }
12
- /**
13
- * Replaces the current handle for the entity used on, this hsould be used sparringly, mainly
14
- * in situations where you're going to reuse an entity over and over and don't want to make a
15
- * new entity every time.
16
- *
17
- * **WARNING**: This does no checks, if you provide it an invalid entity it will use it
18
- *
19
- * ```ts
20
- * const REUSABLE_ENTITY = new Entity(entityHandle);
21
- *
22
- * onNet("entityHandler", (entNetId: number) => {
23
- * // if no net entity we should ignore
24
- * if (!NetworkDoesEntityExistWithNetworkId(entNetId)) return;
25
- *
26
- * // Reuse our entity so we don't have to initialize a new one
27
- * REUSABLE_ENTITY.replaceHandle(NetworkGetEntityFromNetworkId(entNetId));
28
- * // Do something with REUSABLE_ENTITY entity
29
- * })
30
- ```
31
- */
32
- replaceHandle(newHandle) {
33
- this.handle = newHandle;
34
- }
35
- /**
36
- * @returns the network for the specified entity, this doesn't check if the entity is networked, you should use {@link IsNetworked}
37
- */
38
- get NetworkId() {
39
- return NetworkGetNetworkIdFromEntity(this.handle);
40
- }
41
- /**
42
- * @returns `true` if the current entity is networked, false otherwise
43
- */
44
- get IsNetworked() {
45
- return NetworkGetEntityIsNetworked(this.handle);
46
- }
47
- /**
48
- * @returns Returns true if the entity handle is not 0 and exists in the game engine
49
- */
50
- get Exists() {
51
- return this.handle !== 0 && DoesEntityExist(this.handle);
52
- }
53
- /**
54
- * @returns Returns true if the entity is dead
55
- */
56
- get IsDead() {
57
- return IsEntityDead(this.handle);
58
- }
59
- /**
60
- * @returns The entitys current handle.
61
- */
62
- get Handle() {
63
- return this.handle;
64
- }
65
- /**
66
- * @param amount the health to set the health to, setting to `0` will kill the entity, if using on a {@link Ped} you should check the MaxHealth before setting.
67
- */
68
- set Health(amount) {
69
- SetEntityHealth(this.handle, amount, 0);
70
- }
71
- /**
72
- * @returns the amount of health the current {@link BaseEntity} has
73
- */
74
- get Health() {
75
- return GetEntityHealth(this.handle);
76
- }
77
- /**
78
- * @returns the heading of the current {@link BaseEntity}
79
- */
80
- get Heading() {
81
- return GetEntityHeading(this.handle);
82
- }
83
- /**
84
- * @param heading sets the entitys heading to the specified heading, this can be in the range of 0..360
85
- */
86
- set Heading(heading) {
87
- SetEntityHeading(this.handle, heading);
88
- }
89
- /**
90
- * @returns the position of the current Entity
91
- */
92
- get Position() {
93
- return Vector3.fromArray(GetEntityCoords(this.handle, true, true));
94
- }
95
- /**
96
- * You should (almost) always try to load the collisions before setting the entitys position if going a long distance.
97
- * @param pos sets the position for the current ped
98
- */
99
- set Position(pos) {
100
- SetEntityCoords(this.handle, pos.x, pos.y, pos.z, false, false, false, false);
101
- }
102
9
  }
103
10
  export {
104
11
  BaseEntity
@@ -2,7 +2,11 @@ import type { Vector3 } from "../common/utils/Vector";
2
2
  import { type BoneIndex, EntityType, ForceType } from "../enums/Entity";
3
3
  import type { Throwable } from "../types/Throwable";
4
4
  import { BaseEntity } from "./BaseEntity";
5
+ import type { CommonBaseEntityBoneCollection } from "../common-game/entities/CommonBaseEntityBoneCollection";
6
+ import { ClassTypes } from "../common/utils/ClassTypes";
5
7
  export declare class Entity extends BaseEntity {
8
+ protected type: ClassTypes;
9
+ protected bones?: CommonBaseEntityBoneCollection | undefined;
6
10
  constructor(handle: number);
7
11
  addTrackingTrails(): void;
8
12
  get EntityType(): EntityType;