@nativewrappers/redm 0.0.86 → 0.0.88

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/Task.d.ts ADDED
@@ -0,0 +1,46 @@
1
+ import { Vector3 } from "./common/utils/Vector";
2
+ import { BaseEntity } from "./entities/BaseEntity";
3
+ import { Ped } from "./entities/Ped";
4
+ import type { Vehicle } from "./entities/Vehicle";
5
+ import type { AnimationFlags, IkControlFlags } from "./enums/AnimationFlags";
6
+ import { DrivingStyle } from "./enums/Driving";
7
+ import { FiringPatterns } from "./enums/FiringPatterns";
8
+ import { VehicleSeat } from "./enums/VehicleSeat";
9
+ export declare class Tasks {
10
+ private ped;
11
+ constructor(ped: Ped | null);
12
+ achieveHeading(heading: number, timeout?: number): void;
13
+ blockTemporaryEvents(block?: boolean): void;
14
+ aimAt(target: BaseEntity | Vector3, duration: number): void;
15
+ arrest(ped: Ped): void;
16
+ jump(): void;
17
+ climb(): void;
18
+ cruiseWithVehicle(vehicle: Vehicle, speed: number, drivingStyle?: DrivingStyle): void;
19
+ enterAnyVehicle(seat?: VehicleSeat, timeout?: number, speed?: number, flag?: number): void;
20
+ static everyoneLeaveVehicle(vehicle: Vehicle): void;
21
+ fightAgainst(target: Ped, duration?: number): void;
22
+ fightAgainstHatedTargets(radius: number, duration?: number): void;
23
+ fleeFrom(pedOrPosition: Ped | Vector3, distance?: number, duration?: number, fleeType?: number, fleeSpeed?: number, fleeFrom?: Ped): void;
24
+ goTo(position: Vector3, ignorePaths?: boolean, timeout?: number, speed?: number, targetHeading?: number, distanceToSlide?: number, flags?: number): void;
25
+ goToEntity(target: BaseEntity, offset?: Vector3 | null, timeout?: number): void;
26
+ guardCurrentPosition(): void;
27
+ handsUp(duration: number): void;
28
+ lookAt(targetOrPosition: BaseEntity | Vector3, duration?: number): void;
29
+ playAnimation(animDict: string, animName: string, blendInSpeed: number, blendOutSpeed: number, duration: number, playbackRate: number, animFlags: AnimationFlags, ikFlags: IkControlFlags): Promise<void>;
30
+ reloadWeapon(): void;
31
+ shootAt(targetOrPosition: Ped | Vector3, duration?: number, pattern?: FiringPatterns, affectCockedState?: boolean): void;
32
+ shuffleToNextVehicleSeat(vehicle: Vehicle): void;
33
+ slideTo(position: Vector3, heading: number, duration?: number): void;
34
+ standStill(duration: number): void;
35
+ vehicleShootAtPed(target: Ped): void;
36
+ wait(duration: number): void;
37
+ wanderAround(position?: Vector3, radius?: number): void;
38
+ warpIntoVehicle(vehicle: Vehicle, seat: VehicleSeat): void;
39
+ warpOutOfVehicle(vehicle: Vehicle, flags: EnterExitVehicleFlags): void;
40
+ isPlayingAnim(dict: string, anim: string, taskFlag?: number): boolean;
41
+ clearAll(): void;
42
+ clearAllImmediately(): void;
43
+ clearLookAt(): void;
44
+ clearSecondary(): void;
45
+ clearAnimation(animDict: string, animName: string): void;
46
+ }
package/Task.js ADDED
@@ -0,0 +1,312 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { Vector3 } from "./common/utils/Vector";
4
+ import { BaseEntity } from "./entities/BaseEntity";
5
+ import { Ped } from "./entities/Ped";
6
+ import { DrivingStyle } from "./enums/Driving";
7
+ import { FiringPatterns } from "./enums/FiringPatterns";
8
+ import { VehicleSeat } from "./enums/VehicleSeat";
9
+ import { LoadAnimDict } from "./utils/Animations";
10
+ class Tasks {
11
+ static {
12
+ __name(this, "Tasks");
13
+ }
14
+ ped;
15
+ // we take null because sequences have a null ped, if you pass null to this
16
+ // you betterk now what you're doing.
17
+ constructor(ped) {
18
+ const actualPed = ped ?? { handle: null };
19
+ this.ped = actualPed;
20
+ }
21
+ achieveHeading(heading, timeout = 0) {
22
+ TaskAchieveHeading(this.ped.Handle, heading, timeout);
23
+ }
24
+ blockTemporaryEvents(block = true) {
25
+ TaskSetBlockingOfNonTemporaryEvents(this.ped.Handle, block);
26
+ }
27
+ aimAt(target, duration) {
28
+ if (target instanceof BaseEntity)
29
+ TaskAimGunAtEntity(this.ped.Handle, target.Handle, duration, false, false);
30
+ else TaskAimGunAtCoord(this.ped.Handle, target.x, target.y, target.z, duration, false, false);
31
+ }
32
+ arrest(ped) {
33
+ TaskArrestPed(this.ped.Handle, ped.Handle);
34
+ }
35
+ jump() {
36
+ TaskJump(this.ped.Handle, true);
37
+ }
38
+ climb() {
39
+ TaskClimb(this.ped.Handle, true);
40
+ }
41
+ // TODO: test and verify
42
+ // public climbLadder(): void {
43
+ // TaskClimbLadder(this.ped.Handle, 0.0 1);
44
+ // }
45
+ //
46
+ // public cower(duration: number): void {
47
+ // TaskCower(this.ped.Handle, duration);
48
+ // }
49
+ cruiseWithVehicle(vehicle, speed, drivingStyle = DrivingStyle.None) {
50
+ TaskVehicleDriveWander(this.ped.Handle, vehicle.Handle, speed, drivingStyle);
51
+ }
52
+ // public driveTo(
53
+ // vehicle: Vehicle,
54
+ // target: Vector3,
55
+ // radius: number,
56
+ // speed: number,
57
+ // drivingstyle = DrivingStyle.None,
58
+ // ): void {
59
+ // // Swap to TaskVehicleDriveToCoord
60
+ // TaskVehicleDriveToCoordLongrange(
61
+ // this.ped.Handle,
62
+ // vehicle.Handle,
63
+ // target.x,
64
+ // target.y,
65
+ // target.z,
66
+ // speed,
67
+ // drivingstyle,
68
+ // radius,
69
+ // );
70
+ // }
71
+ enterAnyVehicle(seat = VehicleSeat.AnyPassenger, timeout = -1, speed = 0, flag = 0) {
72
+ TaskEnterVehicle(this.ped.Handle, 0, timeout, seat, speed, flag, 0);
73
+ }
74
+ static everyoneLeaveVehicle(vehicle) {
75
+ TaskEveryoneLeaveVehicle(vehicle.Handle, 0);
76
+ }
77
+ fightAgainst(target, duration) {
78
+ if (duration) {
79
+ TaskCombatPedTimed(this.ped.Handle, target.Handle, duration, 0);
80
+ } else {
81
+ TaskCombatPed(this.ped.Handle, target.Handle, 0, 16);
82
+ }
83
+ }
84
+ fightAgainstHatedTargets(radius, duration) {
85
+ if (duration) {
86
+ TaskCombatHatedTargetsAroundPedTimed(this.ped.Handle, radius, duration, 0);
87
+ } else {
88
+ TaskCombatHatedTargetsAroundPed(this.ped.Handle, radius, 0, 0);
89
+ }
90
+ }
91
+ fleeFrom(pedOrPosition, distance = 100, duration = -1, fleeType = 0, fleeSpeed = 3, fleeFrom) {
92
+ if (pedOrPosition instanceof Ped) {
93
+ TaskSmartFleePed(
94
+ this.ped.Handle,
95
+ pedOrPosition.Handle,
96
+ distance,
97
+ duration,
98
+ fleeType,
99
+ fleeSpeed,
100
+ fleeFrom ? fleeFrom.Handle : 0
101
+ );
102
+ } else {
103
+ TaskSmartFleeCoord(
104
+ this.ped.Handle,
105
+ pedOrPosition.x,
106
+ pedOrPosition.y,
107
+ pedOrPosition.z,
108
+ distance,
109
+ duration,
110
+ fleeType,
111
+ fleeSpeed
112
+ );
113
+ }
114
+ }
115
+ // public followPointRoute(points: Vector3[]): void {
116
+ // TaskFlushRoute();
117
+ //
118
+ // points.forEach((point) => TaskExtendRoute(point.x, point.y, point.z));
119
+ //
120
+ // TaskFollowPointRoute(this.ped.Handle, 1, 0);
121
+ // }
122
+ // public followToOffsetFromEntity(
123
+ // target: BaseEntity,
124
+ // offset: Vector3,
125
+ // timeout: number,
126
+ // stoppingRange: number,
127
+ // movementSpeed = 1,
128
+ // persistFollowing = true,
129
+ // ): void {
130
+ // TaskFollowToOffsetOfEntity(
131
+ // this.ped.Handle,
132
+ // target.Handle,
133
+ // offset.x,
134
+ // offset.y,
135
+ // offset.z,
136
+ // movementSpeed,
137
+ // timeout,
138
+ // stoppingRange,
139
+ // persistFollowing,
140
+ // );
141
+ // }
142
+ goTo(position, ignorePaths = false, timeout = -1, speed = 1, targetHeading = 0, distanceToSlide = 0, flags = 0) {
143
+ if (ignorePaths) {
144
+ TaskGoStraightToCoord(
145
+ this.ped.Handle,
146
+ position.x,
147
+ position.y,
148
+ position.z,
149
+ speed,
150
+ timeout,
151
+ targetHeading,
152
+ distanceToSlide,
153
+ 0
154
+ );
155
+ } else {
156
+ TaskFollowNavMeshToCoord(
157
+ this.ped.Handle,
158
+ position.x,
159
+ position.y,
160
+ position.z,
161
+ speed,
162
+ timeout,
163
+ 0,
164
+ flags,
165
+ targetHeading
166
+ );
167
+ }
168
+ }
169
+ goToEntity(target, offset = null, timeout = -1) {
170
+ if (offset === null) {
171
+ offset = new Vector3(0, 0, 0);
172
+ }
173
+ TaskGotoEntityOffsetXy(this.ped.Handle, target.Handle, timeout, offset.x, offset.y, offset.z, 1, true);
174
+ }
175
+ guardCurrentPosition() {
176
+ TaskGuardCurrentPosition(this.ped.Handle, 15, 10, true);
177
+ }
178
+ handsUp(duration) {
179
+ TaskHandsUp(this.ped.Handle, duration, 0, -1, false);
180
+ }
181
+ lookAt(targetOrPosition, duration = -1) {
182
+ if (targetOrPosition instanceof BaseEntity) {
183
+ TaskLookAtEntity(this.ped.Handle, targetOrPosition.Handle, duration, 2048, 31, 0);
184
+ } else {
185
+ TaskLookAtCoord(this.ped.Handle, targetOrPosition.x, targetOrPosition.y, targetOrPosition.z, duration, 0, 51, 0);
186
+ }
187
+ }
188
+ // public performSequence(sequence: TaskSequence): void {
189
+ // if (!sequence.IsClosed) {
190
+ // sequence.close();
191
+ // }
192
+ //
193
+ // this.clearAll();
194
+ // // this.ped.BlockPermanentEvents = true;
195
+ //
196
+ // TaskPerformSequence(this.ped.Handle, sequence.Handle);
197
+ // }
198
+ async playAnimation(animDict, animName, blendInSpeed, blendOutSpeed, duration, playbackRate, animFlags, ikFlags) {
199
+ await LoadAnimDict(animDict);
200
+ TaskPlayAnim(
201
+ this.ped.Handle,
202
+ animDict,
203
+ animName,
204
+ blendInSpeed,
205
+ blendOutSpeed,
206
+ duration,
207
+ animFlags,
208
+ playbackRate,
209
+ false,
210
+ ikFlags,
211
+ false,
212
+ 0,
213
+ false
214
+ );
215
+ RemoveAnimDict(animDict);
216
+ }
217
+ reloadWeapon() {
218
+ TaskReloadWeapon(this.ped.Handle, true);
219
+ }
220
+ shootAt(targetOrPosition, duration = -1, pattern = FiringPatterns.None, affectCockedState = false) {
221
+ if (targetOrPosition instanceof Ped) {
222
+ TaskShootAtEntity(this.ped.Handle, targetOrPosition.Handle, duration, pattern, affectCockedState);
223
+ } else {
224
+ TaskShootAtCoord(
225
+ this.ped.Handle,
226
+ targetOrPosition.x,
227
+ targetOrPosition.y,
228
+ targetOrPosition.z,
229
+ duration,
230
+ pattern,
231
+ 0
232
+ );
233
+ }
234
+ }
235
+ shuffleToNextVehicleSeat(vehicle) {
236
+ TaskShuffleToNextVehicleSeat(this.ped.Handle, vehicle.Handle);
237
+ }
238
+ slideTo(position, heading, duration = 0.7) {
239
+ TaskPedSlideToCoord(this.ped.Handle, position.x, position.y, position.z, heading, duration);
240
+ }
241
+ standStill(duration) {
242
+ TaskStandStill(this.ped.Handle, duration);
243
+ }
244
+ // public startScenario(
245
+ // name: string,
246
+ // position: Vector3,
247
+ // heading = 0,
248
+ // duration = 0,
249
+ // sittingScenario = false,
250
+ // teleport = true,
251
+ // ): void {
252
+ // TaskStartScenarioAtPosition(
253
+ // this.ped.Handle,
254
+ // name,
255
+ // position.x,
256
+ // position.y,
257
+ // position.z,
258
+ // heading,
259
+ // duration,
260
+ // sittingScenario,
261
+ // teleport,
262
+ // );
263
+ // }
264
+ // public swapWeapon(): void {
265
+ // TaskSwapWeapon(this.ped.Handle, false);
266
+ // }
267
+ // public turnTo(targetOrPosition: BaseEntity | Vector3, duration = -1): void {
268
+ // if (targetOrPosition instanceof BaseEntity)
269
+ // TaskTurnPedToFaceEntity(this.ped.Handle, targetOrPosition.Handle, duration);
270
+ // else TaskTurnPedToFaceCoord(this.ped.Handle, targetOrPosition.x, targetOrPosition.y, targetOrPosition.z, duration);
271
+ // }
272
+ vehicleShootAtPed(target) {
273
+ TaskVehicleShootAtPed(this.ped.Handle, target.Handle, 20);
274
+ }
275
+ wait(duration) {
276
+ TaskPause(this.ped.Handle, duration);
277
+ }
278
+ wanderAround(position, radius) {
279
+ if (position && radius) {
280
+ TaskWanderInArea(this.ped.Handle, position.x, position.y, position.z, radius, 0, 0, 0);
281
+ } else {
282
+ TaskWanderStandard(this.ped.Handle, 0, 0);
283
+ }
284
+ }
285
+ warpIntoVehicle(vehicle, seat) {
286
+ TaskWarpPedIntoVehicle(this.ped.Handle, vehicle.Handle, seat);
287
+ }
288
+ warpOutOfVehicle(vehicle, flags) {
289
+ TaskLeaveVehicle(this.ped.Handle, vehicle.Handle, flags, 0);
290
+ }
291
+ isPlayingAnim(dict, anim, taskFlag = 3) {
292
+ return IsEntityPlayingAnim(this.ped.Handle, dict, anim, taskFlag);
293
+ }
294
+ clearAll() {
295
+ ClearPedTasks(this.ped.Handle, true, false);
296
+ }
297
+ clearAllImmediately() {
298
+ ClearPedTasksImmediately(this.ped.Handle, true, false);
299
+ }
300
+ clearLookAt() {
301
+ TaskClearLookAt(this.ped.Handle);
302
+ }
303
+ clearSecondary() {
304
+ ClearPedSecondaryTask(this.ped.Handle);
305
+ }
306
+ clearAnimation(animDict, animName) {
307
+ StopAnimTask(this.ped.Handle, animDict, animName, -4);
308
+ }
309
+ }
310
+ export {
311
+ Tasks
312
+ };
package/Volume.d.ts CHANGED
@@ -1,6 +1,10 @@
1
1
  import type { Vector3 } from "./common/utils/Vector";
