@nativewrappers/fivem 0.0.80 → 0.0.82

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 (265) hide show
  1. package/Audio.d.ts +2 -2
  2. package/Audio.js +99 -0
  3. package/Blip.d.ts +4 -3
  4. package/Blip.js +113 -0
  5. package/Camera.d.ts +3 -3
  6. package/Camera.js +190 -0
  7. package/Checkpoint.d.ts +2 -2
  8. package/Checkpoint.js +51 -0
  9. package/Events.js +80 -0
  10. package/Game.d.ts +10 -3
  11. package/Game.js +478 -0
  12. package/GameplayCamera.d.ts +2 -2
  13. package/GameplayCamera.js +152 -0
  14. package/Model.js +210 -0
  15. package/NetworkedScene.d.ts +2 -1
  16. package/NetworkedScene.js +50 -0
  17. package/ParticleEffect.d.ts +4 -3
  18. package/ParticleEffect.js +128 -0
  19. package/ParticleEffectAsset.d.ts +2 -2
  20. package/ParticleEffectAsset.js +133 -0
  21. package/Pickup.d.ts +1 -1
  22. package/Pickup.js +27 -0
  23. package/Raycast.d.ts +5 -3
  24. package/Raycast.js +132 -0
  25. package/RelationshipGroup.d.ts +1 -1
  26. package/RelationshipGroup.js +72 -0
  27. package/Rope.d.ts +1 -1
  28. package/Rope.js +149 -0
  29. package/TaskSequence.js +52 -0
  30. package/Tasks.d.ts +8 -3
  31. package/Tasks.js +334 -0
  32. package/World.d.ts +13 -4
  33. package/World.js +945 -0
  34. package/cfx/StateBagChangeHandler.js +0 -0
  35. package/cfx/index.d.ts +1 -1
  36. package/cfx/index.js +4 -0
  37. package/common/Command.js +111 -0
  38. package/common/Convar.js +58 -0
  39. package/common/GlobalData.js +16 -0
  40. package/common/Kvp.js +137 -0
  41. package/common/Resource.js +54 -0
  42. package/common/decors/Events.js +170 -0
  43. package/common/net/NetworkedMap.js +225 -0
  44. package/common/types.js +0 -0
  45. package/common/utils/ClassTypes.js +15 -0
  46. package/common/utils/Color.js +33 -0
  47. package/common/utils/Delay.d.ts +1 -0
  48. package/common/utils/Delay.js +6 -0
  49. package/common/utils/Maths.js +18 -0
  50. package/common/utils/Point.d.ts +9 -0
  51. package/common/utils/Point.js +36 -0
  52. package/common/utils/PointF.d.ts +1 -1
  53. package/common/utils/PointF.js +18 -0
  54. package/common/utils/Quaternion.d.ts +1 -1
  55. package/common/utils/Quaternion.js +33 -0
  56. package/common/utils/Vector.js +589 -0
  57. package/common/utils/cleanPlayerName.js +17 -0
  58. package/common/utils/enumValues.js +20 -0
  59. package/common/utils/getStringFromUInt8Array.js +6 -0
  60. package/common/utils/getUInt32FromUint8Array.js +6 -0
  61. package/enums/Alignment.js +9 -0
  62. package/enums/AnimationFlags.js +38 -0
  63. package/enums/AudioFlag.js +41 -0
  64. package/enums/BadgeStyle.js +186 -0
  65. package/enums/Blip.js +229 -0
  66. package/enums/Bone.js +105 -0
  67. package/enums/CameraShake.js +17 -0
  68. package/enums/CameraTypes.js +11 -0
  69. package/enums/CheckboxStyle.js +8 -0
  70. package/enums/Checkpoint.js +68 -0
  71. package/enums/CloudHat.js +27 -0
  72. package/enums/Control.js +364 -0
  73. package/enums/CursorSprite.js +18 -0
  74. package/enums/Driving.js +38 -0
  75. package/enums/ExplosionType.js +45 -0
  76. package/enums/FiringPattern.js +23 -0
  77. package/enums/Font.js +11 -0
  78. package/enums/ForceType.js +12 -0
  79. package/enums/Gender.js +8 -0
  80. package/enums/HelmetType.js +9 -0
  81. package/enums/HudColor.js +187 -0
  82. package/enums/HudComponent.js +57 -0
  83. package/enums/InputMode.js +8 -0
  84. package/enums/InvertAxis.js +10 -0
  85. package/enums/Language.js +18 -0
  86. package/enums/LeaveVehicleFlags.js +14 -0
  87. package/enums/LoadingSpinnerType.js +11 -0
  88. package/enums/MarkerType.js +48 -0
  89. package/enums/MenuAlignment.js +8 -0
  90. package/enums/NotificationType.js +14 -0
  91. package/enums/Parachute.js +19 -0
  92. package/enums/PickupType.js +77 -0
  93. package/enums/RadioStation.js +28 -0
  94. package/enums/RagdollType.js +10 -0
  95. package/enums/RaycastEnums.js +33 -0
  96. package/enums/Relationship.js +13 -0
  97. package/enums/RopeType.js +9 -0
  98. package/enums/ScreenEffect.js +87 -0
  99. package/enums/SpeechModifier.js +43 -0
  100. package/enums/Vehicle.js +396 -0
  101. package/enums/Weather.js +22 -0
  102. package/enums/ZoneID.js +95 -0
  103. package/hashes/MaterialHash.js +220 -0
  104. package/hashes/PedHash.js +728 -0
  105. package/hashes/VehicleHash.js +526 -0
  106. package/hashes/WeaponHash.js +155 -0
  107. package/hashes/WeatherTypeHash.js +22 -0
  108. package/index.js +166 -18794
  109. package/interfaces/Dimensions.d.ts +1 -1
  110. package/interfaces/Dimensions.js +0 -0
  111. package/models/BaseEntity.d.ts +10 -8
  112. package/models/BaseEntity.js +576 -0
  113. package/models/Entity.d.ts +0 -1
  114. package/models/Entity.js +0 -0
  115. package/models/EntityBone.d.ts +1 -1
  116. package/models/EntityBone.js +32 -0
  117. package/models/EntityBoneCollection.d.ts +1 -1
  118. package/models/EntityBoneCollection.js +27 -0
  119. package/models/Ped.d.ts +13 -5
  120. package/models/Ped.js +711 -0
  121. package/models/PedBone.d.ts +3 -2
  122. package/models/PedBone.js +18 -0
  123. package/models/PedBoneCollection.d.ts +3 -1
  124. package/models/PedBoneCollection.js +31 -0
  125. package/models/Player.d.ts +4 -2
  126. package/models/Player.js +188 -0
  127. package/models/Prop.d.ts +1 -1
  128. package/models/Prop.js +34 -0
  129. package/models/Vehicle.d.ts +9 -4
  130. package/models/Vehicle.js +582 -0
  131. package/models/VehicleDoor.d.ts +1 -1
  132. package/models/VehicleDoor.js +52 -0
  133. package/models/VehicleDoorCollection.d.ts +1 -1
  134. package/models/VehicleDoorCollection.js +66 -0
  135. package/models/VehicleMod.d.ts +1 -1
  136. package/models/VehicleMod.js +43 -0
  137. package/models/VehicleModCollection.d.ts +2 -2
  138. package/models/VehicleModCollection.js +227 -0
  139. package/models/VehicleToggleMod.d.ts +1 -1
  140. package/models/VehicleToggleMod.js +37 -0
  141. package/models/VehicleWheel.js +31 -0
  142. package/models/VehicleWheelCollection.d.ts +1 -1
  143. package/models/VehicleWheelCollection.js +61 -0
  144. package/models/VehicleWindow.d.ts +1 -1
  145. package/models/VehicleWindow.js +43 -0
  146. package/models/VehicleWindowCollection.d.ts +1 -1
  147. package/models/VehicleWindowCollection.js +62 -0
  148. package/package.json +2 -2
  149. package/ui/Container.d.ts +4 -2
  150. package/ui/Container.js +39 -0
  151. package/ui/Effects.d.ts +1 -1
  152. package/ui/Effects.js +112 -0
  153. package/ui/Fading.js +74 -0
  154. package/ui/Hud.d.ts +3 -2
  155. package/ui/Hud.js +47 -0
  156. package/ui/InstructionalButtons.js +42 -0
  157. package/ui/LoadingPrompt.d.ts +1 -1
  158. package/ui/LoadingPrompt.js +37 -0
  159. package/ui/Notification.js +17 -0
  160. package/ui/Rectangle.d.ts +4 -2
  161. package/ui/Rectangle.js +46 -0
  162. package/ui/Scaleform.d.ts +2 -1
  163. package/ui/Scaleform.js +240 -0
  164. package/ui/Screen.d.ts +6 -3
  165. package/ui/Screen.js +83 -0
  166. package/ui/Sprite.d.ts +3 -1
  167. package/ui/Sprite.js +70 -0
  168. package/ui/Text.d.ts +6 -3
  169. package/ui/Text.js +119 -0
  170. package/ui/Timerbar.js +241 -0
  171. package/ui/interfaces/IButton.d.ts +1 -1
  172. package/ui/interfaces/IButton.js +0 -0
  173. package/ui/interfaces/IDrawable.d.ts +3 -1
  174. package/ui/interfaces/IDrawable.js +0 -0
  175. package/ui/menu/Menu.d.ts +9 -4
  176. package/ui/menu/Menu.js +830 -0
  177. package/ui/menu/MenuControl.js +20 -0
  178. package/ui/menu/MenuControls.js +17 -0
  179. package/ui/menu/MenuSettings.d.ts +1 -1
  180. package/ui/menu/MenuSettings.js +57 -0
  181. package/ui/menu/items/UIMenuCheckboxItem.d.ts +3 -3
  182. package/ui/menu/items/UIMenuCheckboxItem.js +70 -0
  183. package/ui/menu/items/UIMenuItem.d.ts +10 -4
  184. package/ui/menu/items/UIMenuItem.js +1103 -0
  185. package/ui/menu/items/UIMenuListItem.d.ts +3 -3
  186. package/ui/menu/items/UIMenuListItem.js +118 -0
  187. package/ui/menu/items/UIMenuSeparatorItem.d.ts +1 -1
  188. package/ui/menu/items/UIMenuSeparatorItem.js +37 -0
  189. package/ui/menu/items/UIMenuSliderItem.d.ts +4 -3
  190. package/ui/menu/items/UIMenuSliderItem.js +180 -0
  191. package/ui/menu/items/panels/AbstractUIMenuPanel.d.ts +4 -3
  192. package/ui/menu/items/panels/AbstractUIMenuPanel.js +49 -0
  193. package/ui/menu/items/panels/UIMenuColorPanel.d.ts +3 -3
  194. package/ui/menu/items/panels/UIMenuColorPanel.js +215 -0
  195. package/ui/menu/items/panels/UIMenuGridPanel.d.ts +3 -3
  196. package/ui/menu/items/panels/UIMenuGridPanel.js +216 -0
  197. package/ui/menu/items/panels/UIMenuPercentagePanel.d.ts +2 -2
  198. package/ui/menu/items/panels/UIMenuPercentagePanel.js +138 -0
  199. package/ui/menu/items/panels/UIMenuStatisticsPanel.d.ts +3 -2
  200. package/ui/menu/items/panels/UIMenuStatisticsPanel.js +88 -0
  201. package/ui/menu/items/panels/UIMenuStatisticsPanelItem.d.ts +2 -1
  202. package/ui/menu/items/panels/UIMenuStatisticsPanelItem.js +48 -0
  203. package/ui/menu/modules/ListItem.js +18 -0
  204. package/utils/Animations.js +43 -0
  205. package/utils/Crypto.js +33 -0
  206. package/utils/LiteEvent.js +25 -0
  207. package/utils/Maths.js +18 -0
  208. package/utils/Point.js +36 -0
  209. package/utils/Size.js +16 -0
  210. package/utils/String.d.ts +1 -1
  211. package/utils/String.js +35 -0
  212. package/weapon/DlcWeaponData.d.ts +1 -1
  213. package/weapon/DlcWeaponData.js +40 -0
  214. package/weapon/Mk2WeaponHash.js +18 -0
  215. package/weapon/Weapon.d.ts +7 -7
  216. package/weapon/Weapon.js +276 -0
  217. package/weapon/WeaponAsset.d.ts +1 -1
  218. package/weapon/WeaponAsset.js +87 -0
  219. package/weapon/WeaponCollection.d.ts +3 -2
  220. package/weapon/WeaponCollection.js +179 -0
  221. package/weapon/WeaponDisplayNameByHash.d.ts +1 -1
  222. package/weapon/WeaponDisplayNameByHash.js +73 -0
  223. package/weapon/WeaponGroup.js +22 -0
  224. package/weapon/WeaponHudStats.d.ts +1 -1
  225. package/weapon/WeaponHudStats.js +33 -0
  226. package/weapon/WeaponLivery.js +17 -0
  227. package/weapon/WeaponLiveryColor.js +38 -0
  228. package/weapon/WeaponTint.js +46 -0
  229. package/weaponComponent/ComponentAttachmentPoint.js +22 -0
  230. package/weaponComponent/ComponentAttachmentPointByHash.js +307 -0
  231. package/weaponComponent/ComponentDisplayNameByHash.js +278 -0
  232. package/weaponComponent/DlcWeaponComponentData.js +40 -0
  233. package/weaponComponent/InvalidWeaponComponent.d.ts +1 -1
  234. package/weaponComponent/InvalidWeaponComponent.js +31 -0
  235. package/weaponComponent/WeaponComponent.d.ts +4 -4
  236. package/weaponComponent/WeaponComponent.js +124 -0
  237. package/weaponComponent/WeaponComponentCollection.d.ts +2 -2
  238. package/weaponComponent/WeaponComponentCollection.js +187 -0
  239. package/weaponComponent/WeaponComponentHash.js +670 -0
  240. package/weaponComponent/WeaponComponentHashesByWeaponHash.d.ts +1 -1
  241. package/weaponComponent/WeaponComponentHashesByWeaponHash.js +864 -0
  242. package/weaponComponent/WeaponComponentHudStats.js +33 -0
  243. package/common/index.d.ts +0 -8
  244. package/common/utils/Vector2.d.ts +0 -1
  245. package/common/utils/Vector3.d.ts +0 -1
  246. package/common/utils/Vector4.d.ts +0 -1
  247. package/common/utils/index.d.ts +0 -12
  248. package/enums/index.d.ts +0 -42
  249. package/hashes/index.d.ts +0 -5
  250. package/index.d.ts +0 -25
  251. package/models/index.d.ts +0 -18
  252. package/ui/index.d.ts +0 -15
  253. package/ui/interfaces/index.d.ts +0 -2
  254. package/ui/menu/index.d.ts +0 -6
  255. package/ui/menu/items/index.d.ts +0 -6
  256. package/ui/menu/items/panels/index.d.ts +0 -6
  257. package/ui/menu/modules/index.d.ts +0 -1
  258. package/utils/PointF.d.ts +0 -7
  259. package/utils/Quaternion.d.ts +0 -10
  260. package/utils/enumValues.d.ts +0 -12
  261. package/utils/getStringFromUInt8Array.d.ts +0 -8
  262. package/utils/getUInt32FromUint8Array.d.ts +0 -8
  263. package/utils/index.d.ts +0 -9
  264. package/weapon/index.d.ts +0 -8
  265. package/weaponComponent/index.d.ts +0 -5
