@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,32 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ function SetTick() {
4
+ return /* @__PURE__ */ __name(function actualDecorator(originalMethod, context) {
5
+ if (context.private) {
6
+ throw new Error("SetTick does not work on private types, please mark the field as public");
7
+ }
8
+ context.addInitializer(function() {
9
+ setTick(async () => {
10
+ await originalMethod.call(this);
11
+ });
12
+ });
13
+ }, "actualDecorator");
14
+ }
15
+ __name(SetTick, "SetTick");
16
+ function SetImmediate() {
17
+ return /* @__PURE__ */ __name(function actualDecorator(originalMethod, context) {
18
+ if (context.private) {
19
+ throw new Error("SetTick does not work on private types, please mark the field as public");
20
+ }
21
+ context.addInitializer(function() {
22
+ setImmediate(async () => {
23
+ await originalMethod.call(this);
24
+ });
25
+ });
26
+ }, "actualDecorator");
27
+ }
28
+ __name(SetImmediate, "SetImmediate");
29
+ export {
30
+ SetImmediate,
31
+ SetTick
32
+ };
@@ -0,0 +1,7 @@
1
+ import { CommonPlayer } from "./entities/CommonPlayer";
2
+ export declare class GameConstants {
3
+ private static player;
4
+ static readonly PlayerId: number;
5
+ static readonly ServerId: number;
6
+ static get Player(): CommonPlayer;
7
+ }
@@ -0,0 +1,24 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { CommonPlayer } from "./entities/CommonPlayer";
4
+ class GameConstants {
5
+ static {
6
+ __name(this, "GameConstants");
7
+ }
8
+ // the actual player object that will get initialized on the first call to the `get Player()`
9
+ static player = null;
10
+ // The player id of the local client
11
+ static PlayerId = PlayerId();
12
+ // The server id of the local client.
13
+ static ServerId = GetPlayerServerId(GameConstants.PlayerId);
14
+ // The player class of the local object
15
+ static get Player() {
16
+ if (GameConstants.player === null) {
17
+ GameConstants.player = new CommonPlayer(GameConstants.PlayerId);
18
+ }
19
+ return GameConstants.player;
20
+ }
21
+ }
22
+ export {
23
+ GameConstants
24
+ };
@@ -0,0 +1,99 @@
1
+ import type { Dimensions } from "./interfaces/Dimension";
2
+ export declare class CommonModel implements Disposable {
3
+ /**
4
+ * Hash of this model.
5
+ */
6
+ protected hash: number;
7
+ protected requestCount: number;
8
+ /**
9
+ * Returns the amount of times this model has been requested from the client, useful for finding situations where the client fails to release the ref
10
+ */
11
+ get RequestCount(): number;
12
+ /**
13
+ * Creates a model object based on the hash key or model string.
14
+ *
15
+ * @param hash A number or string of the model's hash. Example: "mp_m_freemode_01"
16
+ */
17
+ constructor(hash: number | string);
18
+ [Symbol.dispose](): void;
19
+ /**
20
+ * Gets the hash of the model.
21
+ *
22
+ * @returns The hash key.
23
+ */
24
+ get Hash(): number;
25
+ /**
26
+ * Gets if the model is valid or not.
27
+ *
28
+ * @returns Whether this model is valid.
29
+ */
30
+ get IsValid(): boolean;
31
+ /**
32
+ * Gets if the model is in cd image or not.
33
+ *
34
+ * @returns Whether this model is in cd image.
35
+ */
36
+ get IsInCdImage(): boolean;
37
+ /**
38
+ * Gets if the model is loaded or not.
39
+ *
40
+ * @returns Whether this model is loaded.
41
+ */
42
+ get IsLoaded(): boolean;
43
+ /**
44
+ * Gets if the model collision is loaded or not.
45
+ *
46
+ * @returns Whether this model collision is loaded.
47
+ */
48
+ get IsCollisionLoaded(): boolean;
49
+ /**
50
+ * Gets if the model is a boat or not.
51
+ *
52
+ * @returns Whether this model is a boat.
53
+ */
54
+ get IsBoat(): boolean;
55
+ /**
56
+ * Gets if the model is a Ped or not.
57
+ *
58
+ * @returns Whether this model is a Ped.
59
+ */
60
+ get IsPed(): boolean;
61
+ /**
62
+ * Gets if the model is a prop or not.
63
+ *
64
+ * @returns Whether this model is a prop.
65
+ */
66
+ get IsProp(): boolean;
67
+ /**
68
+ * Gets if the model is a train or not.
69
+ *
70
+ * @returns Whether this model is a train.
71
+ */
72
+ get IsTrain(): boolean;
73
+ /**
74
+ * Gets if the model is a Vehicle or not.
75
+ *
76
+ * @returns Whether this model is a Vehicle.
77
+ */
78
+ get IsVehicle(): boolean;
79
+ get IsWeapon(): boolean;
80
+ /**
81
+ * Gets the model dimensions.
82
+ *
83
+ * @returns This model min & max dimensions.
84
+ */
85
+ get Dimensions(): Dimensions;
86
+ requestModel(): void;
87
+ /**
88
+ * Request and load the model with a specified timeout. Default timeout is 1000 (recommended).
89
+ * This function will not automatically set the model as no longer needed when
90
+ * done.
91
+ *
92
+ * @param timeoutMs Maximum allowed time for model to load.
93
+ */
94
+ request(timeoutMs?: number): Promise<boolean>;
95
+ /**
96
+ * Sets the model as no longer needed allowing the game engine to free memory.
97
+ */
98
+ markAsNoLongerNeeded(): void;
99
+ }
@@ -0,0 +1,172 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { Delay } from "../common/utils/Delay";
4
+ import { Vector3 } from "../common/utils/Vector";
5
+ class CommonModel {
6
+ static {
7
+ __name(this, "CommonModel");
8
+ }
9
+ /**
10
+ * Hash of this model.
11
+ */
12
+ hash;
13
+ requestCount = 0;
14
+ /**
15
+ * Returns the amount of times this model has been requested from the client, useful for finding situations where the client fails to release the ref
16
+ */
17
+ get RequestCount() {
18
+ return this.requestCount;
19
+ }
20
+ /**
21
+ * Creates a model object based on the hash key or model string.
22
+ *
23
+ * @param hash A number or string of the model's hash. Example: "mp_m_freemode_01"
24
+ */
25
+ constructor(hash) {
26
+ if (typeof hash === "string") {
27
+ this.hash = GetHashKey(hash);
28
+ } else {
29
+ this.hash = hash;
30
+ }
31
+ }
32
+ [Symbol.dispose]() {
33
+ if (this.requestCount > 0) {
34
+ this.markAsNoLongerNeeded();
35
+ }
36
+ }
37
+ /**
38
+ * Gets the hash of the model.
39
+ *
40
+ * @returns The hash key.
41
+ */
42
+ get Hash() {
43
+ return this.hash;
44
+ }
45
+ /**
46
+ * Gets if the model is valid or not.
47
+ *
48
+ * @returns Whether this model is valid.
49
+ */
50
+ get IsValid() {
51
+ return IsModelValid(this.hash);
52
+ }
53
+ /**
54
+ * Gets if the model is in cd image or not.
55
+ *
56
+ * @returns Whether this model is in cd image.
57
+ */
58
+ get IsInCdImage() {
59
+ return IsModelInCdimage(this.hash);
60
+ }
61
+ /**
62
+ * Gets if the model is loaded or not.
63
+ *
64
+ * @returns Whether this model is loaded.
65
+ */
66
+ get IsLoaded() {
67
+ if (this.IsWeapon) {
68
+ return Citizen.invokeNative("0xFF07CF465F48B830", this.hash);
69
+ }
70
+ return HasModelLoaded(this.hash);
71
+ }
72
+ /**
73
+ * Gets if the model collision is loaded or not.
74
+ *
75
+ * @returns Whether this model collision is loaded.
76
+ */
77
+ get IsCollisionLoaded() {
78
+ return HasCollisionForModelLoaded(this.hash);
79
+ }
80
+ /**
81
+ * Gets if the model is a boat or not.
82
+ *
83
+ * @returns Whether this model is a boat.
84
+ */
85
+ get IsBoat() {
86
+ return IsThisModelABoat(this.hash);
87
+ }
88
+ /**
89
+ * Gets if the model is a Ped or not.
90
+ *
91
+ * @returns Whether this model is a Ped.
92
+ */
93
+ get IsPed() {
94
+ return IsModelAPed(this.hash);
95
+ }
96
+ /**
97
+ * Gets if the model is a prop or not.
98
+ *
99
+ * @returns Whether this model is a prop.
100
+ */
101
+ get IsProp() {
102
+ return this.IsValid && !this.IsPed && !this.IsVehicle && !this.IsWeapon;
103
+ }
104
+ /**
105
+ * Gets if the model is a train or not.
106
+ *
107
+ * @returns Whether this model is a train.
108
+ */
109
+ get IsTrain() {
110
+ return IsThisModelATrain(this.hash);
111
+ }
112
+ /**
113
+ * Gets if the model is a Vehicle or not.
114
+ *
115
+ * @returns Whether this model is a Vehicle.
116
+ */
117
+ get IsVehicle() {
118
+ return IsModelAVehicle(this.hash);
119
+ }
120
+ get IsWeapon() {
121
+ return IsWeaponValid(this.hash);
122
+ }
123
+ /**
124
+ * Gets the model dimensions.
125
+ *
126
+ * @returns This model min & max dimensions.
127
+ */
128
+ get Dimensions() {
129
+ const [minArray, maxArray] = GetModelDimensions(this.hash);
130
+ const min = Vector3.fromArray(minArray);
131
+ const max = Vector3.fromArray(maxArray);
132
+ return { min, max };
133
+ }
134
+ // TODO: Metaped stuff too at some point
135
+ requestModel() {
136
+ RequestModel(this.hash, false);
137
+ this.requestCount++;
138
+ }
139
+ /**
140
+ * Request and load the model with a specified timeout. Default timeout is 1000 (recommended).
141
+ * This function will not automatically set the model as no longer needed when
142
+ * done.
143
+ *
144
+ * @param timeoutMs Maximum allowed time for model to load.
145
+ */
146
+ async request(timeoutMs = 1e3) {
147
+ if (!this.IsInCdImage && !this.IsValid && !this.IsWeapon) {
148
+ return false;
149
+ }
150
+ if (this.IsLoaded) {
151
+ return true;
152
+ }
153
+ this.requestModel();
154
+ const timeout = GetGameTimer() + timeoutMs;
155
+ while (!this.IsLoaded && GetGameTimer() < timeout) {
156
+ await Delay(0);
157
+ }
158
+ if (!this.IsLoaded) {
159
+ this.markAsNoLongerNeeded();
160
+ }
161
+ return this.IsLoaded;
162
+ }
163
+ /**
164
+ * Sets the model as no longer needed allowing the game engine to free memory.
165
+ */
166
+ markAsNoLongerNeeded() {
167
+ SetModelAsNoLongerNeeded(this.hash);
168
+ }
169
+ }
170
+ export {
171
+ CommonModel
172
+ };
@@ -0,0 +1,44 @@
1
+ import { Vector3 } from "../common/utils/Vector";
2
+ import { CommonBaseEntity } from "./entities/CommonBaseEntity";
3
+ import { CommonPed } from "./entities/CommonPed";
4
+ import type { CommonVehicle } from "./entities/CommonVehicle";
5
+ import { VehicleSeat } from "./enums/VehicleSeat";
6
+ import { IHandle } from "./entities/IHandle";
7
+ export declare class CommonTasks {
8
+ protected ped: IHandle;
9
+ constructor(ped: IHandle | null);
10
+ achieveHeading(heading: number, timeout?: number): void;
11
+ blockTemporaryEvents(block?: boolean): void;
12
+ aimAt(target: CommonBaseEntity | Vector3, duration: number): void;
13
+ arrest(ped: CommonPed): void;
14
+ jump(): void;
15
+ climb(): void;
16
+ cruiseWithVehicle(vehicle: CommonVehicle, speed: number, drivingStyle?: number): void;
17
+ enterAnyVehicle(seat?: VehicleSeat, timeout?: number, speed?: number, flag?: number): void;
18
+ static everyoneLeaveVehicle(vehicle: CommonVehicle): void;
19
+ fightAgainst(target: CommonPed, duration?: number): void;
20
+ fightAgainstHatedTargets(radius: number, duration?: number): void;
21
+ fleeFrom(pedOrPosition: CommonPed | Vector3, distance?: number, duration?: number, fleeType?: number, fleeSpeed?: number, fleeFrom?: IHandle): void;
22
+ goTo(position: Vector3, ignorePaths?: boolean, timeout?: number, speed?: number, targetHeading?: number, distanceToSlide?: number, flags?: number): void;
23
+ goToEntity(target: CommonBaseEntity, offset?: Vector3, timeout?: number): void;
24
+ guardCurrentPosition(): void;
25
+ handsUp(duration: number): void;
26
+ lookAt(targetOrPosition: CommonBaseEntity | Vector3, duration?: number): void;
27
+ playAnimation(animDict: string, animName: string, blendInSpeed: number, blendOutSpeed: number, duration: number, playbackRate: number, animFlags: number, ikFlags?: number): Promise<void>;
28
+ reloadWeapon(): void;
29
+ shootAt(targetOrPosition: IHandle | Vector3, duration?: number, pattern?: number, affectCockedState?: boolean): void;
30
+ shuffleToNextVehicleSeat(vehicle: CommonVehicle): void;
31
+ slideTo(position: Vector3, heading: number, duration?: number): void;
32
+ standStill(duration: number): void;
33
+ vehicleShootAtPed(target: CommonPed): void;
34
+ wait(duration: number): void;
35
+ wanderAround(position?: Vector3, radius?: number): void;
36
+ warpIntoVehicle(vehicle: CommonVehicle, seat: VehicleSeat): void;
37
+ warpOutOfVehicle(vehicle: CommonVehicle, flags: number): void;
38
+ isPlayingAnim(dict: string, anim: string, taskFlag?: number): boolean;
39
+ clearAll(): void;
40
+ clearAllImmediately(): void;
41
+ clearLookAt(): void;
42
+ clearSecondary(): void;
43
+ clearAnimation(animDict: string, animName: string): void;
44
+ }
@@ -0,0 +1,233 @@
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 { CommonBaseEntity } from "./entities/CommonBaseEntity";
5
+ import { CommonPed } from "./entities/CommonPed";
6
+ import { VehicleSeat } from "./enums/VehicleSeat";
7
+ import { LoadAnimDict } from "./utils/Animations";
8
+ import { GlobalData } from "../common/GlobalData";
9
+ import { IHandle } from "./entities/IHandle";
10
+ class CommonTasks {
11
+ static {
12
+ __name(this, "CommonTasks");
13
+ }
14
+ ped;
15
+ // we take null because sequences have a null ped, if you pass null to this
16
+ // you better 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 CommonBaseEntity)
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
+ cruiseWithVehicle(vehicle, speed, drivingStyle = 0) {
42
+ TaskVehicleDriveWander(this.ped.Handle, vehicle.Handle, speed, drivingStyle);
43
+ }
44
+ enterAnyVehicle(seat = VehicleSeat.AnyPassenger, timeout = -1, speed = 0, flag = 0) {
45
+ TaskEnterVehicle(this.ped.Handle, 0, timeout, seat, speed, flag, 0);
46
+ }
47
+ static everyoneLeaveVehicle(vehicle) {
48
+ TaskEveryoneLeaveVehicle(vehicle.Handle, 0);
49
+ }
50
+ fightAgainst(target, duration) {
51
+ if (duration) {
52
+ TaskCombatPedTimed(this.ped.Handle, target.Handle, duration, 0);
53
+ } else {
54
+ TaskCombatPed(this.ped.Handle, target.Handle, 0, 16);
55
+ }
56
+ }
57
+ fightAgainstHatedTargets(radius, duration) {
58
+ if (duration) {
59
+ TaskCombatHatedTargetsAroundPedTimed(this.ped.Handle, radius, duration, 0);
60
+ } else {
61
+ TaskCombatHatedTargetsAroundPed(this.ped.Handle, radius, 0, 0);
62
+ }
63
+ }
64
+ fleeFrom(pedOrPosition, distance = 100, duration = -1, fleeType = 0, fleeSpeed = 3, fleeFrom) {
65
+ if (pedOrPosition instanceof CommonPed) {
66
+ TaskSmartFleePed(
67
+ this.ped.Handle,
68
+ pedOrPosition.Handle,
69
+ distance,
70
+ duration,
71
+ fleeType,
72
+ fleeSpeed,
73
+ fleeFrom ? fleeFrom.Handle : 0
74
+ );
75
+ } else {
76
+ TaskSmartFleeCoord(
77
+ this.ped.Handle,
78
+ pedOrPosition.x,
79
+ pedOrPosition.y,
80
+ pedOrPosition.z,
81
+ distance,
82
+ duration,
83
+ fleeType,
84
+ fleeSpeed
85
+ );
86
+ }
87
+ }
88
+ goTo(position, ignorePaths = false, timeout = -1, speed = 1, targetHeading = 0, distanceToSlide = 0, flags = 0) {
89
+ if (ignorePaths) {
90
+ TaskGoStraightToCoord(
91
+ this.ped.Handle,
92
+ position.x,
93
+ position.y,
94
+ position.z,
95
+ speed,
96
+ timeout,
97
+ targetHeading,
98
+ distanceToSlide,
99
+ 0
100
+ );
101
+ } else {
102
+ TaskFollowNavMeshToCoord(
103
+ this.ped.Handle,
104
+ position.x,
105
+ position.y,
106
+ position.z,
107
+ speed,
108
+ timeout,
109
+ 0,
110
+ flags,
111
+ targetHeading
112
+ );
113
+ }
114
+ }
115
+ goToEntity(target, offset = new Vector3(0), timeout = -1) {
116
+ TaskGotoEntityOffsetXy(this.ped.Handle, target.Handle, timeout, offset.x, offset.y, offset.z, 1, true);
117
+ }
118
+ guardCurrentPosition() {
119
+ TaskGuardCurrentPosition(this.ped.Handle, 15, 10, true);
120
+ }
121
+ handsUp(duration) {
122
+ TaskHandsUp(this.ped.Handle, duration, 0, -1, false);
123
+ }
124
+ lookAt(targetOrPosition, duration = -1) {
125
+ if (targetOrPosition instanceof CommonBaseEntity) {
126
+ TaskLookAtEntity(this.ped.Handle, targetOrPosition.Handle, duration, 2048, 31, 0);
127
+ } else {
128
+ TaskLookAtCoord(this.ped.Handle, targetOrPosition.x, targetOrPosition.y, targetOrPosition.z, duration, 0, 51, 0);
129
+ }
130
+ }
131
+ async playAnimation(animDict, animName, blendInSpeed, blendOutSpeed, duration, playbackRate, animFlags, ikFlags) {
132
+ await LoadAnimDict(animDict);
133
+ if (GlobalData.GameName === "redm") {
134
+ TaskPlayAnim(
135
+ this.ped.Handle,
136
+ animDict,
137
+ animName,
138
+ blendInSpeed,
139
+ blendOutSpeed,
140
+ duration,
141
+ animFlags,
142
+ playbackRate,
143
+ false,
144
+ ikFlags,
145
+ false,
146
+ 0,
147
+ false
148
+ );
149
+ } else {
150
+ TaskPlayAnim(
151
+ this.ped.Handle,
152
+ animDict,
153
+ animName,
154
+ blendInSpeed,
155
+ blendOutSpeed,
156
+ duration,
157
+ animFlags,
158
+ playbackRate,
159
+ false,
160
+ false,
161
+ false
162
+ );
163
+ }
164
+ RemoveAnimDict(animDict);
165
+ }
166
+ reloadWeapon() {
167
+ TaskReloadWeapon(this.ped.Handle, true);
168
+ }
169
+ shootAt(targetOrPosition, duration = -1, pattern = 0, affectCockedState = false) {
170
+ if (targetOrPosition instanceof IHandle) {
171
+ TaskShootAtEntity(this.ped.Handle, targetOrPosition.Handle, duration, pattern, affectCockedState);
172
+ } else {
173
+ TaskShootAtCoord(
174
+ this.ped.Handle,
175
+ targetOrPosition.x,
176
+ targetOrPosition.y,
177
+ targetOrPosition.z,
178
+ duration,
179
+ pattern,
180
+ 0
181
+ );
182
+ }
183
+ }
184
+ shuffleToNextVehicleSeat(vehicle) {
185
+ TaskShuffleToNextVehicleSeat(this.ped.Handle, vehicle.Handle);
186
+ }
187
+ slideTo(position, heading, duration = 0.7) {
188
+ TaskPedSlideToCoord(this.ped.Handle, position.x, position.y, position.z, heading, duration);
189
+ }
190
+ standStill(duration) {
191
+ TaskStandStill(this.ped.Handle, duration);
192
+ }
193
+ vehicleShootAtPed(target) {
194
+ TaskVehicleShootAtPed(this.ped.Handle, target.Handle, 20);
195
+ }
196
+ wait(duration) {
197
+ TaskPause(this.ped.Handle, duration);
198
+ }
199
+ wanderAround(position, radius) {
200
+ if (position && radius) {
201
+ TaskWanderInArea(this.ped.Handle, position.x, position.y, position.z, radius, 0, 0, 0);
202
+ } else {
203
+ TaskWanderStandard(this.ped.Handle, 0, 0);
204
+ }
205
+ }
206
+ warpIntoVehicle(vehicle, seat) {
207
+ TaskWarpPedIntoVehicle(this.ped.Handle, vehicle.Handle, seat);
208
+ }
209
+ warpOutOfVehicle(vehicle, flags) {
210
+ TaskLeaveVehicle(this.ped.Handle, vehicle.Handle, flags, 0);
211
+ }
212
+ isPlayingAnim(dict, anim, taskFlag = 3) {
213
+ return IsEntityPlayingAnim(this.ped.Handle, dict, anim, taskFlag);
214
+ }
215
+ clearAll() {
216
+ ClearPedTasks(this.ped.Handle, true, false);
217
+ }
218
+ clearAllImmediately() {
219
+ ClearPedTasksImmediately(this.ped.Handle, true, false);
220
+ }
221
+ clearLookAt() {
222
+ TaskClearLookAt(this.ped.Handle);
223
+ }
224
+ clearSecondary() {
225
+ ClearPedSecondaryTask(this.ped.Handle);
226
+ }
227
+ clearAnimation(animDict, animName) {
228
+ StopAnimTask(this.ped.Handle, animDict, animName, -4);
229
+ }
230
+ }
231
+ export {
232
+ CommonTasks
233
+ };
@@ -0,0 +1 @@
1
+ export type StateBagChangeHandler<T> = (bagName: string, key: string, value: T, reserved: number, replicated: boolean) => void;
File without changes
@@ -0,0 +1,6 @@
1
+ export type { StateBagChangeHandler } from "./StateBagChangeHandler";
2
+ declare const _default: {
3
+ Entity: typeof Entity;
4
+ Player: typeof Player;
5
+ };
6
+ export default _default;
@@ -0,0 +1,4 @@
1
+ var cfx_default = { Entity, Player };
2
+ export {
3
+ cfx_default as default
4
+ };
File without changes
File without changes