@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
@@ -1,4 +1,4 @@
1
- import type { Vector3 } from "../utils";
1
+ import type { Vector3 } from "../common/utils/Vector";
2
2
  export interface Dimensions {
3
3
  min: Vector3;
4
4
  max: Vector3;
File without changes
@@ -1,12 +1,14 @@
1
- import { Blip } from "../Blip";
2
- import { ForceType } from "../enums";
3
- import type { MaterialHash, WeaponHash } from "../hashes";
4
- import { Model } from "../Model";
5
- import { Quaternion, Vector3 } from "../utils";
6
- import { EntityBoneCollection } from "./";
1
+ import { ClassTypes } from "../common/utils/ClassTypes";
2
+ import { Vector3 } from "../common/utils/Vector";
3
+ import { ForceType } from "fivem/enums/ForceType";
4
+ import type { MaterialHash } from "fivem/hashes/MaterialHash";
5
+ import type { WeaponHash } from "fivem/hashes/WeaponHash";
6
+ import { Model } from "fivem/Model";
7
7
  import type { EntityBone } from "./EntityBone";
8
- import { type StateBagChangeHandler } from "../cfx";
9
- import { ClassTypes } from "../../common/utils/ClassTypes";
8
+ import { Blip } from "../Blip";
9
+ import { EntityBoneCollection } from "./EntityBoneCollection";
10
+ import { type StateBagChangeHandler } from "fivem/cfx";
11
+ import { Quaternion } from "../common/utils/Quaternion";
10
12
  export declare class BaseEntity {
11
13
  static fromNetworkId(networkId: number): BaseEntity | null;
12
14
  static fromStateBagName(stateBagName: string): BaseEntity | null;
@@ -0,0 +1,576 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { ClassTypes } from "../common/utils/ClassTypes";
4
+ import { Vector3 } from "../common/utils/Vector";
5
+ import { ForceType } from "fivem/enums/ForceType";
6
+ import { Model } from "fivem/Model";
7
+ import { Blip } from "../Blip";
8
+ import { EntityBoneCollection } from "./EntityBoneCollection";
9
+ import cfx from "fivem/cfx";
10
+ import { Quaternion } from "../common/utils/Quaternion";
11
+ class BaseEntity {
12
+ static {
13
+ __name(this, "BaseEntity");
14
+ }
15
+ static fromNetworkId(networkId) {
16
+ return new BaseEntity(NetworkGetEntityFromNetworkId(networkId));
17
+ }
18
+ static fromStateBagName(stateBagName) {
19
+ const entity = GetEntityFromStateBagName(stateBagName);
20
+ if (entity === 0) return null;
21
+ return new BaseEntity(entity);
22
+ }
23
+ handle;
24
+ bones;
25
+ stateBagCookies = [];
26
+ netId = null;
27
+ type = ClassTypes.Entity;
28
+ constructor(handle) {
29
+ this.handle = handle;
30
+ if (this.IsNetworked) {
31
+ this.netId = this.NetworkId;
32
+ }
33
+ }
34
+ get Handle() {
35
+ return this.handle;
36
+ }
37
+ /**
38
+ * @returns if the entity is a networked entity or local entity
39
+ */
40
+ get IsNetworked() {
41
+ return NetworkGetEntityIsNetworked(this.handle);
42
+ }
43
+ set IsNetworked(networked) {
44
+ if (networked) {
45
+ NetworkRegisterEntityAsNetworked(this.handle);
46
+ } else {
47
+ NetworkUnregisterNetworkedEntity(this.handle);
48
+ }
49
+ }
50
+ get NetworkId() {
51
+ if (this.netId) {
52
+ return this.netId;
53
+ }
54
+ return NetworkGetNetworkIdFromEntity(this.handle);
55
+ }
56
+ get IsNetworkConcealed() {
57
+ return NetworkIsEntityConcealed(this.handle);
58
+ }
59
+ set IsNetworkConcealed(concealed) {
60
+ NetworkConcealEntity(this.handle, concealed);
61
+ }
62
+ get State() {
63
+ return cfx.Entity(this.handle).state;
64
+ }
65
+ AddStateBagChangeHandler(keyFilter, handler) {
66
+ const stateBagName = this.IsNetworked ? `entity:${this.NetworkId}` : `localEntity:${this.handle}`;
67
+ const cookie = AddStateBagChangeHandler(keyFilter, stateBagName, handler);
68
+ this.stateBagCookies.push(cookie);
69
+ return cookie;
70
+ }
71
+ /**
72
+ * A short hand function for AddStateBagChangeHandler, this gets automatically cleaned up on entity deletion.
73
+ * @param keyFilter the key to filter for or null
74
+ * @param handler the function to handle the change
75
+ * @returns a cookie to be used in RemoveStateBagChangeHandler
76
+ */
77
+ listenForStateChange(keyFilter, handler) {
78
+ return this.AddStateBagChangeHandler(keyFilter, handler);
79
+ }
80
+ removeStateListener(tgtCookie) {
81
+ this.stateBagCookies = this.stateBagCookies.filter((cookie) => {
82
+ const isCookie = cookie === tgtCookie;
83
+ if (isCookie) RemoveStateBagChangeHandler(cookie);
84
+ return isCookie;
85
+ });
86
+ }
87
+ get Owner() {
88
+ return NetworkGetEntityOwner(this.handle);
89
+ }
90
+ // public isPlayerOwner(player: Player): boolean {
91
+ // return this.Owner === player.Handle;
92
+ // }
93
+ get Speed() {
94
+ return GetEntitySpeed(this.handle);
95
+ }
96
+ getSpeedVector(isRelative = false) {
97
+ return Vector3.fromArray(GetEntitySpeedVector(this.handle, isRelative));
98
+ }
99
+ get ForwardVector() {
100
+ return Vector3.fromArray(GetEntityForwardVector(this.handle));
101
+ }
102
+ get Matrix() {
103
+ return Vector3.fromArrays(GetEntityMatrix(this.handle));
104
+ }
105
+ set Matrix(vectors) {
106
+ if (vectors.length !== 4) throw Error(`Expected 4 Vectors, got ${vectors.length}`);
107
+ const [forward, right, up, pos] = vectors;
108
+ SetEntityMatrix(
109
+ this.handle,
110
+ forward.x,
111
+ forward.y,
112
+ forward.z,
113
+ right.x,
114
+ right.y,
115
+ right.z,
116
+ up.x,
117
+ up.y,
118
+ up.z,
119
+ pos.x,
120
+ pos.y,
121
+ pos.z
122
+ );
123
+ }
124
+ get Health() {
125
+ return GetEntityHealth(this.handle);
126
+ }
127
+ set Health(amount) {
128
+ SetEntityHealth(this.handle, amount);
129
+ }
130
+ get MaxHealth() {
131
+ return GetEntityMaxHealth(this.handle);
132
+ }
133
+ set MaxHealth(amount) {
134
+ SetEntityMaxHealth(this.handle, amount);
135
+ }
136
+ set IsDead(value) {
137
+ if (value) {
138
+ SetEntityHealth(this.handle, 0);
139
+ } else {
140
+ SetEntityHealth(this.handle, 200);
141
+ }
142
+ }
143
+ get IsDead() {
144
+ return IsEntityDead(this.handle);
145
+ }
146
+ get IsAlive() {
147
+ return !IsEntityDead(this.handle);
148
+ }
149
+ /**
150
+ * @deprecated use [[IsDead]] instead
151
+ */
152
+ isDead() {
153
+ return IsEntityDead(this.handle);
154
+ }
155
+ /**
156
+ * @deprecated use [[IsAlive]] instead
157
+ */
158
+ isAlive() {
159
+ return !this.isDead();
160
+ }
161
+ get Model() {
162
+ return new Model(GetEntityModel(this.handle));
163
+ }
164
+ /**
165
+ * Returns if the entity is set as a mission entity and will not be cleaned up by the engine
166
+ */
167
+ get IsMissionEntity() {
168
+ return IsEntityAMissionEntity(this.handle);
169
+ }
170
+ /**
171
+ * Sets if the entity is a mission entity and will not be cleaned up by the engine
172
+ */
173
+ set IsMissionEntity(value) {
174
+ if (value) {
175
+ SetEntityAsMissionEntity(this.handle, false, false);
176
+ } else {
177
+ SetEntityAsNoLongerNeeded(this.handle);
178
+ }
179
+ }
180
+ get Position() {
181
+ return Vector3.fromArray(GetEntityCoords(this.handle, false));
182
+ }
183
+ set Position(position) {
184
+ SetEntityCoords(this.handle, position.x, position.y, position.z, false, false, false, true);
185
+ }
186
+ set PositionNoOffset(position) {
187
+ SetEntityCoordsNoOffset(this.handle, position.x, position.y, position.z, true, true, true);
188
+ }
189
+ get Rotation() {
190
+ return Vector3.fromArray(GetEntityRotation(this.handle, 2));
191
+ }
192
+ set Rotation(rotation) {
193
+ SetEntityRotation(this.handle, rotation.x, rotation.y, rotation.z, 2, true);
194
+ }
195
+ get Quaternion() {
196
+ const quaternion = GetEntityQuaternion(this.handle);
197
+ return new Quaternion(quaternion[0], quaternion[1], quaternion[2], quaternion[3]);
198
+ }
199
+ set Quaternion(quaternion) {
200
+ SetEntityQuaternion(this.handle, quaternion.x, quaternion.y, quaternion.z, quaternion.w);
201
+ }
202
+ get Heading() {
203
+ return GetEntityHeading(this.handle);
204
+ }
205
+ set Heading(heading) {
206
+ SetEntityHeading(this.handle, heading);
207
+ }
208
+ get IsPositionFrozen() {
209
+ return IsEntityPositionFrozen(this.handle);
210
+ }
211
+ set IsPositionFrozen(value) {
212
+ FreezeEntityPosition(this.handle, value);
213
+ }
214
+ get Velocity() {
215
+ return Vector3.fromArray(GetEntityVelocity(this.handle));
216
+ }
217
+ set Velocity(velocity) {
218
+ SetEntityVelocity(this.handle, velocity.x, velocity.y, velocity.z);
219
+ }
220
+ get RotationVelocity() {
221
+ return Vector3.fromArray(GetEntityRotationVelocity(this.handle));
222
+ }
223
+ set MaxSpeed(value) {
224
+ SetEntityMaxSpeed(this.handle, value);
225
+ }
226
+ set HasGravity(value) {
227
+ SetEntityHasGravity(this.handle, value);
228
+ }
229
+ get HeightAboveGround() {
230
+ return GetEntityHeightAboveGround(this.handle);
231
+ }
232
+ get SubmersionLevel() {
233
+ return GetEntitySubmergedLevel(this.handle);
234
+ }
235
+ get LodDistance() {
236
+ return GetEntityLodDist(this.handle);
237
+ }
238
+ set LodDistance(value) {
239
+ SetEntityLodDist(this.handle, value);
240
+ }
241
+ get IsVisible() {
242
+ return IsEntityVisible(this.handle);
243
+ }
244
+ set IsVisible(value) {
245
+ SetEntityVisible(this.handle, value, false);
246
+ }
247
+ get IsOccluded() {
248
+ return IsEntityOccluded(this.handle);
249
+ }
250
+ get IsOnScreen() {
251
+ return IsEntityOnScreen(this.handle);
252
+ }
253
+ get IsUpright() {
254
+ return IsEntityUpright(this.handle, 0);
255
+ }
256
+ get IsUpsideDown() {
257
+ return IsEntityUpsidedown(this.handle);
258
+ }
259
+ get IsInAir() {
260
+ return IsEntityInAir(this.handle);
261
+ }
262
+ get IsInWater() {
263
+ return IsEntityInWater(this.handle);
264
+ }
265
+ /**
266
+ * @deprecated use [[IsMissionEntity]] instead as its more obvious as what it does
267
+ */
268
+ get IsPersistent() {
269
+ return IsEntityAMissionEntity(this.handle);
270
+ }
271
+ /**
272
+ * @deprecated use [[IsMissionEntity]] instead as its more obvious as what it does
273
+ */
274
+ set IsPersistent(value) {
275
+ if (value) {
276
+ SetEntityAsMissionEntity(this.handle, true, false);
277
+ } else {
278
+ SetEntityAsNoLongerNeeded(this.handle);
279
+ }
280
+ }
281
+ get IsOnFire() {
282
+ return IsEntityOnFire(this.handle);
283
+ }
284
+ set IsInvincible(value) {
285
+ SetEntityInvincible(this.handle, value);
286
+ }
287
+ set IsOnlyDamagedByPlayer(value) {
288
+ SetEntityOnlyDamagedByPlayer(this.handle, value);
289
+ }
290
+ get Opacity() {
291
+ return GetEntityAlpha(this.handle);
292
+ }
293
+ /**
294
+ * Sets how transparent an entity is, if you want to reset the alpha level use [[resetOpacity]] instead;
295
+ */
296
+ set Opacity(value) {
297
+ SetEntityAlpha(this.handle, value, false);
298
+ }
299
+ resetOpacity() {
300
+ ResetEntityAlpha(this.handle);
301
+ }
302
+ get HasCollided() {
303
+ return HasEntityCollidedWithAnything(this.handle);
304
+ }
305
+ get MaterialCollidingWith() {
306
+ return GetLastMaterialHitByEntity(this.handle);
307
+ }
308
+ get IsCollisionEnabled() {
309
+ return !GetEntityCollisonDisabled(this.handle);
310
+ }
311
+ set IsCollisionEnabled(value) {
312
+ SetEntityCollision(this.handle, value, false);
313
+ }
314
+ set IsRecordingCollisions(value) {
315
+ SetEntityRecordsCollisions(this.handle, value);
316
+ }
317
+ get Bones() {
318
+ if (!this.bones) {
319
+ this.bones = new EntityBoneCollection(this);
320
+ }
321
+ return this.bones;
322
+ }
323
+ get AttachedBlip() {
324
+ const handle = GetBlipFromEntity(this.handle);
325
+ if (DoesBlipExist(handle)) {
326
+ return new Blip(handle);
327
+ }
328
+ return null;
329
+ }
330
+ attachBlip() {
331
+ return new Blip(AddBlipForEntity(this.handle));
332
+ }
333
+ setNoCollision(entity, toggle) {
334
+ SetEntityNoCollisionEntity(this.handle, entity.Handle, toggle);
335
+ }
336
+ hasClearLosToEntity(entity, traceType = 17) {
337
+ return HasEntityClearLosToEntity(this.handle, entity.Handle, traceType);
338
+ }
339
+ hasClearLosToEntityInFront(entity) {
340
+ return HasEntityClearLosToEntityInFront(this.handle, entity.Handle);
341
+ }
342
+ hasBeenDamagedBy(entity) {
343
+ return HasEntityBeenDamagedByEntity(this.handle, entity.Handle, true);
344
+ }
345
+ hasBeenDamagedByWeapon(weapon) {
346
+ return HasEntityBeenDamagedByWeapon(this.handle, Number(weapon), 0);
347
+ }
348
+ hasBeenDamagedByAnyWeapon() {
349
+ return HasEntityBeenDamagedByWeapon(this.handle, 0, 2);
350
+ }
351
+ hasBeenDamagedByAnyMeleeWeapon() {
352
+ return HasEntityBeenDamagedByWeapon(this.handle, 0, 1);
353
+ }
354
+ clearLastWeaponDamage() {
355
+ ClearEntityLastWeaponDamage(this.handle);
356
+ }
357
+ isInArea(minBounds, maxBounds) {
358
+ return IsEntityInArea(
359
+ this.handle,
360
+ minBounds.x,
361
+ minBounds.y,
362
+ minBounds.z,
363
+ maxBounds.x,
364
+ maxBounds.y,
365
+ maxBounds.z,
366
+ false,
367
+ false,
368
+ 0
369
+ );
370
+ }
371
+ isInAngledArea(origin, edge, angle) {
372
+ return IsEntityInAngledArea(
373
+ this.handle,
374
+ origin.x,
375
+ origin.y,
376
+ origin.z,
377
+ edge.x,
378
+ edge.y,
379
+ edge.z,
380
+ angle,
381
+ false,
382
+ true,
383
+ 0
384
+ );
385
+ }
386
+ isInRangeOf(position, range) {
387
+ const v = Vector3.subtract(this.Position, position);
388
+ return v.dotProduct(v) < range * range;
389
+ }
390
+ isNearEntity(entity, bounds) {
391
+ return IsEntityAtEntity(this.handle, entity.Handle, bounds.x, bounds.y, bounds.z, false, true, 0);
392
+ }
393
+ isTouching(entity) {
394
+ return IsEntityTouchingEntity(this.handle, entity.Handle);
395
+ }
396
+ isTouchingModel(model) {
397
+ return IsEntityTouchingModel(this.handle, model.Hash);
398
+ }
399
+ /**
400
+ * @param offset: the amount to offset from the entity
401
+ * @returns the offset position from the entity in world coords
402
+ */
403
+ getOffsetInRelativeCoords(worldCoords) {
404
+ return Vector3.fromArray(
405
+ GetOffsetFromEntityGivenWorldCoords(this.handle, worldCoords.x, worldCoords.y, worldCoords.z)
406
+ );
407
+ }
408
+ // TODO: Better example
409
+ /**
410
+ * @example
411
+ * ```typescript
412
+ * const ply = Game.PlayerPed;
413
+ * const plyPos = ply.Position;
414
+ * const bag = await World.createProp(new Model('ba_prop_battle_bag_01b'), plyPos, true, true, true);
415
+ * bag.attachToBone(
416
+ * ply.Bones.getBone(64113),
417
+ * new Vector3(0.12, -0.25, 0.0),
418
+ * new Vector3(105.0, 50.0, 190.0)
419
+ * )
420
+ * const offset = bag.getRelativePositionOffset(plyPos);
421
+ * ```
422
+ * @param worldCoords: the offset given the world coords
423
+ * @returns the offset position from the entity in relative coords
424
+ */
425
+ getOffsetInWorldCoords(offset) {
426
+ return Vector3.fromArray(GetOffsetFromEntityInWorldCoords(this.handle, offset.x, offset.y, offset.z));
427
+ }
428
+ /**
429
+ * @deprecated use [[getOffsetInRelativeCoords]] instead
430
+ */
431
+ getPositionOffset(worldCoords) {
432
+ return this.getOffsetInRelativeCoords(worldCoords);
433
+ }
434
+ /**
435
+ * @deprecated use [[getOffsetInWorldCoords]]
436
+ */
437
+ getOffsetPosition(offset) {
438
+ return this.getOffsetInWorldCoords(offset);
439
+ }
440
+ attachTo(entity, position, rotation, collisions = false, unk9 = true, useSoftPinning = true, rotationOrder = 1) {
441
+ if (this.handle === entity.Handle) {
442
+ throw new Error("You cannot attach an entity to the same entity this will result in a crash!");
443
+ }
444
+ AttachEntityToEntity(
445
+ this.handle,
446
+ entity.Handle,
447
+ -1,
448
+ position.x,
449
+ position.y,
450
+ position.z,
451
+ rotation.x,
452
+ rotation.y,
453
+ rotation.z,
454
+ unk9,
455
+ useSoftPinning,
456
+ collisions,
457
+ IsEntityAPed(entity.Handle),
458
+ rotationOrder,
459
+ true
460
+ );
461
+ }
462
+ /*
463
+ * Attaches an entity to another entity via a bone
464
+ * @example
465
+ * ```typescript
466
+ * const ply = Game.PlayerPed;
467
+ * const bag = await World.createProp(new Model('ba_prop_battle_bag_01b'), ply.Position, true, true, true);
468
+ * bag.attachToBone(
469
+ * ply.Bones.getBone(64113),
470
+ * new Vector3(0.12, -0.25, 0.0),
471
+ * new Vector3(105.0, 50.0, 190.0)
472
+ * )
473
+ * ```
474
+ */
475
+ attachToBone(entityBone, position, rotation, collisions = false, unk9 = true, useSoftPinning = true, rotationOrder = 1) {
476
+ if (this.handle === entityBone.Owner.Handle) {
477
+ throw new Error("You cannot attach an entity to the same entity this will result in a crash!");
478
+ }
479
+ AttachEntityToEntity(
480
+ this.handle,
481
+ entityBone.Owner.Handle,
482
+ entityBone.Index,
483
+ position.x,
484
+ position.y,
485
+ position.z,
486
+ rotation.x,
487
+ rotation.y,
488
+ rotation.z,
489
+ unk9,
490
+ useSoftPinning,
491
+ collisions,
492
+ IsEntityAPed(entityBone.Owner.Handle),
493
+ rotationOrder,
494
+ true
495
+ );
496
+ }
497
+ detach() {
498
+ DetachEntity(this.handle, true, true);
499
+ }
500
+ isAttached() {
501
+ return IsEntityAttached(this.handle);
502
+ }
503
+ isAttachedTo(entity) {
504
+ return IsEntityAttachedToEntity(this.handle, entity.Handle);
505
+ }
506
+ getEntityAttachedTo() {
507
+ return new BaseEntity(GetEntityAttachedTo(this.handle));
508
+ }
509
+ applyForce(direction, rotation, forceType = ForceType.MaxForceRot2) {
510
+ ApplyForceToEntity(
511
+ this.handle,
512
+ Number(forceType),
513
+ direction.x,
514
+ direction.y,
515
+ direction.z,
516
+ rotation.x,
517
+ rotation.y,
518
+ rotation.z,
519
+ 0,
520
+ false,
521
+ true,
522
+ true,
523
+ false,
524
+ true
525
+ );
526
+ }
527
+ applyForceRelative(direction, rotation, forceType = ForceType.MaxForceRot2) {
528
+ ApplyForceToEntity(
529
+ this.handle,
530
+ Number(forceType),
531
+ direction.x,
532
+ direction.y,
533
+ direction.z,
534
+ rotation.x,
535
+ rotation.y,
536
+ rotation.z,
537
+ 0,
538
+ true,
539
+ true,
540
+ true,
541
+ false,
542
+ true
543
+ );
544
+ }
545
+ /**
546
+ * Removes all particle effects from the entity
547
+ */
548
+ removePtfxEffects() {
549
+ RemoveParticleFxFromEntity(this.handle);
550
+ }
551
+ /**
552
+ * @deprecated use [[removePtfxEffects]]
553
+ */
554
+ removeAllParticleEffects() {
555
+ this.removePtfxEffects();
556
+ }
557
+ exists() {
558
+ return DoesEntityExist(this.handle);
559
+ }
560
+ delete() {
561
+ this.IsMissionEntity = true;
562
+ DeleteEntity(this.handle);
563
+ for (const cookie of this.stateBagCookies) {
564
+ RemoveStateBagChangeHandler(cookie);
565
+ }
566
+ }
567
+ /**
568
+ * @deprecated use [[IsMissionEntity]] setter as false instead.
569
+ */
570
+ markAsNoLongerNeeded() {
571
+ SetEntityAsNoLongerNeeded(this.Handle);
572
+ }
573
+ }
574
+ export {
575
+ BaseEntity
576
+ };
@@ -1 +0,0 @@
1
- export {};
File without changes
@@ -1,4 +1,4 @@
1
- import { Vector3 } from "../utils";
1
+ import { Vector3 } from "../common/utils/Vector";
2
2
  import type { BaseEntity } from "./BaseEntity";
3
3
  export declare class EntityBone {
4
4
  get Index(): number;
@@ -0,0 +1,32 @@
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 EntityBone {
5
+ static {
6
+ __name(this, "EntityBone");
7
+ }
8
+ get Index() {
9
+ return this.index;
10
+ }
11
+ get Owner() {
12
+ return this.owner;
13
+ }
14
+ get Position() {
15
+ return Vector3.fromArray(GetWorldPositionOfEntityBone(this.owner.Handle, this.index));
16
+ }
17
+ get Rotation() {
18
+ return Vector3.fromArray(GetEntityBoneRotation(this.owner.Handle, this.index));
19
+ }
20
+ get IsValid() {
21
+ return this.owner.exists() && this.index !== -1;
22
+ }
23
+ owner;
24
+ index;
25
+ constructor(owner, boneIndex, boneName) {
26
+ this.owner = owner;
27
+ this.index = boneIndex ? boneIndex : GetEntityBoneIndexByName(this.owner.Handle, boneName ?? "");
28
+ }
29
+ }
30
+ export {
31
+ EntityBone
32
+ };
@@ -1,5 +1,5 @@
1
- import { EntityBone } from "./";
2
1
  import type { BaseEntity } from "./BaseEntity";
2
+ import { EntityBone } from "./EntityBone";
3
3
  export declare class EntityBoneCollection {
4
4
  protected readonly owner: BaseEntity;
5
5
  constructor(owner: BaseEntity);
@@ -0,0 +1,27 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { EntityBone } from "./EntityBone";
4
+ class EntityBoneCollection {
5
+ static {
6
+ __name(this, "EntityBoneCollection");
7
+ }
8
+ owner;
9
+ constructor(owner) {
10
+ this.owner = owner;
11
+ }
12
+ hasBone(name) {
13
+ return GetEntityBoneIndexByName(this.owner.Handle, name) !== -1;
14
+ }
15
+ getBone(boneIndex, boneName) {
16
+ return new EntityBone(
17
+ this.owner,
18
+ boneIndex ? boneIndex : GetEntityBoneIndexByName(this.owner.Handle, boneName ?? "")
19
+ );
20
+ }
21
+ get Core() {
22
+ return new EntityBone(this.owner, -1);
23
+ }
24
+ }
25
+ export {
26
+ EntityBoneCollection
27
+ };