package/Raycast.js ADDED
@@ -0,0 +1,132 @@
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 { ShapeTestStatus } from "./enums/RaycastEnums";
5
+ import { Game } from "./Game";
6
+ import { Delay } from "./common/utils/Delay";
7
+ class RaycastResult {
8
+ static {
9
+ __name(this, "RaycastResult");
10
+ }
11
+ /**
12
+ * Return the entity that was hit.
13
+ */
14
+ get HitEntity() {
15
+ return this.entityHandleArg;
16
+ }
17
+ /**
18
+ * Get the position of the entity that was hit.
19
+ */
20
+ get HitPosition() {
21
+ return this.hitPositionArg;
22
+ }
23
+ /**
24
+ * Return the vector perpendicular to the tangent plane.
25
+ */
26
+ get SurfaceNormal() {
27
+ return this.surfaceNormalArg;
28
+ }
29
+ /**
30
+ * Whether we hit anything.
31
+ */
32
+ get DidHit() {
33
+ return this.hitSomethingArg;
34
+ }
35
+ /**
36
+ * Whether the entity hit exists.
37
+ */
38
+ get DidHitEntity() {
39
+ return this.entityHandleArg !== null && this.entityHandleArg.Handle !== 0;
40
+ }
41
+ /**
42
+ * Material type that was hit.
43
+ */
44
+ get Material() {
45
+ return this.materialArg;
46
+ }
47
+ /**
48
+ * Raycast result's handle.
49
+ */
50
+ get Result() {
51
+ return this.result;
52
+ }
53
+ /**
54
+ * @returns if the shape test handle was already discarded
55
+ */
56
+ get WasDiscarded() {
57
+ return this.result === ShapeTestStatus.Discarded;
58
+ }
59
+ /**
60
+ * NOTE: These will not be updated unless polled by `resolve` or the shape
61
+ * test is synchronous
62
+ * @returns if the raycast has been marked as ready by the engine
63
+ */
64
+ get HasResolved() {
65
+ return this.result === ShapeTestStatus.Ready;
66
+ }
67
+ applyShapeTestResults() {
68
+ const [result, hit, endCoords, surfaceNormal, materialHash, entityHit] = GetShapeTestResultIncludingMaterial(
69
+ this.handle
70
+ );
71
+ this.result = result;
72
+ if (!this.HasResolved || this.WasDiscarded) return;
73
+ this.hitSomethingArg = hit;
74
+ this.hitPositionArg = Vector3.fromArray(endCoords);
75
+ this.surfaceNormalArg = Vector3.fromArray(surfaceNormal);
76
+ this.materialArg = materialHash;
77
+ if (entityHit !== 0) {
78
+ this.entityHandleArg = Game.entityFromHandle(entityHit);
79
+ }
80
+ }
81
+ handle;
82
+ hitPositionArg;
83
+ hitSomethingArg;
84
+ entityHandleArg;
85
+ surfaceNormalArg;
86
+ materialArg;
87
+ result;
88
+ /**
89
+ * Create a RaycastResult object that gets the results from a StartShapeTestRay()
90
+ *
91
+ * @param handle The handle returned from StartShapeTestRay()
92
+ */
93
+ constructor(handle) {
94
+ this.handle = handle;
95
+ this.hitPositionArg = new Vector3(0, 0, 0);
96
+ this.hitSomethingArg = false;
97
+ this.entityHandleArg = null;
98
+ this.surfaceNormalArg = new Vector3(0, 0, 0);
99
+ this.materialArg = 0;
100
+ this.result = ShapeTestStatus.NotReady;
101
+ }
102
+ }
103
+ class SynchronousRaycastResult extends RaycastResult {
104
+ static {
105
+ __name(this, "SynchronousRaycastResult");
106
+ }
107
+ constructor(handle) {
108
+ super(handle);
109
+ this.applyShapeTestResults();
110
+ }
111
+ }
112
+ class AsynchronousRaycastResult extends RaycastResult {
113
+ static {
114
+ __name(this, "AsynchronousRaycastResult");
115
+ }
116
+ /**
117
+ * waits until the shape test handle is valid and then sets the expected
118
+ * values on the RaycastResult
119
+ */
120
+ async resolve(timeoutInMs = 1e3) {
121
+ const timeout = GetGameTimer() + timeoutInMs;
122
+ while (!this.HasResolved && !this.WasDiscarded) {
123
+ this.applyShapeTestResults();
124
+ if (timeout < GetGameTimer()) break;
125
+ await Delay(0);
126
+ }
127
+ }
128
+ }
129
+ export {
130
+ AsynchronousRaycastResult,
131
+ SynchronousRaycastResult
132
+ };
@@ -1,4 +1,4 @@
1
- import type { Relationship } from "./enums";
1
+ import type { Relationship } from "./enums/Relationship";
2
2
  /**
3
3
  * Class to create and manage a relationship group. Useful to manage behavior between Peds.
4
4
  */
