@nativewrappers/fivem 0.0.40 → 0.0.42
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/client/Model.d.ts +1 -1
- package/client/Model.js +2 -2
- package/client/TaskSequence.d.ts +1 -1
- package/client/TaskSequence.js +6 -5
- package/client/Tasks.d.ts +2 -2
- package/client/Tasks.js +9 -5
- package/client/enums/AnimationFlags.d.ts +31 -6
- package/client/enums/AnimationFlags.js +31 -6
- package/common/utils/Vector.d.ts +1 -1
- package/common/utils/Vector.js +8 -8
- package/package.json +1 -1
package/client/Model.d.ts
CHANGED
|
@@ -126,7 +126,7 @@ export declare class Model {
|
|
|
126
126
|
* This function will not automatically set the model as no longer needed when
|
|
127
127
|
* done.
|
|
128
128
|
*
|
|
129
|
-
* @param
|
|
129
|
+
* @param timeoutMs Maximum allowed time for model to load.
|
|
130
130
|
*/
|
|
131
131
|
request(timeoutMs?: number): Promise<boolean>;
|
|
132
132
|
/**
|
package/client/Model.js
CHANGED
|
@@ -173,7 +173,7 @@ export class Model {
|
|
|
173
173
|
* This function will not automatically set the model as no longer needed when
|
|
174
174
|
* done.
|
|
175
175
|
*
|
|
176
|
-
* @param
|
|
176
|
+
* @param timeoutMs Maximum allowed time for model to load.
|
|
177
177
|
*/
|
|
178
178
|
async request(timeoutMs = 1000) {
|
|
179
179
|
if (!this.IsInCdImage && !this.IsValid && !IsWeaponValid(this.hash)) {
|
|
@@ -185,7 +185,7 @@ export class Model {
|
|
|
185
185
|
}
|
|
186
186
|
RequestModel(this.hash);
|
|
187
187
|
const timeout = GetGameTimer() + timeoutMs;
|
|
188
|
-
while (!this.IsLoaded &&
|
|
188
|
+
while (!this.IsLoaded && GetGameTimer() < timeout) {
|
|
189
189
|
await Wait(0);
|
|
190
190
|
}
|
|
191
191
|
return this.IsLoaded;
|
package/client/TaskSequence.d.ts
CHANGED
package/client/TaskSequence.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Tasks } from './Tasks';
|
|
2
2
|
// TODO: Figure out why this uses 'null ped'
|
|
3
3
|
export class TaskSequence {
|
|
4
4
|
constructor(handle) {
|
|
5
5
|
this.handle = 0;
|
|
6
6
|
handle === undefined ? this.create() : (this.handle = handle);
|
|
7
|
-
if (!TaskSequence.
|
|
8
|
-
TaskSequence.
|
|
7
|
+
if (!TaskSequence.nullTask) {
|
|
8
|
+
TaskSequence.nullTask = new Tasks(null);
|
|
9
9
|
}
|
|
10
10
|
this.isClosed = false;
|
|
11
11
|
this.count = 0;
|
|
12
12
|
}
|
|
13
13
|
create() {
|
|
14
14
|
// Docs generate this as 'void' even though it returns a number
|
|
15
|
-
|
|
15
|
+
// @ts-ignore ignore the fact that OpenSequenceTask expects a paramater
|
|
16
|
+
this.handle = OpenSequenceTask();
|
|
16
17
|
}
|
|
17
18
|
dispose() {
|
|
18
19
|
ClearSequenceTask(this.handle);
|
|
@@ -33,7 +34,7 @@ export class TaskSequence {
|
|
|
33
34
|
throw new Error("You can't add tasks to a closed sequence!");
|
|
34
35
|
}
|
|
35
36
|
this.count += 1;
|
|
36
|
-
return TaskSequence.
|
|
37
|
+
return TaskSequence.nullTask;
|
|
37
38
|
}
|
|
38
39
|
get IsClosed() {
|
|
39
40
|
return this.isClosed;
|
package/client/Tasks.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { TaskSequence } from './TaskSequence';
|
|
|
5
5
|
import { Vector3 } from './utils';
|
|
6
6
|
export declare class Tasks {
|
|
7
7
|
private ped;
|
|
8
|
-
constructor(ped: Ped);
|
|
8
|
+
constructor(ped: Ped | null);
|
|
9
9
|
achieveHeading(heading: number, timeout?: number): void;
|
|
10
10
|
blockTemporaryEvents(block?: boolean): void;
|
|
11
11
|
aimAt(target: BaseEntity | Vector3, duration: number): void;
|
|
@@ -27,7 +27,7 @@ export declare class Tasks {
|
|
|
27
27
|
fleeFrom(pedOrPosition: Ped | Vector3, duration?: number): void;
|
|
28
28
|
followPointRoute(points: Vector3[]): void;
|
|
29
29
|
followToOffsetFromEntity(target: BaseEntity, offset: Vector3, timeout: number, stoppingRange: number, movementSpeed?: number, persistFollowing?: boolean): void;
|
|
30
|
-
goTo(position: Vector3, ignorePaths?: boolean, timeout?: number, speed?: number): void;
|
|
30
|
+
goTo(position: Vector3, ignorePaths?: boolean, timeout?: number, speed?: number, targetHeading?: number, distanceToSlide?: number, flags?: number): void;
|
|
31
31
|
goToEntity(target: BaseEntity, offset?: Vector3 | null, timeout?: number): void;
|
|
32
32
|
guardCurrentPosition(): void;
|
|
33
33
|
handsUp(duration: number): void;
|
package/client/Tasks.js
CHANGED
|
@@ -4,8 +4,12 @@ import { BaseEntity } from './models/BaseEntity';
|
|
|
4
4
|
import { Vector3 } from './utils';
|
|
5
5
|
import { LoadAnimDict } from './utils/Animations';
|
|
6
6
|
export class Tasks {
|
|
7
|
+
// we take null because sequences have a null ped, if you pass null to this
|
|
8
|
+
// you betterk now what you're doing.
|
|
7
9
|
constructor(ped) {
|
|
8
|
-
|
|
10
|
+
const actualPed = ped ?? { handle: null };
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
this.ped = actualPed;
|
|
9
13
|
}
|
|
10
14
|
achieveHeading(heading, timeout = 0) {
|
|
11
15
|
TaskAchieveHeading(this.ped.Handle, heading, timeout);
|
|
@@ -90,12 +94,12 @@ export class Tasks {
|
|
|
90
94
|
followToOffsetFromEntity(target, offset, timeout, stoppingRange, movementSpeed = 1, persistFollowing = true) {
|
|
91
95
|
TaskFollowToOffsetOfEntity(this.ped.Handle, target.Handle, offset.x, offset.y, offset.z, movementSpeed, timeout, stoppingRange, persistFollowing);
|
|
92
96
|
}
|
|
93
|
-
goTo(position, ignorePaths = false, timeout = -1, speed = 1) {
|
|
97
|
+
goTo(position, ignorePaths = false, timeout = -1, speed = 1, targetHeading = 0, distanceToSlide = 0, flags = 0) {
|
|
94
98
|
if (ignorePaths) {
|
|
95
|
-
TaskGoStraightToCoord(this.ped.Handle, position.x, position.y, position.z, speed, timeout,
|
|
99
|
+
TaskGoStraightToCoord(this.ped.Handle, position.x, position.y, position.z, speed, timeout, targetHeading, distanceToSlide);
|
|
96
100
|
}
|
|
97
101
|
else {
|
|
98
|
-
TaskFollowNavMeshToCoord(this.ped.Handle, position.x, position.y, position.z, speed, timeout, 0,
|
|
102
|
+
TaskFollowNavMeshToCoord(this.ped.Handle, position.x, position.y, position.z, speed, timeout, 0, flags, targetHeading);
|
|
99
103
|
}
|
|
100
104
|
}
|
|
101
105
|
goToEntity(target, offset = null, timeout = -1) {
|
|
@@ -138,7 +142,7 @@ export class Tasks {
|
|
|
138
142
|
sequence.close();
|
|
139
143
|
}
|
|
140
144
|
this.clearAll();
|
|
141
|
-
this.ped.BlockPermanentEvents = true;
|
|
145
|
+
// this.ped.BlockPermanentEvents = true;
|
|
142
146
|
TaskPerformSequence(this.ped.Handle, sequence.Handle);
|
|
143
147
|
}
|
|
144
148
|
async playAnimation(animDict, animName, blendInSpeed, blendOutSpeed, duration, playbackRate, flags) {
|
|
@@ -1,9 +1,34 @@
|
|
|
1
1
|
export declare enum AnimationFlags {
|
|
2
2
|
None = 0,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
Looping = 1,
|
|
4
|
+
HoldLastFrame = 2,
|
|
5
|
+
RepositionWhenFinished = 4,
|
|
6
|
+
NotInterruptible = 8,
|
|
7
|
+
UpperBody = 16,
|
|
8
|
+
Secondary = 32,
|
|
9
|
+
ReorientWhenFinished = 64,
|
|
10
|
+
AbortOnPedMovement = 128,
|
|
11
|
+
Additive = 256,
|
|
12
|
+
TurnOffCollision = 512,
|
|
13
|
+
OverridePhysics = 1024,
|
|
14
|
+
IgnorePhysics = 2048,
|
|
15
|
+
ExtractInitialOffset = 4096,
|
|
16
|
+
ExitAfterInterrupted = 8192,
|
|
17
|
+
TagSyncIn = 16384,
|
|
18
|
+
TagSyncOut = 32768,
|
|
19
|
+
TagSyncContinous = 65536,
|
|
20
|
+
ForceStart = 131072,
|
|
21
|
+
UseKinematicPhysics = 262144,
|
|
22
|
+
UseMoverExtrations = 524288,
|
|
23
|
+
HideWeapon = 1048576,
|
|
24
|
+
EndsInDeadPose = 2097152,
|
|
25
|
+
ActivateRagdoolOnCollision = 4194304,
|
|
26
|
+
DontExitOnDeath = 8388608,
|
|
27
|
+
AbortOnWeaponDamage = 16777216,
|
|
28
|
+
DisableForcedPhysicsUpdate = 33554432,
|
|
29
|
+
ProcessAttachmentsOnStart = 67108864,
|
|
30
|
+
ExpandPedCapsuleFromSkeleton = 134217728,
|
|
31
|
+
UseAlternativeFpAnim = 268435456,
|
|
32
|
+
BlendOutWrtLastFrame = 536870912,
|
|
33
|
+
UseFullBlending = 1073741824
|
|
9
34
|
}
|
|
@@ -1,10 +1,35 @@
|
|
|
1
1
|
export var AnimationFlags;
|
|
2
2
|
(function (AnimationFlags) {
|
|
3
3
|
AnimationFlags[AnimationFlags["None"] = 0] = "None";
|
|
4
|
-
AnimationFlags[AnimationFlags["
|
|
5
|
-
AnimationFlags[AnimationFlags["
|
|
6
|
-
AnimationFlags[AnimationFlags["
|
|
7
|
-
AnimationFlags[AnimationFlags["
|
|
8
|
-
AnimationFlags[AnimationFlags["
|
|
9
|
-
AnimationFlags[AnimationFlags["
|
|
4
|
+
AnimationFlags[AnimationFlags["Looping"] = 1] = "Looping";
|
|
5
|
+
AnimationFlags[AnimationFlags["HoldLastFrame"] = 2] = "HoldLastFrame";
|
|
6
|
+
AnimationFlags[AnimationFlags["RepositionWhenFinished"] = 4] = "RepositionWhenFinished";
|
|
7
|
+
AnimationFlags[AnimationFlags["NotInterruptible"] = 8] = "NotInterruptible";
|
|
8
|
+
AnimationFlags[AnimationFlags["UpperBody"] = 16] = "UpperBody";
|
|
9
|
+
AnimationFlags[AnimationFlags["Secondary"] = 32] = "Secondary";
|
|
10
|
+
AnimationFlags[AnimationFlags["ReorientWhenFinished"] = 64] = "ReorientWhenFinished";
|
|
11
|
+
AnimationFlags[AnimationFlags["AbortOnPedMovement"] = 128] = "AbortOnPedMovement";
|
|
12
|
+
AnimationFlags[AnimationFlags["Additive"] = 256] = "Additive";
|
|
13
|
+
AnimationFlags[AnimationFlags["TurnOffCollision"] = 512] = "TurnOffCollision";
|
|
14
|
+
AnimationFlags[AnimationFlags["OverridePhysics"] = 1024] = "OverridePhysics";
|
|
15
|
+
AnimationFlags[AnimationFlags["IgnorePhysics"] = 2048] = "IgnorePhysics";
|
|
16
|
+
AnimationFlags[AnimationFlags["ExtractInitialOffset"] = 4096] = "ExtractInitialOffset";
|
|
17
|
+
AnimationFlags[AnimationFlags["ExitAfterInterrupted"] = 8192] = "ExitAfterInterrupted";
|
|
18
|
+
AnimationFlags[AnimationFlags["TagSyncIn"] = 16384] = "TagSyncIn";
|
|
19
|
+
AnimationFlags[AnimationFlags["TagSyncOut"] = 32768] = "TagSyncOut";
|
|
20
|
+
AnimationFlags[AnimationFlags["TagSyncContinous"] = 65536] = "TagSyncContinous";
|
|
21
|
+
AnimationFlags[AnimationFlags["ForceStart"] = 131072] = "ForceStart";
|
|
22
|
+
AnimationFlags[AnimationFlags["UseKinematicPhysics"] = 262144] = "UseKinematicPhysics";
|
|
23
|
+
AnimationFlags[AnimationFlags["UseMoverExtrations"] = 524288] = "UseMoverExtrations";
|
|
24
|
+
AnimationFlags[AnimationFlags["HideWeapon"] = 1048576] = "HideWeapon";
|
|
25
|
+
AnimationFlags[AnimationFlags["EndsInDeadPose"] = 2097152] = "EndsInDeadPose";
|
|
26
|
+
AnimationFlags[AnimationFlags["ActivateRagdoolOnCollision"] = 4194304] = "ActivateRagdoolOnCollision";
|
|
27
|
+
AnimationFlags[AnimationFlags["DontExitOnDeath"] = 8388608] = "DontExitOnDeath";
|
|
28
|
+
AnimationFlags[AnimationFlags["AbortOnWeaponDamage"] = 16777216] = "AbortOnWeaponDamage";
|
|
29
|
+
AnimationFlags[AnimationFlags["DisableForcedPhysicsUpdate"] = 33554432] = "DisableForcedPhysicsUpdate";
|
|
30
|
+
AnimationFlags[AnimationFlags["ProcessAttachmentsOnStart"] = 67108864] = "ProcessAttachmentsOnStart";
|
|
31
|
+
AnimationFlags[AnimationFlags["ExpandPedCapsuleFromSkeleton"] = 134217728] = "ExpandPedCapsuleFromSkeleton";
|
|
32
|
+
AnimationFlags[AnimationFlags["UseAlternativeFpAnim"] = 268435456] = "UseAlternativeFpAnim";
|
|
33
|
+
AnimationFlags[AnimationFlags["BlendOutWrtLastFrame"] = 536870912] = "BlendOutWrtLastFrame";
|
|
34
|
+
AnimationFlags[AnimationFlags["UseFullBlending"] = 1073741824] = "UseFullBlending";
|
|
10
35
|
})(AnimationFlags || (AnimationFlags = {}));
|
package/common/utils/Vector.d.ts
CHANGED
package/common/utils/Vector.js
CHANGED
|
@@ -59,9 +59,9 @@ export class Vector {
|
|
|
59
59
|
const isNumber = typeof b === 'number';
|
|
60
60
|
x = operator(x, isNumber ? b : (b.x ?? 0));
|
|
61
61
|
y = operator(y, isNumber ? b : (b.y ?? 0));
|
|
62
|
-
if (z)
|
|
62
|
+
if (z !== undefined)
|
|
63
63
|
z = operator(z, isNumber ? b : (b.z ?? 0));
|
|
64
|
-
if (w)
|
|
64
|
+
if (w !== undefined)
|
|
65
65
|
w = operator(w, isNumber ? b : (b.w ?? 0));
|
|
66
66
|
return this.create(x, y, z, w);
|
|
67
67
|
}
|
|
@@ -157,9 +157,9 @@ export class Vector {
|
|
|
157
157
|
const isNumber = typeof b === 'number';
|
|
158
158
|
x = operator(Math.abs(x), isNumber ? b : Math.abs(b.x ?? 0));
|
|
159
159
|
y = operator(Math.abs(y), isNumber ? b : Math.abs(b.y ?? 0));
|
|
160
|
-
if (z)
|
|
160
|
+
if (z !== undefined)
|
|
161
161
|
z = operator(Math.abs(z), isNumber ? b : Math.abs(b.z ?? 0));
|
|
162
|
-
if (w)
|
|
162
|
+
if (w !== undefined)
|
|
163
163
|
w = operator(Math.abs(w), isNumber ? b : Math.abs(b.w ?? 0));
|
|
164
164
|
return this.create(x, y, z, w);
|
|
165
165
|
}
|
|
@@ -307,9 +307,9 @@ export class Vector {
|
|
|
307
307
|
*[Symbol.iterator]() {
|
|
308
308
|
yield this.x;
|
|
309
309
|
yield this.y;
|
|
310
|
-
if (this.z)
|
|
310
|
+
if (this.z !== undefined)
|
|
311
311
|
yield this.z;
|
|
312
|
-
if (this.w)
|
|
312
|
+
if (this.w !== undefined)
|
|
313
313
|
yield this.w;
|
|
314
314
|
}
|
|
315
315
|
toString() {
|
|
@@ -367,8 +367,8 @@ export class Vector {
|
|
|
367
367
|
/**
|
|
368
368
|
* @see Vector.addY
|
|
369
369
|
*/
|
|
370
|
-
addY(
|
|
371
|
-
return Vector.addY(this,
|
|
370
|
+
addY(y) {
|
|
371
|
+
return Vector.addY(this, y);
|
|
372
372
|
}
|
|
373
373
|
/**
|
|
374
374
|
* @see Vector.subtract
|