2
+ export declare enum VolumeType {
3
+ Cylinder = 0,
4
+ Box = 1
5
+ }
2
6
  export declare class Volume {
3
7
  private handle;
4
- constructor(coord: Vector3, rot: Vector3, scale: Vector3, customName?: string);
8
+ constructor(volumeType: VolumeType, coord: Vector3, rot: Vector3, scale: Vector3, customName?: string);
5
9
  get Handle(): number;
6
10
  }
package/Volume.js CHANGED
@@ -1,32 +1,53 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ var VolumeType = /* @__PURE__ */ ((VolumeType2) => {
4
+ VolumeType2[VolumeType2["Cylinder"] = 0] = "Cylinder";
5
+ VolumeType2[VolumeType2["Box"] = 1] = "Box";
6
+ return VolumeType2;
7
+ })(VolumeType || {});
8
+ function getVolumeFunctionFromType(volumeType, hasCustomName) {
9
+ if (hasCustomName) {
10
+ switch (volumeType) {
11
+ case 0 /* Cylinder */:
12
+ return CreateVolumeCylinderWithCustomName;
13
+ case 1 /* Box */:
14
+ return CreateVolumeBoxWithCustomName;
15
+ }
16
+ } else {
17
+ switch (volumeType) {
18
+ case 0 /* Cylinder */:
19
+ return CreateVolumeCylinder;
20
+ case 1 /* Box */:
21
+ return CreateVolumeBox;
22
+ }
23
+ }
24
+ }
25
+ __name(getVolumeFunctionFromType, "getVolumeFunctionFromType");
3
26
  class Volume {
4
27
  static {
5
28
  __name(this, "Volume");
6
29
  }
7
30
  handle;
8
- constructor(coord, rot, scale, customName) {
9
- if (customName) {
10
- this.handle = CreateVolumeCylinderWithCustomName(
11
- coord.x,
12
- coord.y,
13
- coord.z,
14
- rot.x,
15
- rot.y,
16
- rot.z,
17
- scale.x,
18
- scale.y,
19
- scale.z,
20
- customName
21
- );
22
- return;
23
- }
24
- this.handle = CreateVolumeCylinder(coord.x, coord.y, coord.z, rot.x, rot.y, rot.z, scale.x, scale.y, scale.z);
31
+ constructor(volumeType, coord, rot, scale, customName) {
32
+ const fn = getVolumeFunctionFromType(volumeType, customName !== void 0);
33
+ this.handle = fn(
34
+ coord.x,
35
+ coord.y,
36
+ coord.z,
37
+ rot.x,
38
+ rot.y,
39
+ rot.z,
40
+ scale.x,
41
+ scale.y,
42
+ scale.z,
43
+ customName
44
+ );
25
45
  }
26
46
  get Handle() {
27
47
  return this.handle;
28
48
  }
29
49
  }
30
50
  export {
31
- Volume
51
+ Volume,
52
+ VolumeType
32
53
  };
@@ -23,8 +23,33 @@ export declare class Command<T extends Parameter[] = Parameter[]> {
23
23
  readonly name: string | string[];
24
24
  readonly help: string;
25
25
  readonly params?: T | undefined;
26
+ /**
27
+ * Registers a new executable command with optional parameter validation and permission restrictions.
28
+ * @param name The unique identifier(s) for the command, either as a single string or an array of strings.
29
+ * @param help A description of the command, displayed as a chat suggestion.
30
+ * @param handler The function to execute when the command is executed.
31
+ * @param params An optional array of parameter definitions specifying the command's expected arguments,
32
+ * including their names, types, and descriptive help text for chat suggestions.
33
+ * @param restricted Determines the command's access permissions:
34
+ * - Defaults to `true`, restricting usage to users with the "command.commandName" ACE permission.
35
+ * - A string such as `"group.admin"` grants the command permission to the specified principal.
36
+ * - An array of strings grants permission to multiple principals.
37
+ */
26
38
  constructor(name: string | string[], help: string, handler: CommandHandler<T>, params?: T | undefined, restricted?: Restricted);
39
+ /**
40
+ * Maps the arguments received from a command call to the defined parameters while validating the argument types.
41
+ * @param source The client that executed the command, or -1 if executed by the server.
42
+ * @param args The arguments passed to the command.
43
+ * @param raw The raw input string passed to the command.
44
+ * @returns A mapped object containing parsed parameters.
45
+ */
27
46
  private mapArguments;
47
+ /**
48
+ * Executes the command with the given arguments and source, validating and mapping the arguments before calling the handler.
49
+ * @param source The client that executed the command.
50
+ * @param args The arguments passed to the command.
51
+ * @param raw The raw input string passed to the command.
52
+ */
28
53
  call(source: number, args: string[], raw?: string): Promise<void>;
29
54
  }
30
55
  export {};
package/common/Command.js CHANGED
@@ -1,17 +1,18 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { GlobalData } from "./GlobalData";
3
4
  const commands = [];
4
5
  $SERVER: {
5
6
  on("playerJoining", () => emitNet("chat:addSuggestions", source, commands));
6
7
  }
7
- function registerCommand(name, commandHandler, restricted) {
8
+ function registerCommand(name, commandHandler, restricted = true) {
8
9
  if (Array.isArray(name)) {
9
10
  for (const command of name) {
10
11
  registerCommand(command, commandHandler, restricted);
11
12
  }
12
13
  return;
13
14
  }
14
- RegisterCommand(name, commandHandler, !!restricted);
15
+ RegisterCommand(name, commandHandler, GlobalData.IS_CLIENT ? false : !!restricted);
15
16
  $SERVER: {
16
17
  const ace = `command.${name}`;
17
18
  if (typeof restricted === "string") {
@@ -27,6 +28,18 @@ function registerCommand(name, commandHandler, restricted) {
27
28
  }
28
29
  __name(registerCommand, "registerCommand");
29
30
  class Command {
31
+ /**
32
+ * Registers a new executable command with optional parameter validation and permission restrictions.
33
+ * @param name The unique identifier(s) for the command, either as a single string or an array of strings.
34
+ * @param help A description of the command, displayed as a chat suggestion.
35
+ * @param handler The function to execute when the command is executed.
36
+ * @param params An optional array of parameter definitions specifying the command's expected arguments,
37
+ * including their names, types, and descriptive help text for chat suggestions.
38
+ * @param restricted Determines the command's access permissions:
39
+ * - Defaults to `true`, restricting usage to users with the "command.commandName" ACE permission.
40
+ * - A string such as `"group.admin"` grants the command permission to the specified principal.
41
+ * - An array of strings grants permission to multiple principals.
42
+ */
30
43
  constructor(name, help, handler, params, restricted = true) {
31
44
  this.name = name;
32
45
  this.help = help;
@@ -55,6 +68,13 @@ class Command {
55
68
  __name(this, "Command");
56
69
  }
57
70
  #handler;
71
+ /**
72
+ * Maps the arguments received from a command call to the defined parameters while validating the argument types.
73
+ * @param source The client that executed the command, or -1 if executed by the server.
74
+ * @param args The arguments passed to the command.
75
+ * @param raw The raw input string passed to the command.
76
+ * @returns A mapped object containing parsed parameters.
77
+ */
58
78
  mapArguments(source2, args, raw) {
59
79
  const mapped = {
60
80
  source: source2,
@@ -95,6 +115,12 @@ class Command {
95
115
  });
96
116
  return result ? mapped : null;
97
117
  }
118
+ /**
119
+ * Executes the command with the given arguments and source, validating and mapping the arguments before calling the handler.
120
+ * @param source The client that executed the command.
121
+ * @param args The arguments passed to the command.
122
+ * @param raw The raw input string passed to the command.
123
+ */
98
124
  async call(source2, args, raw = args.join(" ")) {
99
125
  const parsed = this.mapArguments(source2, args, raw);
100
126
  if (!parsed) return;
@@ -35,6 +35,10 @@ export declare class BaseEntity {
35
35
  * @returns Returns true if the entity handle is not 0 and exists in the game engine
36
36
  */
37
37
  get Exists(): boolean;
38
+ /**
39
+ * @returns Returns true if the entity is dead
40
+ */
41
+ get IsDead(): boolean;
38
42
  /**
39
43
  * @returns The entitys current handle.
40
44
  */
@@ -50,6 +50,12 @@ class BaseEntity {
50
50
  get Exists() {
51
51
  return this.handle !== 0 && DoesEntityExist(this.Handle);
52
52
  }
53
+ /**
54
+ * @returns Returns true if the entity is dead
55
+ */
56
+ get IsDead() {
57
+ return IsEntityDead(this.handle);
58
+ }
53
59
  /**
54
60
  * @returns The entitys current handle.
55
61
  */
package/entities/Ped.d.ts CHANGED
@@ -1,12 +1,14 @@
1
+ import type { Vector3 } from "../common/utils/Vector";
2
+ import { Tasks } from "../Task";
1
3
  import { Attributes } from "../Attribute";
2
- import type { eDamageCleanliness, KnockOffVehicle, TamingState } from "../enums/Ped";
4
+ import type { KnockOffVehicle, TamingState, eDamageCleanliness } from "../enums/Ped";
3
5
  import type { VehicleSeat } from "../enums/VehicleSeat";
4
6
  import { BaseEntity } from "./BaseEntity";
5
- import { Vehicle } from "./Vehicle";
6
7
  import type { Player } from "./Player";
7
- import type { Vector3 } from "../common/utils/Vector";
8
+ import { Vehicle } from "./Vehicle";
8
9
  export declare class Ped extends BaseEntity {
9
10
  private attributes;
11
+ private tasks;
10
12
  constructor(handle: number);
11
13
  /**
12
14
  * Blocks scenarios inbetween the specified vectors
@@ -22,6 +24,7 @@ export declare class Ped extends BaseEntity {
22
24
  * @param scenarioId the number returned from {@link blockScenariosInArea}
23
25
  */
24
26
  static removeScenarioBlock(scenarioId: number): void;
27
+ get Tasks(): Tasks;
25
28
  /**
26
29
  * While this increases the peds max health, if used on a player it wont increase the max core value on the hud
27
30
  */
package/entities/Ped.js CHANGED
@@ -1,14 +1,16 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { Tasks } from "../Task";
4
+ import { _N } from "../utils/Native";
3
5
  import { Attributes } from "../Attribute";
4
6
  import { BaseEntity } from "./BaseEntity";
5
7
  import { Vehicle } from "./Vehicle";
6
- import { _N } from "../utils/Native";
7
8
  class Ped extends BaseEntity {
8
9
  static {
9
10
  __name(this, "Ped");
10
11
  }
11
12
  attributes;
13
+ tasks;
12
14
  constructor(handle) {
13
15
  super(handle);
14
16
  }
@@ -39,6 +41,13 @@ class Ped extends BaseEntity {
39
41
  static removeScenarioBlock(scenarioId) {
40
42
  RemoveScenarioBlockingArea(scenarioId, false);
41
43
  }
44
+ get Tasks() {
45
+ if (this.tasks) {
46
+ return this.tasks;
47
+ }
48
+ this.tasks = new Tasks(this);
49
+ return this.tasks;
50
+ }
42
51
  /**
43
52
  * While this increases the peds max health, if used on a player it wont increase the max core value on the hud
44
53
  */
@@ -1,4 +1,5 @@
1
1
  export declare class Pickup {
2
2
  handle: number;
3
3
  constructor(handle: number);
4
+ get Handle(): number;
4
5
  }
@@ -8,6 +8,9 @@ class Pickup {
8
8
  constructor(handle) {
9
9
  this.handle = handle;
10
10
  }
11
+ get Handle() {
12
+ return this.handle;
13
+ }
11
14
  }
12
15
  export {
13
16
  Pickup
@@ -0,0 +1,67 @@
1
+ export declare enum AnimationFlags {
2
+ Looping = 1,
3
+ HoldLastFrame = 2,
4
+ NotInterruptable = 4,
5
+ UpperBody = 8,
6
+ Secondary = 16,
7
+ AbortOnPedMovement = 32,
8
+ Additive = 64,
9
+ OverridePhysics = 128,
10
+ ExtractInitialOffset = 256,
11
+ ExitAfterInterrupted = 512,
12
+ TagSyncIn = 1024,
13
+ TagSyncOut = 2048,
14
+ TagSyncContinuous = 4096,
15
+ ForceStart = 8192,
16
+ UseKinematicPhysic = 16384,
17
+ UseMoverExtractions = 32768,
18
+ DontSuppressLoco = 65536,
19
+ EndsInDeadPose = 131072,
20
+ ActivateRagdollOnCollision = 262144,
21
+ DontExitOnDeath = 524288,
22
+ AbortOnWeaponDamage = 1048576,
23
+ DisableForcedPhysicsUpdate = 2097152,
24
+ Gesture = 4194304,
25
+ SkipIfBlockedByHigherPriorityTask = 8388608,
26
+ UseAbsoluteMover = 16777216,
27
+ _0xC57F16E7 = 33554432,
28
+ UpperBodyTags = 67108864,
29
+ ProcessAttachmentOnStart = 134217728,
30
+ ExpandPedCapsuleFromSkeleton = 268435456,
31
+ BlendoutWrtLastFrame = 536870912,
32
+ DisablePhysicalActivation = 1073741824,
33
+ DisableReleaseEvents = -2147483648
34
+ }
35
+ export declare enum IkControlFlags {
36
+ DisableLegIK = 1,
37
+ DisableArmIK = 2,
38
+ DisableHeadIK = 4,
39
+ DisableTorsoIK = 8,
40
+ DisableTorsoReact = 16,
41
+ UseLegAllowTags = 32,
42
+ UseLegBlockTags = 64,
43
+ UseArmAllowTags = 128,
44
+ UseArmBlockTags = 256,
45
+ ProcessWeaponHandGrip = 512,
46
+ UseFPArmLeft = 1024,
47
+ UseFPArmRight = 2048,
48
+ _0x88FF50BE = 4096,
49
+ DisableTorsoVehicleIK = 8192,
50
+ DisableProneIK = 16384,
51
+ UpperBody = 32768,
52
+ UpperBodyTags = 65536,
53
+ _0xFCDC149B = 131072,
54
+ _0x5465E64A = 262144,
55
+ DisableLegPostureIK = 524288,
56
+ _0x32939A0E = 1048576,
57
+ BlockNonAnimSceneLooks = 2097152,
58
+ _0x3CC5DD38 = 4194304,
59
+ _0xB819088C = 8388608,
60
+ DisableContourIk = 16777216,
61
+ _0xF9E28A5F = 33554432,
62
+ _0x983AE6C1 = 67108864,
63
+ _0x5B5D2BEF = 134217728,
64
+ _0xA4F64B54 = 268435456,
65
+ DisableTwoBokeIK = 536870912,
66
+ _0x0C1380EC = 1073741824
67
+ }
@@ -0,0 +1,73 @@
1
+ var AnimationFlags = /* @__PURE__ */ ((AnimationFlags2) => {
2
+ AnimationFlags2[AnimationFlags2["Looping"] = 1] = "Looping";
3
+ AnimationFlags2[AnimationFlags2["HoldLastFrame"] = 2] = "HoldLastFrame";
4
+ AnimationFlags2[AnimationFlags2["NotInterruptable"] = 4] = "NotInterruptable";
5
+ AnimationFlags2[AnimationFlags2["UpperBody"] = 8] = "UpperBody";
6
+ AnimationFlags2[AnimationFlags2["Secondary"] = 16] = "Secondary";
7
+ AnimationFlags2[AnimationFlags2["AbortOnPedMovement"] = 32] = "AbortOnPedMovement";
8
+ AnimationFlags2[AnimationFlags2["Additive"] = 64] = "Additive";
9
+ AnimationFlags2[AnimationFlags2["OverridePhysics"] = 128] = "OverridePhysics";
10
+ AnimationFlags2[AnimationFlags2["ExtractInitialOffset"] = 256] = "ExtractInitialOffset";
11
+ AnimationFlags2[AnimationFlags2["ExitAfterInterrupted"] = 512] = "ExitAfterInterrupted";
12
+ AnimationFlags2[AnimationFlags2["TagSyncIn"] = 1024] = "TagSyncIn";
13
+ AnimationFlags2[AnimationFlags2["TagSyncOut"] = 2048] = "TagSyncOut";
14
+ AnimationFlags2[AnimationFlags2["TagSyncContinuous"] = 4096] = "TagSyncContinuous";
15
+ AnimationFlags2[AnimationFlags2["ForceStart"] = 8192] = "ForceStart";
16
+ AnimationFlags2[AnimationFlags2["UseKinematicPhysic"] = 16384] = "UseKinematicPhysic";
17
+ AnimationFlags2[AnimationFlags2["UseMoverExtractions"] = 32768] = "UseMoverExtractions";
18
+ AnimationFlags2[AnimationFlags2["DontSuppressLoco"] = 65536] = "DontSuppressLoco";
19
+ AnimationFlags2[AnimationFlags2["EndsInDeadPose"] = 131072] = "EndsInDeadPose";
20
+ AnimationFlags2[AnimationFlags2["ActivateRagdollOnCollision"] = 262144] = "ActivateRagdollOnCollision";
21
+ AnimationFlags2[AnimationFlags2["DontExitOnDeath"] = 524288] = "DontExitOnDeath";
22
+ AnimationFlags2[AnimationFlags2["AbortOnWeaponDamage"] = 1048576] = "AbortOnWeaponDamage";
23
+ AnimationFlags2[AnimationFlags2["DisableForcedPhysicsUpdate"] = 2097152] = "DisableForcedPhysicsUpdate";
24
+ AnimationFlags2[AnimationFlags2["Gesture"] = 4194304] = "Gesture";
25
+ AnimationFlags2[AnimationFlags2["SkipIfBlockedByHigherPriorityTask"] = 8388608] = "SkipIfBlockedByHigherPriorityTask";
26
+ AnimationFlags2[AnimationFlags2["UseAbsoluteMover"] = 16777216] = "UseAbsoluteMover";
27
+ AnimationFlags2[AnimationFlags2["_0xC57F16E7"] = 33554432] = "_0xC57F16E7";
28
+ AnimationFlags2[AnimationFlags2["UpperBodyTags"] = 67108864] = "UpperBodyTags";
29
+ AnimationFlags2[AnimationFlags2["ProcessAttachmentOnStart"] = 134217728] = "ProcessAttachmentOnStart";
30
+ AnimationFlags2[AnimationFlags2["ExpandPedCapsuleFromSkeleton"] = 268435456] = "ExpandPedCapsuleFromSkeleton";
31
+ AnimationFlags2[AnimationFlags2["BlendoutWrtLastFrame"] = 536870912] = "BlendoutWrtLastFrame";
32
+ AnimationFlags2[AnimationFlags2["DisablePhysicalActivation"] = 1073741824] = "DisablePhysicalActivation";
33
+ AnimationFlags2[AnimationFlags2["DisableReleaseEvents"] = -2147483648] = "DisableReleaseEvents";
34
+ return AnimationFlags2;
35
+ })(AnimationFlags || {});
36
+ var IkControlFlags = /* @__PURE__ */ ((IkControlFlags2) => {
37
+ IkControlFlags2[IkControlFlags2["DisableLegIK"] = 1] = "DisableLegIK";
38
+ IkControlFlags2[IkControlFlags2["DisableArmIK"] = 2] = "DisableArmIK";
39
+ IkControlFlags2[IkControlFlags2["DisableHeadIK"] = 4] = "DisableHeadIK";
40
+ IkControlFlags2[IkControlFlags2["DisableTorsoIK"] = 8] = "DisableTorsoIK";
41
+ IkControlFlags2[IkControlFlags2["DisableTorsoReact"] = 16] = "DisableTorsoReact";
42
+ IkControlFlags2[IkControlFlags2["UseLegAllowTags"] = 32] = "UseLegAllowTags";
43
+ IkControlFlags2[IkControlFlags2["UseLegBlockTags"] = 64] = "UseLegBlockTags";
44
+ IkControlFlags2[IkControlFlags2["UseArmAllowTags"] = 128] = "UseArmAllowTags";
45
+ IkControlFlags2[IkControlFlags2["UseArmBlockTags"] = 256] = "UseArmBlockTags";
46
+ IkControlFlags2[IkControlFlags2["ProcessWeaponHandGrip"] = 512] = "ProcessWeaponHandGrip";
47
+ IkControlFlags2[IkControlFlags2["UseFPArmLeft"] = 1024] = "UseFPArmLeft";
48
+ IkControlFlags2[IkControlFlags2["UseFPArmRight"] = 2048] = "UseFPArmRight";
49
+ IkControlFlags2[IkControlFlags2["_0x88FF50BE"] = 4096] = "_0x88FF50BE";
50
+ IkControlFlags2[IkControlFlags2["DisableTorsoVehicleIK"] = 8192] = "DisableTorsoVehicleIK";
51
+ IkControlFlags2[IkControlFlags2["DisableProneIK"] = 16384] = "DisableProneIK";
52
+ IkControlFlags2[IkControlFlags2["UpperBody"] = 32768] = "UpperBody";
53
+ IkControlFlags2[IkControlFlags2["UpperBodyTags"] = 65536] = "UpperBodyTags";
54
+ IkControlFlags2[IkControlFlags2["_0xFCDC149B"] = 131072] = "_0xFCDC149B";
55
+ IkControlFlags2[IkControlFlags2["_0x5465E64A"] = 262144] = "_0x5465E64A";
56
+ IkControlFlags2[IkControlFlags2["DisableLegPostureIK"] = 524288] = "DisableLegPostureIK";
57
+ IkControlFlags2[IkControlFlags2["_0x32939A0E"] = 1048576] = "_0x32939A0E";
58
+ IkControlFlags2[IkControlFlags2["BlockNonAnimSceneLooks"] = 2097152] = "BlockNonAnimSceneLooks";
59
+ IkControlFlags2[IkControlFlags2["_0x3CC5DD38"] = 4194304] = "_0x3CC5DD38";
60
+ IkControlFlags2[IkControlFlags2["_0xB819088C"] = 8388608] = "_0xB819088C";
61
+ IkControlFlags2[IkControlFlags2["DisableContourIk"] = 16777216] = "DisableContourIk";
62
+ IkControlFlags2[IkControlFlags2["_0xF9E28A5F"] = 33554432] = "_0xF9E28A5F";
63
+ IkControlFlags2[IkControlFlags2["_0x983AE6C1"] = 67108864] = "_0x983AE6C1";
64
+ IkControlFlags2[IkControlFlags2["_0x5B5D2BEF"] = 134217728] = "_0x5B5D2BEF";
65
+ IkControlFlags2[IkControlFlags2["_0xA4F64B54"] = 268435456] = "_0xA4F64B54";
66
+ IkControlFlags2[IkControlFlags2["DisableTwoBokeIK"] = 536870912] = "DisableTwoBokeIK";
67
+ IkControlFlags2[IkControlFlags2["_0x0C1380EC"] = 1073741824] = "_0x0C1380EC";
68
+ return IkControlFlags2;
69
+ })(IkControlFlags || {});
70
+ export {
71
+ AnimationFlags,
72
+ IkControlFlags
73
+ };
@@ -0,0 +1,3 @@
1
+ export declare enum DrivingStyle {
2
+ None = 0
3
+ }
@@ -0,0 +1,7 @@
1
+ var DrivingStyle = /* @__PURE__ */ ((DrivingStyle2) => {
2
+ DrivingStyle2[DrivingStyle2["None"] = 0] = "None";
3
+ return DrivingStyle2;
4
+ })(DrivingStyle || {});
5
+ export {
6
+ DrivingStyle
7
+ };
@@ -0,0 +1,31 @@
1
+ declare enum EnterExitVehicleFlags {
2
+ None = 0,
3
+ ResumeIfInterrupted = 1,
4
+ WarpEntryPoint = 2,
5
+ InterruptDuringGetIn = 4,
6
+ JackAnyone = 8,
7
+ WarpPed = 16,
8
+ InterruptDuringGetOut = 32,
9
+ DontWaitForVehicleToStop = 64,
10
+ AllowExteriorEntry = 128,
11
+ DontCloseDoor = 256,
12
+ WarpIfDoorIsBlocked = 512,
13
+ EnterUsingNavmesh = 1024,
14
+ JumpOut = 4096,
15
+ PreferDismountSideWithFewerPeds = 16384,
16
+ DontDefaultWarpIfDoorBlocked = 65536,
17
+ UseLeftEntry = 131072,
18
+ UseRightEntry = 262144,
19
+ JustPullPedOut = 524288,
20
+ BlockSeatShuffling = 1048576,
21
+ WarpIfShuffleLinkIsBlocked = 4194304,
22
+ DontJackAnyone = 8388608,
23
+ WaitForEntryPointToBeClear = 16777216,
24
+ UseHitchDismountVariant = 33554432,
25
+ ExitSeatOnToVehicle = 67108864,
26
+ AllowScriptedTaskAbort = 134217728,
27
+ WillShootAtTargetPeds = 268435456,
28
+ InterruptAlways = 536870912,
29
+ IgnoreEntryFromClosestPoint = 1073741824,
30
+ AllowJackPlayerPedOnLy = -2147483648
31
+ }
File without changes
@@ -0,0 +1,36 @@
1
+ export declare enum FiringPatterns {
2
+ None = 0,
3
+ BurstFire = -687903391,
4
+ UNK1 = -753768974,
5
+ UNK2 = 1857128337,
6
+ BurstFireInCover = 40051185,
7
+ BurstFireMG = 432416687,
8
+ BurstFirePistol = -651807432,
9
+ BurstFirePumpShotgun = 12239771,
10
+ BurstFireRifle = -1670073338,
11
+ BurstFireSmg = -787632658,
12
+ UNK3 = 1575766855,
13
+ BurstSingleShot = -1413485146,
14
+ CompanionBill = -667771326,
15
+ CompanionDutch = -921847361,
16
+ CompanionHosea = 1173361664,
17
+ CompanionJohn = 1026597428,
18
+ CompanionMicah = -2017692654,
19
+ UNK4 = 2055493265,
20
+ UNK5 = -1725067907,
21
+ UNK6 = -2056883078,
22
+ ExConfederatesCombat = 517186037,
23
+ ExplosivesInCover = 365231505,
24
+ UNK7 = 577037782,
25
+ FullAuto = -957453492,
26
+ InCoverCompanionBill = 2047104079,
27
+ InCoverCompanionDutch = -887696719,
28
+ InCoverCompanionHosea = -938698330,
29
+ InCoverCompanionJohn = -451565453,
30
+ InCoverCompanionMicah = -1946394022,
31
+ UNK8 = 1836430378,
32
+ SingleShot = 1566631136,
33
+ SlowShot = -1422700276,
34
+ UNK9 = 1521641709,
35
+ ThrowInCover = -1795196902
36
+ }
@@ -0,0 +1,40 @@
1
+ var FiringPatterns = /* @__PURE__ */ ((FiringPatterns2) => {
2
+ FiringPatterns2[FiringPatterns2["None"] = 0] = "None";
3
+ FiringPatterns2[FiringPatterns2["BurstFire"] = -687903391] = "BurstFire";
4
+ FiringPatterns2[FiringPatterns2["UNK1"] = -753768974] = "UNK1";
5
+ FiringPatterns2[FiringPatterns2["UNK2"] = 1857128337] = "UNK2";
6
+ FiringPatterns2[FiringPatterns2["BurstFireInCover"] = 40051185] = "BurstFireInCover";
7
+ FiringPatterns2[FiringPatterns2["BurstFireMG"] = 432416687] = "BurstFireMG";
8
+ FiringPatterns2[FiringPatterns2["BurstFirePistol"] = -651807432] = "BurstFirePistol";
9
+ FiringPatterns2[FiringPatterns2["BurstFirePumpShotgun"] = 12239771] = "BurstFirePumpShotgun";
10
+ FiringPatterns2[FiringPatterns2["BurstFireRifle"] = -1670073338] = "BurstFireRifle";
11
+ FiringPatterns2[FiringPatterns2["BurstFireSmg"] = -787632658] = "BurstFireSmg";
12
+ FiringPatterns2[FiringPatterns2["UNK3"] = 1575766855] = "UNK3";
13
+ FiringPatterns2[FiringPatterns2["BurstSingleShot"] = -1413485146] = "BurstSingleShot";
14
+ FiringPatterns2[FiringPatterns2["CompanionBill"] = -667771326] = "CompanionBill";
15
+ FiringPatterns2[FiringPatterns2["CompanionDutch"] = -921847361] = "CompanionDutch";
16
+ FiringPatterns2[FiringPatterns2["CompanionHosea"] = 1173361664] = "CompanionHosea";
17
+ FiringPatterns2[FiringPatterns2["CompanionJohn"] = 1026597428] = "CompanionJohn";
18
+ FiringPatterns2[FiringPatterns2["CompanionMicah"] = -2017692654] = "CompanionMicah";
19
+ FiringPatterns2[FiringPatterns2["UNK4"] = 2055493265] = "UNK4";
20
+ FiringPatterns2[FiringPatterns2["UNK5"] = -1725067907] = "UNK5";
21
+ FiringPatterns2[FiringPatterns2["UNK6"] = -2056883078] = "UNK6";
22
+ FiringPatterns2[FiringPatterns2["ExConfederatesCombat"] = 517186037] = "ExConfederatesCombat";
23
+ FiringPatterns2[FiringPatterns2["ExplosivesInCover"] = 365231505] = "ExplosivesInCover";
24
+ FiringPatterns2[FiringPatterns2["UNK7"] = 577037782] = "UNK7";
25
+ FiringPatterns2[FiringPatterns2["FullAuto"] = -957453492] = "FullAuto";
26
+ FiringPatterns2[FiringPatterns2["InCoverCompanionBill"] = 2047104079] = "InCoverCompanionBill";
27
+ FiringPatterns2[FiringPatterns2["InCoverCompanionDutch"] = -887696719] = "InCoverCompanionDutch";
28
+ FiringPatterns2[FiringPatterns2["InCoverCompanionHosea"] = -938698330] = "InCoverCompanionHosea";
29
+ FiringPatterns2[FiringPatterns2["InCoverCompanionJohn"] = -451565453] = "InCoverCompanionJohn";
30
+ FiringPatterns2[FiringPatterns2["InCoverCompanionMicah"] = -1946394022] = "InCoverCompanionMicah";
31
+ FiringPatterns2[FiringPatterns2["UNK8"] = 1836430378] = "UNK8";
32
+ FiringPatterns2[FiringPatterns2["SingleShot"] = 1566631136] = "SingleShot";
33
+ FiringPatterns2[FiringPatterns2["SlowShot"] = -1422700276] = "SlowShot";
34
+ FiringPatterns2[FiringPatterns2["UNK9"] = 1521641709] = "UNK9";
35
+ FiringPatterns2[FiringPatterns2["ThrowInCover"] = -1795196902] = "ThrowInCover";
36
+ return FiringPatterns2;
37
+ })(FiringPatterns || {});
38
+ export {
39
+ FiringPatterns
40
+ };
package/index.d.ts CHANGED
@@ -6,16 +6,22 @@ export * from "./Model";
6
6
  export * from "./RawControls";
7
7
  export * from "./RawKeymaps";
8
8
  export * from "./RelationshipGroup";
9
+ export * from "./Task";
9
10
  export * from "./Volume";
10
11
  export * from "./world/createDraftVehicle";
11
12
  export * from "./world/createPed";
12
13
  export * from "./world/createProp";
13
14
  export * from "./world/createVehicle";
15
+ export * from "./utils/Animations";
14
16
  export * from "./utils/Native";
15
17
  export * from "./types/Throwable";
16
18
  export * from "./interfaces/Dimensions";
19
+ export * from "./enums/AnimationFlags";
17
20
  export * from "./enums/Attributes";
21
+ export * from "./enums/Driving";
22
+ export * from "./enums/EnterExitFlags";
18
23
  export * from "./enums/Entity";
24
+ export * from "./enums/FiringPatterns";
19
25
  export * from "./enums/Keys";
20
26
  export * from "./enums/Ped";
21
27
  export * from "./enums/RawKeys";
package/index.js CHANGED
@@ -6,16 +6,22 @@ export * from "./Model";
6
6
  export * from "./RawControls";
7
7
  export * from "./RawKeymaps";
8
8
  export * from "./RelationshipGroup";
9
+ export * from "./Task";
9
10
  export * from "./Volume";
10
11
  export * from "./world/createDraftVehicle";
11
12
  export * from "./world/createPed";
12
13
  export * from "./world/createProp";
13
14
  export * from "./world/createVehicle";
15
+ export * from "./utils/Animations";
14
16
  export * from "./utils/Native";
15
17
  export * from "./types/Throwable";
16
18
  export * from "./interfaces/Dimensions";
19
+ export * from "./enums/AnimationFlags";
17
20
  export * from "./enums/Attributes";
21
+ export * from "./enums/Driving";
22
+ export * from "./enums/EnterExitFlags";
18
23
  export * from "./enums/Entity";
24
+ export * from "./enums/FiringPatterns";
19
25
  export * from "./enums/Keys";
20
26
  export * from "./enums/Ped";
21
27
  export * from "./enums/RawKeys";
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  ],
9
9
  "license": "MIT",
10
10
  "type": "module",
11
- "version": "0.0.86",
11
+ "version": "0.0.88",
12
12
  "repository": {
13
13
  "type": "git",
14
14
  "url": "https://github.com/nativewrappers/nativewrappers.git"
@@ -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
+ };