@nativewrappers/redm 0.0.85 → 0.0.87

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/RawControls.d.ts CHANGED
@@ -1,7 +1,28 @@
1
1
  import type { RawKeys } from "./enums/RawKeys";
2
2
  export declare class RawControls {
3
- static IsKeyDown(rawKey: RawKeys): boolean;
4
- static IsKeyPressed(rawKey: RawKeys): boolean;
5
- static IsKeyReleased(rawKey: RawKeys): boolean;
6
- static IsKeyUp(rawKey: RawKeys): boolean;
3
+ /**
4
+ * Disables the raw key this frame, making any calls return false even if they
5
+ * are currently pressed/released.
6
+ */
7
+ static DisableKeyThisFrame(rawKey: RawKeys): void;
8
+ /**
9
+ * If the raw key is was just pressed down, will return false if disabled with {@link DisableKeyThisFrame}
10
+ * and {@link canBeDisabled} is set to true
11
+ */
12
+ static WasJustPressed(rawKey: RawKeys, canBeDisabled?: boolean): boolean;
13
+ /**
14
+ * If the raw key is currently pressed down, will return false if disabled with {@link DisableKeyThisFrame}
15
+ * and {@link canBeDisabled} is set to true
16
+ */
17
+ static IsKeyPressed(rawKey: RawKeys, canBeDisabled?: boolean): boolean;
18
+ /**
19
+ * If the raw key is in its up state, will return false if disabled with {@link DisableKeyThisFrame}
20
+ * and {@link canBeDisabled} is set to true
21
+ */
22
+ static IsKeyReleased(rawKey: RawKeys, canBeDisabled?: boolean): boolean;
23
+ /**
24
+ * If the raw key is was just released, will return false if disabled with {@link DisableKeyThisFrame}
25
+ * and {@link canBeDisabled} is set to true
26
+ */
27
+ static WasJustReleased(rawKey: RawKeys, canBeDisabled?: boolean): boolean;
7
28
  }