@@ -0,0 +1,72 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ class RelationshipGroup {
4
+ static {
5
+ __name(this, "RelationshipGroup");
6
+ }
7
+ /**
8
+ * The hash of the relationship group
9
+ */
10
+ hash;
11
+ /**
12
+ * Create a relationship group. Optionally pass a group hash.
13
+ *
14
+ * @param name Name of the relationship group.
15
+ */
16
+ constructor(name) {
17
+ const [, groupHash] = AddRelationshipGroup(name);
18
+ this.hash = groupHash;
19
+ }
20
+ /**
21
+ * Gets the hash of the relationship group.
22
+ *
23
+ * @returns The hash of this object.
24
+ */
25
+ get Hash() {
26
+ return this.hash;
27
+ }
28
+ /**
29
+ * Get the relationship between two relationship groups.
30
+ *
31
+ * @param targetGroup The other relationship group.
32
+ * @returns The relationship
33
+ */
34
+ getRelationshipBetweenGroups(targetGroup) {
35
+ return GetRelationshipBetweenGroups(this.Hash, targetGroup.Hash);
36
+ }
37
+ /**
38
+ * Set the relationship group between this relationship group and another one.
39
+ *
40
+ * @param targetGroup The other relationship group.
41
+ * @param relationship The desired relationship.
42
+ * @param biDirectionally If target group should have same relationship towards this.
43
+ */
44
+ setRelationshipBetweenGroups(targetGroup, relationship, biDirectionally = false) {
45
+ SetRelationshipBetweenGroups(Number(relationship), this.Hash, targetGroup.Hash);
46
+ if (biDirectionally) {
47
+ SetRelationshipBetweenGroups(Number(relationship), targetGroup.Hash, this.Hash);
48
+ }
49
+ }
50
+ /**
51
+ * Clear the relationship between this relationship group and another.
52
+ *
53
+ * @param targetGroup The other relationship group.
54
+ * @param relationship The desired relationship to clear.
55
+ * @param biDirectionally Whether the target group should also clear the relationship.
56
+ */
57
+ clearRelationshipBetweenGroups(targetGroup, relationship, biDirectionally = false) {
58
+ ClearRelationshipBetweenGroups(Number(relationship), this.Hash, targetGroup.Hash);
59
+ if (biDirectionally) {
60
+ ClearRelationshipBetweenGroups(Number(relationship), targetGroup.Hash, this.Hash);
61
+ }
62
+ }
63
+ /**
64
+ * Remove this relationship group from the game. This will not delete this object.
65
+ */
66
+ remove() {
67
+ RemoveRelationshipGroup(this.Hash);
68
+ }
69
+ }
70
+ export {
71
+ RelationshipGroup
72
+ };
package/Rope.d.ts CHANGED
@@ -1,5 +1,5 @@
1
+ import { Vector3 } from "./common/utils/Vector";
1
2
  import type { BaseEntity } from "./models/BaseEntity";
