@nativewrappers/fivem 0.0.40 → 0.0.41

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.
@@ -1,6 +1,6 @@
1
1
  import { Tasks } from './Tasks';
2
2
  export declare class TaskSequence {
3
- private static nullPed;
3
+ private static nullTask;
4
4
  private handle;
5
5
  private isClosed;
6
6
  private count;
@@ -1,18 +1,19 @@
1
- import { Ped } from './models/Ped';
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.nullPed) {
8
- TaskSequence.nullPed = new Ped(0);
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
- this.handle = OpenSequenceTask(0);
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.nullPed.Task;
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
- this.ped = ped;
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, 0, 0);
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, 0, 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
- Loop = 1,
4
- StayInEndFrame = 2,
5
- UpperBodyOnly = 16,
6
- AllowRotation = 32,
7
- CancelableWithMovement = 128,
8
- RagdollOnCollision = 4194304
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["Loop"] = 1] = "Loop";
5
- AnimationFlags[AnimationFlags["StayInEndFrame"] = 2] = "StayInEndFrame";
6
- AnimationFlags[AnimationFlags["UpperBodyOnly"] = 16] = "UpperBodyOnly";
7
- AnimationFlags[AnimationFlags["AllowRotation"] = 32] = "AllowRotation";
8
- AnimationFlags[AnimationFlags["CancelableWithMovement"] = 128] = "CancelableWithMovement";
9
- AnimationFlags[AnimationFlags["RagdollOnCollision"] = 4194304] = "RagdollOnCollision";
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 = {}));
@@ -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() {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "author": "Remco Troost <d0p3t>",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
- "version": "0.0.40",
7
+ "version": "0.0.41",
8
8
  "publishConfig": {
9
9
  "directory": "lib"
10
10
  },