package/RawControls.js CHANGED
@@ -4,17 +4,40 @@ class RawControls {
4
4
  static {
5
5
  __name(this, "RawControls");
6
6
  }
7
- static IsKeyDown(rawKey) {
8
- return IsRawKeyDown(rawKey);
7
+ /**
8
+ * Disables the raw key this frame, making any calls return false even if they
9
+ * are currently pressed/released.
10
+ */
11
+ static DisableKeyThisFrame(rawKey) {
12
+ DisableRawKeyThisFrame(rawKey);
9
13
  }
10
- static IsKeyPressed(rawKey) {
11
- return IsRawKeyPressed(rawKey);
14
+ /**
15
+ * If the raw key is was just pressed down, will return false if disabled with {@link DisableKeyThisFrame}
16
+ * and {@link canBeDisabled} is set to true
17
+ */
18
+ static WasJustPressed(rawKey, canBeDisabled = true) {
19
+ return canBeDisabled ? IsRawKeyDown(rawKey) : IsDisabledRawKeyDown(rawKey);
12
20
  }
13
- static IsKeyReleased(rawKey) {
14
- return IsRawKeyReleased(rawKey);
21
+ /**
22
+ * If the raw key is currently pressed down, will return false if disabled with {@link DisableKeyThisFrame}
23
+ * and {@link canBeDisabled} is set to true
24
+ */
25
+ static IsKeyPressed(rawKey, canBeDisabled = true) {
26
+ return canBeDisabled ? IsRawKeyPressed(rawKey) : IsDisabledRawKeyPressed(rawKey);
15
27
  }
16
- static IsKeyUp(rawKey) {
17
- return IsRawKeyUp(rawKey);
28
+ /**
29
+ * If the raw key is in its up state, will return false if disabled with {@link DisableKeyThisFrame}
30
+ * and {@link canBeDisabled} is set to true
31
+ */
32
+ static IsKeyReleased(rawKey, canBeDisabled = true) {
33
+ return canBeDisabled ? IsRawKeyReleased(rawKey) : IsDisabledRawKeyReleased(rawKey);
34
+ }
35
+ /**
36
+ * If the raw key is was just released, will return false if disabled with {@link DisableKeyThisFrame}
37
+ * and {@link canBeDisabled} is set to true
38
+ */
39
+ static WasJustReleased(rawKey, canBeDisabled = true) {
40
+ return canBeDisabled ? IsRawKeyUp(rawKey) : IsDisabledRawKeyUp(rawKey);
18
41
  }
19
42
  }
20
43
  export {
@@ -0,0 +1,49 @@
1
+ import type { RawKeys } from "./enums/RawKeys";
2
+ export type KeymapFunction = () => void;
3
+ /**
4
+ * A builder for RawKeymap, you should call {@link finish} to actually register the raw keymap
5
+ * This should be usable across resource bounds, so you can create the keymap
6
+ * and pass the object to a manager to handle rebinding the maps with calls.
7
+ */
8
+ export declare class RawKeymap {
9
+ #private;
10
+ /**
11
+ * @param keymapName the name of the keymap to register to, this should be unique across all resources.
12
+ * @param rawKey the key to bind to initially, this can be rebound with {@link setRawKey}
13
+ * @param canBeDisabled if the key can be disabled with {@link RawControls.DisableKeyThisFrame}
14
+ */
15
+ constructor(keymapName: string, rawKey: RawKeys, canBeDisabled: boolean);
16
+ getKeymapName: () => string;
17
+ /**
18
+ * Gets the current raw keymap
19
+ */
20
+ getRawKeymap: () => RawKeys;
21
+ /**
22
+ * Sets the function to be used onKeyUp
23
+ */
24
+ setOnKeyUp: (fn: KeymapFunction) => void;
25
+ /**
26
+ * Sets the function to be used on onKeyDown
27
+ */
28
+ setOnKeyDown: (fn: KeymapFunction) => void;
29
+ /**
30
+ * Remaps the current {@link RawKeymap}'s raw key to {@link key}
31
+ */
32
+ setRawKey: (key: RawKeys) => void;
33
+ /**
34
+ * Sets the function to be used on onKeyUp, if you need to use this across
35
+ * resource bounds you should use {@link setOnKeyUp}
36
+ */
37
+ set OnKeyUp(fn: KeymapFunction);
38
+ /**
39
+ * Sets the function to be used on onKeyDown, if you need to use this across
40
+ * resource bounds you should use {@link setOnKeyDown}
41
+ */
42
+ set OnKeyDown(fn: KeymapFunction);
43
+ /**
44
+ * Changes the {@link RawKeymap} to use the {@link key} for its keymap
45
+ */
46
+ set RawKey(key: RawKeys);
47
+ get KeymapName(): string;
48
+ finish(): void;
49
+ }
package/RawKeymaps.js ADDED
@@ -0,0 +1,79 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ class RawKeymap {
4
+ static {
5
+ __name(this, "RawKeymap");
6
+ }
7
+ #keymapName;
8
+ #rawKey;
9
+ #canBeDisabled;
10
+ #onKeyUp = null;
11
+ #onKeyDown = null;
12
+ /**
13
+ * @param keymapName the name of the keymap to register to, this should be unique across all resources.
14
+ * @param rawKey the key to bind to initially, this can be rebound with {@link setRawKey}
15
+ * @param canBeDisabled if the key can be disabled with {@link RawControls.DisableKeyThisFrame}
16
+ */
17
+ constructor(keymapName, rawKey, canBeDisabled) {
18
+ this.#keymapName = keymapName;
19
+ this.#rawKey = rawKey;
20
+ this.#canBeDisabled = canBeDisabled;
21
+ }
22
+ getKeymapName = /* @__PURE__ */ __name(() => {
23
+ return this.#keymapName;
24
+ }, "getKeymapName");
25
+ /**
26
+ * Gets the current raw keymap
27
+ */
28
+ getRawKeymap = /* @__PURE__ */ __name(() => {
29
+ return this.#rawKey;
30
+ }, "getRawKeymap");
31
+ /**
32
+ * Sets the function to be used onKeyUp
33
+ */
34
+ setOnKeyUp = /* @__PURE__ */ __name((fn) => {
35
+ this.#onKeyUp = fn;
36
+ }, "setOnKeyUp");
37
+ /**
38
+ * Sets the function to be used on onKeyDown
39
+ */
40
+ setOnKeyDown = /* @__PURE__ */ __name((fn) => {
41
+ this.#onKeyDown = fn;
42
+ }, "setOnKeyDown");
43
+ /**
44
+ * Remaps the current {@link RawKeymap}'s raw key to {@link key}
45
+ */
46
+ setRawKey = /* @__PURE__ */ __name((key) => {
47
+ this.#rawKey = key;
48
+ RemapRawKeymap(this.#keymapName, key);
49
+ }, "setRawKey");
50
+ /**
51
+ * Sets the function to be used on onKeyUp, if you need to use this across
52
+ * resource bounds you should use {@link setOnKeyUp}
53
+ */
54
+ set OnKeyUp(fn) {
55
+ this.#onKeyUp = fn;
56
+ }
57
+ /**
58
+ * Sets the function to be used on onKeyDown, if you need to use this across
59
+ * resource bounds you should use {@link setOnKeyDown}
60
+ */
61
+ set OnKeyDown(fn) {
62
+ this.#onKeyDown = fn;
63
+ }
64
+ /**
65
+ * Changes the {@link RawKeymap} to use the {@link key} for its keymap
66
+ */
67
+ set RawKey(key) {
68
+ this.setRawKey(key);
69
+ }
70
+ get KeymapName() {
71
+ return this.#keymapName;
72
+ }
73
+ finish() {
74
+ RegisterRawKeymap(this.#keymapName, this.#onKeyUp, this.#onKeyDown, this.#rawKey, this.#canBeDisabled);
75
+ }
76
+ }
77
+ export {
78
+ RawKeymap
79
+ };
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
  };
@@ -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
@@ -4,17 +4,24 @@ export * from "./Game";
4
4
  export * from "./GameConstants";
5
5
  export * from "./Model";
6
6
  export * from "./RawControls";
7
+ export * from "./RawKeymaps";
7
8
  export * from "./RelationshipGroup";
9
+ export * from "./Task";
8
10
  export * from "./Volume";
9
11
  export * from "./world/createDraftVehicle";
10
12
  export * from "./world/createPed";
11
13
  export * from "./world/createProp";
12
14
  export * from "./world/createVehicle";
15
+ export * from "./utils/Animations";
13
16
  export * from "./utils/Native";
14
17
  export * from "./types/Throwable";
15
18
  export * from "./interfaces/Dimensions";
19
+ export * from "./enums/AnimationFlags";
16
20
  export * from "./enums/Attributes";
21
+ export * from "./enums/Driving";
22
+ export * from "./enums/EnterExitFlags";
17
23
  export * from "./enums/Entity";
24
+ export * from "./enums/FiringPatterns";
18
25
  export * from "./enums/Keys";
19
26
  export * from "./enums/Ped";
20
27
  export * from "./enums/RawKeys";
package/index.js CHANGED
@@ -4,17 +4,24 @@ export * from "./Game";
4
4
  export * from "./GameConstants";
5
5
  export * from "./Model";
6
6
  export * from "./RawControls";
7
+ export * from "./RawKeymaps";
7
8
  export * from "./RelationshipGroup";
9
+ export * from "./Task";
8
10
  export * from "./Volume";
9
11
  export * from "./world/createDraftVehicle";
10
12
  export * from "./world/createPed";
11
13
  export * from "./world/createProp";
12
14
  export * from "./world/createVehicle";
15
+ export * from "./utils/Animations";
13
16
  export * from "./utils/Native";
14
17
  export * from "./types/Throwable";
15
18
  export * from "./interfaces/Dimensions";
19
+ export * from "./enums/AnimationFlags";
16
20
  export * from "./enums/Attributes";
21
+ export * from "./enums/Driving";
22
+ export * from "./enums/EnterExitFlags";
17
23
  export * from "./enums/Entity";
24
+ export * from "./enums/FiringPatterns";
18
25
  export * from "./enums/Keys";
19
26
  export * from "./enums/Ped";
20
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.85",
11
+ "version": "0.0.87",
12
12
  "repository": {
13
13
  "type": "git",
14
14
  "url": "https://github.com/nativewrappers/nativewrappers.git"
@@ -28,6 +28,7 @@
28
28
  "./**/*.js",
29
29
  "./**/*.d.ts"
30
30
  ],
31
+ "sideEffects": false,
31
32
  "exports": {
32
33
  ".": "./index.js",
33
34
  "./*": "./*"
@@ -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
+ };