@nativewrappers/fivem 0.0.87 → 0.0.89

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 (48) hide show
  1. package/Blip.d.ts +2 -2
  2. package/Blip.js +2 -2
  3. package/Camera.d.ts +1 -1
  4. package/Camera.js +6 -7
  5. package/GameConstants.d.ts +7 -0
  6. package/GameConstants.js +24 -0
  7. package/Model.js +3 -3
  8. package/Tasks.d.ts +4 -4
  9. package/Tasks.js +21 -14
  10. package/World.d.ts +5 -5
  11. package/World.js +9 -11
  12. package/common/Command.d.ts +25 -0
  13. package/common/Command.js +28 -2
  14. package/index.d.ts +5 -1
  15. package/index.js +5 -1
  16. package/models/BaseEntity.d.ts +12 -14
  17. package/models/BaseEntity.js +3 -24
  18. package/models/BaseEntityBone.d.ts +12 -0
  19. package/models/BaseEntityBone.js +32 -0
  20. package/models/BaseEntityBoneCollection.d.ts +9 -0
  21. package/models/BaseEntityBoneCollection.js +19 -0
  22. package/models/Entity.d.ts +4 -0
  23. package/models/EntityBone.d.ts +2 -9
  24. package/models/EntityBone.js +3 -21
  25. package/models/EntityBoneCollection.d.ts +2 -3
  26. package/models/EntityBoneCollection.js +3 -6
  27. package/models/Ped.d.ts +8 -6
  28. package/models/Ped.js +23 -16
  29. package/models/PedBone.d.ts +3 -3
  30. package/models/PedBone.js +3 -4
  31. package/models/PedBoneCollection.d.ts +2 -2
  32. package/models/PedBoneCollection.js +2 -2
  33. package/models/Player.d.ts +4 -4
  34. package/models/Player.js +4 -4
  35. package/models/Prop.d.ts +5 -0
  36. package/models/Prop.js +12 -0
  37. package/models/Vehicle.d.ts +12 -7
  38. package/models/Vehicle.js +21 -7
  39. package/models/index.d.ts +5 -0
  40. package/models/index.js +5 -0
  41. package/package.json +1 -1
  42. package/ui/menu/Menu.d.ts +1 -1
  43. package/ui/menu/Menu.js +11 -10
  44. package/utils/GetEntityFromEntityIds.d.ts +2 -0
  45. package/utils/GetEntityFromEntityIds.js +23 -0
  46. package/weapon/WeaponAsset.js +2 -1
  47. package/Events.d.ts +0 -11
  48. package/Events.js +0 -80
package/ui/menu/Menu.js CHANGED
@@ -1,15 +1,16 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
  import { Color } from "../../common/utils/Color";
4
+ import { Delay } from "../../common/utils/Delay";
4
5
  import { Audio } from "../../Audio";
6
+ import { Game } from "../../Game";
7
+ import { GameplayCamera } from "../../GameplayCamera";
5
8
  import { Alignment } from "../../enums/Alignment";
6
9
  import { Control } from "../../enums/Control";
7
10
  import { CursorSprite } from "../../enums/CursorSprite";
8
11
  import { Font } from "../../enums/Font";
9
12
  import { InputMode } from "../../enums/InputMode";
10
13
  import { MenuAlignment } from "../../enums/MenuAlignment";
11
- import { Game } from "../../Game";
12
- import { GameplayCamera } from "../../GameplayCamera";
13
14
  import { Crypto } from "../../utils/Crypto";
14
15
  import { LiteEvent } from "../../utils/LiteEvent";
15
16
  import { Point } from "../../utils/Point";
@@ -20,13 +21,13 @@ import { Rectangle } from "../Rectangle";
20
21
  import { Screen } from "../Screen";
21
22
  import { Sprite } from "../Sprite";
22
23
  import { Text } from "../Text";
24
+ import { MenuControls } from "./MenuControls";
25
+ import { MenuSettings } from "./MenuSettings";
23
26
  import { UIMenuCheckboxItem } from "./items/UIMenuCheckboxItem";
24
27
  import { UIMenuItem } from "./items/UIMenuItem";
25
28
  import { UIMenuListItem } from "./items/UIMenuListItem";
26
29
  import { UIMenuSeparatorItem } from "./items/UIMenuSeparatorItem";
27
30
  import { UIMenuSliderItem } from "./items/UIMenuSliderItem";