2
- import { Vector3 } from "./utils";
3
3
  /**
4
4
  * Class to manage invisible ropes between entities.
5
5
  */
package/Rope.js ADDED
@@ -0,0 +1,149 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { Vector3 } from "./common/utils/Vector";
4
+ class Rope {
5
+ static {
6
+ __name(this, "Rope");
7
+ }
8
+ /**
9
+ * Id of rope entity.
10
+ */
11
+ handle;
12
+ /**
13
+ * Create a rope object based on an existing rope in the world.
14
+ *
15
+ * @param handle entity Id of rope.
16
+ */
17
+ constructor(handle) {
18
+ this.handle = handle;
19
+ }
20
+ get Handle() {
21
+ return this.handle;
22
+ }
23
+ /**
24
+ * Get the length of the rope.
25
+ *
26
+ * @returns The rope length.
27
+ */
28
+ get Length() {
29
+ return GetRopeLength(this.handle);
30
+ }
31
+ /**
32
+ * Sets the length of the rope.
33
+ *
34
+ * @param length Desired new length of rope.
35
+ */
36
+ set Length(length) {
37
+ RopeForceLength(this.handle, length);
38
+ }
39
+ /**
40
+ * Get the number of vertices on the rope.
41
+ *
42
+ * @returns Returns the number of vertices.
43
+ */
44
+ get VertexCount() {
45
+ return GetRopeVertexCount(this.handle);
46
+ }
47
+ /**
48
+ * Resets the length of the rope to it's length upon object creation or a length of 1.
49
+ *
50
+ * @param reset Whether to reset the length to it's original length or 1.
51
+ */
52
+ resetLength(reset) {
53
+ RopeResetLength(this.handle, reset ? 1 : this.Length);
54
+ }
55
+ /**
56
+ * Activates world physics on the rope object.
57
+ */
58
+ activatePhysics() {
59
+ ActivatePhysics(this.handle);
60
+ }
61
+ /**
62
+ * Attach the rope to an entity.
63
+ *
64
+ * @param entity Entity to attach the rope to.
65
+ * @param position Location where the rope is to be attached.
66
+ */
67
+ attachEntity(entity, position) {
68
+ AttachRopeToEntity(this.handle, entity.Handle, position.x, position.y, position.z, false);
69
+ }
70
+ /**
71
+ * Attach the rope between two entities at given locations on the entities.
72
+ *
73
+ * @param entityOne The first entity to attach to.
74
+ * @param positionOne Where on the first entity to attach the rope to.
75
+ * @param entityTwo The second entity to attach to.
76
+ * @param positionTwo Where on the second entity to attach the rope to.
77
+ * @param length The desired length of the rope between the two entities.
78
+ */
79
+ attachEntities(entityOne, positionOne, entityTwo, positionTwo, length) {
80
+ AttachEntitiesToRope(
81
+ this.handle,
82
+ entityOne.Handle,
83
+ entityTwo.Handle,
84
+ positionOne.x,
85
+ positionOne.y,
86
+ positionOne.z,
87
+ positionTwo.x,
88
+ positionTwo.y,
89
+ positionTwo.z,
90
+ length,
91
+ false,
92
+ false,
93
+ "",
94
+ ""
95
+ );
96
+ }
97
+ /**
98
+ * Detach the rope from an entity.
99
+ *
100
+ * @param entity Entity to detach the rope from.
101
+ */
102
+ detachEntity(entity) {
103
+ DetachRopeFromEntity(this.handle, entity.Handle);
104
+ }
105
+ /**
106
+ * Pin a vertex of the rope to a certain location.
107
+ *
108
+ * @param vertex Vertex to pin.
109
+ * @param position Location to pin the vertex to.
110
+ */
111
+ pinVertex(vertex, position) {
112
+ PinRopeVertex(this.handle, vertex, position.x, position.y, position.z);
113
+ }
114
+ /**
115
+ * Unpin a specified vertex from it's current pinned location (if any).
116
+ *
117
+ * @param vertex Vertex to unpin.
118
+ */
119
+ unpinVertex(vertex) {
120
+ UnpinRopeVertex(this.handle, vertex);
121
+ }
122
+ /**
123
+ * Return the world location of a specified vertex on the rope.
124
+ *
125
+ * @param vertex Vertex to get location from.
126
+ * @returns The vector location of the vertex.
127
+ */
128
+ getVertexCoord(vertex) {
129
+ return Vector3.fromArray(GetRopeVertexCoord(this.handle, vertex));
130
+ }
131
+ /**
132
+ * Delete the rope from the world. This does not delete the rope object.
133
+ */
134
+ delete() {
135
+ DeleteRope(this.handle);
136
+ }
137
+ /**
138
+ * Check if the rope still exists in the world based on it's handle.
139
+ *
140
+ * @returns Whether the rope exists or not.
141
+ */
142
+ exists() {
143
+ const [exists] = DoesRopeExist(this.handle);
144
+ return exists;
145
+ }
146
+ }
147
+ export {
148
+ Rope
149
+ };
@@ -0,0 +1,52 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { Tasks } from "./Tasks";
4
+ class TaskSequence {
5
+ static {
6
+ __name(this, "TaskSequence");
7
+ }
8
+ static nullTask;
9
+ handle = 0;
10
+ isClosed;
11
+ count;
12
+ constructor(handle) {
13
+ handle === void 0 ? this.create() : this.handle = handle;
14
+ if (!TaskSequence.nullTask) {
15
+ TaskSequence.nullTask = new Tasks(null);
16
+ }
17
+ this.isClosed = false;
18
+ this.count = 0;
19
+ }
20
+ create() {
21
+ this.handle = OpenSequenceTask();
22
+ }
23
+ dispose() {
24
+ ClearSequenceTask(this.handle);
25
+ this.handle = 0;
26
+ }
27
+ close(repeat = false) {
28
+ if (this.isClosed) return;
29
+ SetSequenceToRepeat(this.handle, repeat);
30
+ CloseSequenceTask(this.handle);
31
+ this.isClosed = true;
32
+ }
33
+ get Handle() {
34
+ return this.handle;
35
+ }
36
+ get AddTask() {
37
+ if (this.isClosed) {
38
+ throw new Error("You can't add tasks to a closed sequence!");
39
+ }
40
+ this.count += 1;
41
+ return TaskSequence.nullTask;
42
+ }
43
+ get IsClosed() {
44
+ return this.isClosed;
45
+ }
46
+ get Count() {
47
+ return this.count;
48
+ }
49
+ }
50
+ export {
51
+ TaskSequence
52
+ };
package/Tasks.d.ts CHANGED
@@ -1,8 +1,13 @@
1
- import { type AnimationFlags, DrivingStyle, FiringPattern, type LeaveVehicleFlags, VehicleSeat } from "./enums";
2
- import { Ped, type Vehicle } from "./models";
1
+ import { Vector3 } from "./common/utils/Vector";
2
+ import type { AnimationFlags } from "./enums/AnimationFlags";
3
+ import { DrivingStyle } from "./enums/Driving";
4
+ import { FiringPattern } from "./enums/FiringPattern";
5
+ import { VehicleSeat } from "./enums/Vehicle";
6
+ import type { LeaveVehicleFlags } from "./enums/LeaveVehicleFlags";
3
7
  import { BaseEntity } from "./models/BaseEntity";
8
+ import { Ped } from "./models/Ped";
9
+ import type { Vehicle } from "./models/Vehicle";
4
10
  import type { TaskSequence } from "./TaskSequence";
5
- import { Vector3 } from "./utils";
6
11
  export declare class Tasks {
7
12
  private ped;
8
13
  constructor(ped: Ped | null);