28
- import { MenuControls } from "./MenuControls";
29
- import { MenuSettings } from "./MenuSettings";
30
31
  class Menu {
31
32
  static {
32
33
  __name(this, "Menu");
@@ -573,7 +574,7 @@ class Menu {
573
574
  this.CurrentSelection = hoveredItemIndex;
574
575
  this.indexChange.emit(this.CurrentSelection);
575
576
  }
576
- await Wait(this._navigationDelay);
577
+ await Delay(this._navigationDelay);
577
578
  while (Game.isDisabledControlPressed(0, Control.Attack) && hoveredItem.IsMouseInBounds) {
578
579
  if (hoveredItem.selected) {
579
580
  if (hoveredItem.enabled) {
@@ -592,7 +593,7 @@ class Menu {
592
593
  this.CurrentSelection = hoveredItemIndex;
593
594
  this.indexChange.emit(this.CurrentSelection);
594
595
  }
595
- await Wait(125);
596
+ await Delay(125);
596
597
  }
597
598
  this._mousePressed = false;
598
599
  })();
@@ -606,10 +607,10 @@ class Menu {
606
607
  (async () => {
607
608
  this._mousePressed = true;
608
609
  this.goUp();
609
- await Wait(this._navigationDelay);
610
+ await Delay(this._navigationDelay);
610
611
  while (Game.isDisabledControlPressed(0, Control.Attack)) {
611
612
  this.goUp();
612
- await Wait(125);
613
+ await Delay(125);
613
614
  }
614
615
  this._mousePressed = false;
615
616
  })();
@@ -626,10 +627,10 @@ class Menu {
626
627
  (async () => {
627
628
  this._mousePressed = true;
628
629
  this.goDown();
629
- await Wait(this._navigationDelay);
630
+ await Delay(this._navigationDelay);
630
631
  while (Game.isDisabledControlPressed(0, Control.Attack)) {
631
632
  this.goDown();
632
- await Wait(125);
633
+ await Delay(125);
633
634
  }
634
635
  this._mousePressed = false;
635
636
  })();
@@ -0,0 +1,2 @@
1
+ import type { Entity } from "../models/Entity";
2
+ export declare function GetEntityClassFromId(entityId: number): Entity;
@@ -0,0 +1,23 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { Ped } from "../models/Ped";
4
+ import { Prop } from "../models/Prop";
5
+ import { Vehicle } from "../models/Vehicle";
6
+ function GetEntityClassFromId(entityId) {
7
+ switch (GetEntityType(entityId)) {
8
+ case 1: {
9
+ return Ped.fromHandle(entityId);
10
+ }
11
+ case 2: {
12
+ return Vehicle.fromHandle(entityId);
13
+ }
14
+ case 3: {
15
+ return Prop.fromHandle(entityId);
16
+ }
17
+ }
18
+ return null;
19
+ }
20
+ __name(GetEntityClassFromId, "GetEntityClassFromId");
21
+ export {
22
+ GetEntityClassFromId
23
+ };
@@ -1,5 +1,6 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { Delay } from "../common/utils/Delay";
3
4
  import { Game } from "../Game";
4
5
  import { Weapon } from "./Weapon";
5
6
  class WeaponAsset {
@@ -50,7 +51,7 @@ class WeaponAsset {
50
51
  this.request();
51
52
  const start = GetGameTimer();
52
53
  while (!this.IsLoaded) {
53
- await Wait(100);
54
+ await Delay(100);
54
55
  const now = GetGameTimer();
55
56
  if (now - start >= timeout) {
56
57
  return false;
package/Events.d.ts DELETED
@@ -1,11 +0,0 @@
1
- export type NetEvent = (...args: any[]) => void;
2
- export declare class Events {
3
- /**
4
- * An onNet wrapper that properly converts the type into the correct type
5
- */
6
- static onNet: (eventName: string, event: NetEvent) => void;
7
- /**
8
- * An on wrapper that properly converts the classes
9
- */
10
- static on: (eventName: string, event: NetEvent) => void;
11
- }
package/Events.js DELETED
@@ -1,80 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- import { Vector2, Vector3, Vector4 } from "./common/utils/Vector";
4
- import { ClassTypes } from "./common/utils/ClassTypes";
5
- import { BaseEntity } from "./models/BaseEntity";
6
- import { Ped } from "./models/Ped";
7
- import { Player } from "./models/Player";
8
- import { Prop } from "./models/Prop";
9
- import { Vehicle } from "./models/Vehicle";
10
- const getClassFromArguments = /* @__PURE__ */ __name((...args) => {
11
- const newArgs = [];
12
- for (const arg of args) {
13
- if (!arg.type) {
14
- newArgs.push(arg);
15
- continue;
16
- }
17
- switch (arg.type) {
18
- case ClassTypes.Vector2: {
19
- newArgs.push(Vector2.fromObject(arg));
20
- continue;
21
- }
22
- case ClassTypes.Vector3: {
23
- newArgs.push(Vector3.fromObject(arg));
24
- continue;
25
- }
26
- case ClassTypes.Vector4: {
27
- newArgs.push(Vector4.fromObject(arg));
28
- continue;
29
- }
30
- case ClassTypes.Ped: {
31
- newArgs.push(Ped.fromNetworkId(arg.handle));
32
- continue;
33
- }
34
- case ClassTypes.Player: {
35
- newArgs.push(Player.fromServerId(arg.source));
36
- continue;
37
- }
38
- case ClassTypes.Prop: {
39
- newArgs.push(Prop.fromNetworkId(arg.handle));
40
- continue;
41
- }
42
- case ClassTypes.Vehicle: {
43
- newArgs.push(Vehicle.fromNetworkId(arg.netId));
44
- continue;
45
- }
46
- case ClassTypes.Entity: {
47
- newArgs.push(BaseEntity.fromNetworkId(arg.netId));
48
- continue;
49
- }
50
- default: {
51
- newArgs.push(arg);
52
- }
53
- }
54
- }
55
- return newArgs;
56
- }, "getClassFromArguments");
57
- class Events {
58
- static {
59
- __name(this, "Events");
60
- }
61
- /**
62
- * An onNet wrapper that properly converts the type into the correct type
63
- */
64
- static onNet = /* @__PURE__ */ __name((eventName, event) => {
65
- onNet(eventName, (...args) => {
66
- event(...getClassFromArguments(...args));
67
- });
68
- }, "onNet");
69
- /**
70
- * An on wrapper that properly converts the classes
71
- */
72
- static on = /* @__PURE__ */ __name((eventName, event) => {
73
- on(eventName, (...args) => {
74
- event(...getClassFromArguments(...args));
75
- });
76
- }, "on");
77
- }
78
- export {
79
- Events
80
- };