@nativewrappers/fivem 0.0.65 → 0.0.72

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 (241) hide show
  1. package/Audio.d.ts +2 -2
  2. package/Blip.d.ts +2 -2
  3. package/Camera.d.ts +1 -1
  4. package/Game.d.ts +1 -1
  5. package/GameplayCamera.d.ts +1 -1
  6. package/Model.d.ts +1 -1
  7. package/ParticleEffect.d.ts +2 -2
  8. package/ParticleEffectAsset.d.ts +1 -1
  9. package/README.md +45 -0
  10. package/Raycast.d.ts +2 -2
  11. package/RelationshipGroup.d.ts +1 -1
  12. package/Tasks.d.ts +3 -3
  13. package/World.d.ts +2 -2
  14. package/cfx/StateBagChangeHandler.d.ts +1 -3
  15. package/common/Command.d.ts +30 -0
  16. package/common/Convar.d.ts +13 -0
  17. package/common/GlobalData.d.ts +8 -0
  18. package/common/Kvp.d.ts +69 -0
  19. package/common/Resource.d.ts +14 -0
  20. package/common/decors/Events.d.ts +54 -0
  21. package/common/index.d.ts +8 -0
  22. package/common/net/NetworkedMap.d.ts +28 -0
  23. package/common/types.d.ts +5 -0
  24. package/common/utils/ClassTypes.d.ts +11 -0
  25. package/common/utils/Color.d.ts +14 -0
  26. package/common/utils/Maths.d.ts +4 -0
  27. package/common/utils/PointF.d.ts +12 -0
  28. package/common/utils/Quaternion.d.ts +10 -0
  29. package/common/utils/Vector.d.ts +429 -0
  30. package/common/utils/Vector2.d.ts +1 -0
  31. package/common/utils/Vector3.d.ts +1 -0
  32. package/common/utils/Vector4.d.ts +1 -0
  33. package/common/utils/cleanPlayerName.d.ts +6 -0
  34. package/common/utils/enumValues.d.ts +12 -0
  35. package/{utils/getStringFromUInt8Array.js → common/utils/getStringFromUInt8Array.d.ts} +1 -3
  36. package/{utils/getUInt32FromUint8Array.js → common/utils/getUInt32FromUint8Array.d.ts} +1 -1
  37. package/common/utils/index.d.ts +12 -0
  38. package/index.d.ts +1 -1
  39. package/index.js +20136 -26
  40. package/interfaces/Dimensions.d.ts +1 -1
  41. package/models/BaseEntity.d.ts +3 -3
  42. package/models/Ped.d.ts +2 -2
  43. package/models/PedBone.d.ts +1 -1
  44. package/models/PedBoneCollection.d.ts +1 -1
  45. package/models/Player.d.ts +1 -1
  46. package/models/Vehicle.d.ts +2 -2
  47. package/models/VehicleDoor.d.ts +2 -2
  48. package/models/VehicleDoorCollection.d.ts +1 -1
  49. package/models/VehicleMod.d.ts +2 -2
  50. package/models/VehicleModCollection.d.ts +2 -2
  51. package/models/VehicleToggleMod.d.ts +2 -2
  52. package/models/VehicleWheel.d.ts +1 -1
  53. package/models/VehicleWheelCollection.d.ts +1 -1
  54. package/models/VehicleWindow.d.ts +2 -2
  55. package/models/VehicleWindowCollection.d.ts +1 -1
  56. package/package.json +6 -4
  57. package/ui/Container.d.ts +2 -2
  58. package/ui/Effects.d.ts +1 -1
  59. package/ui/Hud.d.ts +2 -2
  60. package/ui/InstructionalButtons.d.ts +1 -1
  61. package/ui/Rectangle.d.ts +2 -2
  62. package/ui/Scaleform.d.ts +1 -1
  63. package/ui/Screen.d.ts +1 -1
  64. package/ui/Text.d.ts +1 -1
  65. package/ui/interfaces/IButton.d.ts +1 -1
  66. package/ui/interfaces/IDrawable.d.ts +1 -1
  67. package/ui/menu/items/UIMenuItem.d.ts +1 -1
  68. package/ui/menu/items/UIMenuListItem.d.ts +1 -1
  69. package/ui/menu/items/panels/AbstractUIMenuPanel.d.ts +2 -2
  70. package/ui/menu/items/panels/UIMenuStatisticsPanel.d.ts +1 -1
  71. package/utils/LiteEvent.d.ts +2 -6
  72. package/utils/index.d.ts +1 -1
  73. package/weapon/DlcWeaponData.d.ts +1 -1
  74. package/weapon/Weapon.d.ts +7 -7
  75. package/weapon/WeaponAsset.d.ts +1 -1
  76. package/weapon/WeaponCollection.d.ts +2 -2
  77. package/weaponComponent/DlcWeaponComponentData.d.ts +1 -1
  78. package/weaponComponent/InvalidWeaponComponent.d.ts +1 -1
  79. package/weaponComponent/WeaponComponent.d.ts +3 -3
  80. package/weaponComponent/WeaponComponentCollection.d.ts +3 -3
  81. package/Audio.js +0 -93
  82. package/Blip.js +0 -105
  83. package/Camera.js +0 -162
  84. package/Checkpoint.js +0 -43
  85. package/Events.js +0 -74
  86. package/Game.js +0 -474
  87. package/GameplayCamera.js +0 -141
  88. package/Model.js +0 -213
  89. package/NetworkedScene.js +0 -18
  90. package/ParticleEffect.js +0 -123
  91. package/ParticleEffectAsset.js +0 -105
  92. package/Pickup.js +0 -19
  93. package/Raycast.js +0 -123
  94. package/RelationshipGroup.js +0 -67
  95. package/Rope.js +0 -129
  96. package/TaskSequence.js +0 -48
  97. package/Tasks.js +0 -241
  98. package/World.js +0 -765
  99. package/cfx/StateBagChangeHandler.js +0 -1
  100. package/cfx/index.js +0 -1
  101. package/enums/Alignment.js +0 -6
  102. package/enums/AnimationFlags.js +0 -35
  103. package/enums/AudioFlag.js +0 -38
  104. package/enums/BadgeStyle.js +0 -183
  105. package/enums/Blip.js +0 -225
  106. package/enums/Bone.js +0 -103
  107. package/enums/CameraShake.js +0 -14
  108. package/enums/CameraTypes.js +0 -8
  109. package/enums/CheckboxStyle.js +0 -5
  110. package/enums/Checkpoint.js +0 -67
  111. package/enums/CloudHat.js +0 -27
  112. package/enums/Control.js +0 -361
  113. package/enums/CursorSprite.js +0 -15
  114. package/enums/Driving.js +0 -34
  115. package/enums/ExplosionType.js +0 -45
  116. package/enums/FiringPattern.js +0 -20
  117. package/enums/Font.js +0 -8
  118. package/enums/ForceType.js +0 -9
  119. package/enums/Gender.js +0 -5
  120. package/enums/HelmetType.js +0 -6
  121. package/enums/HudColor.js +0 -184
  122. package/enums/HudComponent.js +0 -54
  123. package/enums/InputMode.js +0 -5
  124. package/enums/InvertAxis.js +0 -7
  125. package/enums/Language.js +0 -15
  126. package/enums/LeaveVehicleFlags.js +0 -11
  127. package/enums/LoadingSpinnerType.js +0 -8
  128. package/enums/MarkerType.js +0 -50
  129. package/enums/MenuAlignment.js +0 -5
  130. package/enums/NotificationType.js +0 -11
  131. package/enums/Parachute.js +0 -15
  132. package/enums/PickupType.js +0 -74
  133. package/enums/RadioStation.js +0 -25
  134. package/enums/RagdollType.js +0 -7
  135. package/enums/RaycastEnums.js +0 -32
  136. package/enums/Relationship.js +0 -10
  137. package/enums/RopeType.js +0 -6
  138. package/enums/ScreenEffect.js +0 -84
  139. package/enums/SpeechModifier.js +0 -40
  140. package/enums/Vehicle.js +0 -376
  141. package/enums/Weather.js +0 -22
  142. package/enums/ZoneID.js +0 -95
  143. package/enums/index.js +0 -42
  144. package/hashes/MaterialHash.js +0 -217
  145. package/hashes/PedHash.js +0 -725
  146. package/hashes/VehicleHash.js +0 -523
  147. package/hashes/WeaponHash.js +0 -161
  148. package/hashes/WeatherTypeHash.js +0 -22
  149. package/hashes/index.js +0 -5
  150. package/interfaces/Dimensions.js +0 -1
  151. package/models/BaseEntity.js +0 -477
  152. package/models/Entity.js +0 -25
  153. package/models/EntityBone.js +0 -26
  154. package/models/EntityBoneCollection.js +0 -18
  155. package/models/Ped.js +0 -692
  156. package/models/PedBone.js +0 -9
  157. package/models/PedBoneCollection.js +0 -21
  158. package/models/Player.js +0 -186
  159. package/models/Prop.js +0 -26
  160. package/models/Vehicle.js +0 -576
  161. package/models/VehicleDoor.js +0 -44
  162. package/models/VehicleDoorCollection.js +0 -62
  163. package/models/VehicleMod.js +0 -35
  164. package/models/VehicleModCollection.js +0 -227
  165. package/models/VehicleToggleMod.js +0 -29
  166. package/models/VehicleWheel.js +0 -23
  167. package/models/VehicleWheelCollection.js +0 -57
  168. package/models/VehicleWindow.js +0 -35
  169. package/models/VehicleWindowCollection.js +0 -57
  170. package/models/index.js +0 -19
  171. package/ui/Container.js +0 -31
  172. package/ui/Effects.js +0 -106
  173. package/ui/Fading.js +0 -69
  174. package/ui/Hud.js +0 -39
  175. package/ui/InstructionalButtons.js +0 -54
  176. package/ui/LoadingPrompt.js +0 -45
  177. package/ui/Notification.js +0 -9
  178. package/ui/Rectangle.js +0 -40
  179. package/ui/Scaleform.js +0 -236
  180. package/ui/Screen.js +0 -72
  181. package/ui/Sprite.js +0 -60
  182. package/ui/Text.js +0 -115
  183. package/ui/Timerbar.js +0 -248
  184. package/ui/index.js +0 -15
  185. package/ui/interfaces/IButton.js +0 -1
  186. package/ui/interfaces/IDrawable.js +0 -1
  187. package/ui/interfaces/index.js +0 -1
  188. package/ui/menu/Menu.js +0 -831
  189. package/ui/menu/MenuControl.js +0 -12
  190. package/ui/menu/MenuControls.js +0 -9
  191. package/ui/menu/MenuSettings.js +0 -54
  192. package/ui/menu/index.js +0 -6
  193. package/ui/menu/items/UIMenuCheckboxItem.js +0 -59
  194. package/ui/menu/items/UIMenuItem.js +0 -1111
  195. package/ui/menu/items/UIMenuListItem.js +0 -119
  196. package/ui/menu/items/UIMenuSeparatorItem.js +0 -29
  197. package/ui/menu/items/UIMenuSliderItem.js +0 -191
  198. package/ui/menu/items/index.js +0 -6
  199. package/ui/menu/items/panels/AbstractUIMenuPanel.js +0 -44
  200. package/ui/menu/items/panels/UIMenuColorPanel.js +0 -217
  201. package/ui/menu/items/panels/UIMenuGridPanel.js +0 -261
  202. package/ui/menu/items/panels/UIMenuPercentagePanel.js +0 -124
  203. package/ui/menu/items/panels/UIMenuStatisticsPanel.js +0 -79
  204. package/ui/menu/items/panels/UIMenuStatisticsPanelItem.js +0 -35
  205. package/ui/menu/items/panels/index.js +0 -6
  206. package/ui/menu/modules/ListItem.js +0 -10
  207. package/ui/menu/modules/index.js +0 -1
  208. package/utils/Animations.js +0 -55
  209. package/utils/Crypto.js +0 -25
  210. package/utils/LiteEvent.js +0 -19
  211. package/utils/Maths.js +0 -10
  212. package/utils/Point.js +0 -30
  213. package/utils/PointF.js +0 -14
  214. package/utils/Quaternion.js +0 -27
  215. package/utils/Size.js +0 -8
  216. package/utils/String.js +0 -25
  217. package/utils/enumValues.js +0 -14
  218. package/utils/index.js +0 -9
  219. package/weapon/DlcWeaponData.js +0 -44
  220. package/weapon/Mk2WeaponHash.js +0 -25
  221. package/weapon/Weapon.js +0 -270
  222. package/weapon/WeaponAsset.js +0 -84
  223. package/weapon/WeaponCollection.js +0 -187
  224. package/weapon/WeaponDisplayNameByHash.js +0 -75
  225. package/weapon/WeaponGroup.js +0 -19
  226. package/weapon/WeaponHudStats.js +0 -38
  227. package/weapon/WeaponLivery.js +0 -14
  228. package/weapon/WeaponLiveryColor.js +0 -35
  229. package/weapon/WeaponTint.js +0 -43
  230. package/weapon/index.js +0 -8
  231. package/weaponComponent/ComponentAttachmentPoint.js +0 -19
  232. package/weaponComponent/ComponentAttachmentPointByHash.js +0 -573
  233. package/weaponComponent/ComponentDisplayNameByHash.js +0 -280
  234. package/weaponComponent/DlcWeaponComponentData.js +0 -44
  235. package/weaponComponent/InvalidWeaponComponent.js +0 -28
  236. package/weaponComponent/WeaponComponent.js +0 -123
  237. package/weaponComponent/WeaponComponentCollection.js +0 -174
  238. package/weaponComponent/WeaponComponentHash.js +0 -887
  239. package/weaponComponent/WeaponComponentHashesByWeaponHash.js +0 -829
  240. package/weaponComponent/WeaponComponentHudStats.js +0 -34
  241. package/weaponComponent/index.js +0 -5
package/Game.js DELETED
@@ -1,474 +0,0 @@
1
- import { Blip, Vector3 } from ".";
2
- import { Audio } from "./Audio";
3
- import { InputMode, RadioStation } from "./enums";
4
- import { Ped, Player, Prop, Vehicle } from "./models";
5
- export class Game {
6
- static useHashCache = true;
7
- // A map containing generated hashes.
8
- static hashCache = new Map();
9
- /**
10
- * Calculate the Jenkins One At A Time (joaat) has from the given string.
11
- *
12
- * @param input The input string to calculate the hash
13
- */
14
- static generateHash(input) {
15
- if (typeof input === "undefined") {
16
- return 0;
17
- }
18
- if (!this.useHashCache) {
19
- return GetHashKey(input);
20
- }
21
- const _hash = this.hashCache.get(input);
22
- if (_hash)
23
- return _hash;
24
- const hash = GetHashKey(input);
25
- this.hashCache.set(input, hash);
26
- return hash;
27
- }
28
- static setLocalPlayerGhosted(isGhosted, inverseGhost) {
29
- // @ts-ignore
30
- SetLocalPlayerAsGhost(isGhosted, inverseGhost);
31
- }
32
- static setGhostAlpha(alpha) {
33
- SetGhostedEntityAlpha(alpha);
34
- }
35
- static resetGhostAlpha() {
36
- ResetGhostedEntityAlpha();
37
- }
38
- static setGhostingInverted(isInverted) {
39
- // actual name is SET_INVERT_GHOSTING
40
- N_0xd7b6c73cad419bcf(isInverted);
41
- }
42
- /**
43
- * Gets the game language
44
- */
45
- static get Language() {
46
- return GetUiLanguageId();
47
- }
48
- /**
49
- * Gets how many milliseconds the game has been open this session
50
- */
51
- static get GameTime() {
52
- return GetGameTimer();
53
- }
54
- /**
55
- * Sets the time scale of the Game.
56
- *
57
- * @param time The time scale, only accepts values between 0.0 and 1.0
58
- */
59
- static set TimeScale(time) {
60
- SetTimeScale(time <= 1 && time >= 0 ? time : 1);
61
- }
62
- /**
63
- * Gets the total amount of frames rendered in this session
64
- */
65
- static get FrameCount() {
66
- return GetFrameCount();
67
- }
68
- /**
69
- * Gets the current frame rate per second
70
- */
71
- static get FPS() {
72
- return 1 / this.LastFrameTime;
73
- }
74
- /**
75
- * Gets the time it currently takes to render a frame, in seconds;
76
- */
77
- static get LastFrameTime() {
78
- return GetFrameTime();
79
- }
80
- /**
81
- * Get the local player's Player object.
82
- */
83
- static get Player() {
84
- const handle = PlayerId();
85
- if (this.cachedPlayer === undefined ||
86
- handle !== this.cachedPlayer.Handle) {
87
- this.cachedPlayer = new Player(handle);
88
- }
89
- return this.cachedPlayer;
90
- }
91
- /**
92
- * Get the local player character's Ped object.
93
- * @returns A local player's character.
94
- */
95
- static get PlayerPed() {
96
- return this.Player.Character;
97
- }
98
- /**
99
- * Get an iterable list of players currently on server.
100
- * @returns Iterable list of Player objects.
101
- */
102
- static *playerList(excludeLocalPlayer = false) {
103
- const localPlayer = this.Player;
104
- for (const id of GetActivePlayers()) {
105
- if (excludeLocalPlayer && localPlayer.Handle === id) {
106
- continue;
107
- }
108
- yield new Player(id);
109
- }
110
- }
111
- /**
112
- * Get whether PvP is enabled.
113
- * @returns True if enabled.
114
- */
115
- static get PlayerVersusPlayer() {
116
- return this.Player.PvPEnabled;
117
- }
118
- /**
119
- * Set whether PvP is enabled.
120
- */
121
- static set PlayerVersusPlayer(value) {
122
- this.Player.PvPEnabled = value;
123
- }
124
- /**
125
- * Get the maximum wanted level.
126
- */
127
- static get MaxWantedLevel() {
128
- return GetMaxWantedLevel();
129
- }
130
- /**
131
- * Set the maximum wanted level the local client can get.
132
- */
133
- static set MaxWantedLevel(value) {
134
- if (value < 0) {
135
- value = 0;
136
- }
137
- else if (value > 5) {
138
- value = 5;
139
- }
140
- SetMaxWantedLevel(value);
141
- }
142
- /**
143
- * Set the multiplier of the wanted level.
144
- */
145
- static set WantedMultiplier(value) {
146
- SetWantedLevelMultiplier(value);
147
- }
148
- /**
149
- * Set whether police blips should show on minimap.
150
- */
151
- static set ShowPoliceBlipsOnRadar(toggle) {
152
- SetPoliceRadarBlips(toggle);
153
- }
154
- /**
155
- * Get if nightvision is active.
156
- */
157
- static get Nightvision() {
158
- return IsNightvisionActive();
159
- }
160
- /**
161
- * Toggle nightvision.
162
- */
163
- static set Nightvision(toggle) {
164
- SetNightvision(toggle);
165
- }
166
- /**
167
- * Get if thermal (heat) vision is active.
168
- */
169
- static get ThermalVision() {
170
- return IsSeethroughActive();
171
- }
172
- /**
173
- * Toggle thermal (heat) vision.
174
- */
175
- static set ThermalVision(toggle) {
176
- SetSeethrough(toggle);
177
- }
178
- static get IsMissionActive() {
179
- return GetMissionFlag();
180
- }
181
- static set IsMissionActive(toggle) {
182
- SetMissionFlag(toggle);
183
- }
184
- static get IsRandomEventActive() {
185
- return GetRandomEventFlag();
186
- }
187
- static set IsRandomEventActive(toggle) {
188
- SetRandomEventFlag(toggle);
189
- }
190
- static get IsCutsceneActive() {
191
- return IsCutsceneActive();
192
- }
193
- /**
194
- * Is a waypoint set on the map.
195
- */
196
- static get IsWaypointActive() {
197
- return IsWaypointActive();
198
- }
199
- /**
200
- * Is the player in the pause menu (ESC).
201
- */
202
- static get IsPaused() {
203
- return IsPauseMenuActive();
204
- }
205
- /**
206
- * Force enable pause menu.
207
- */
208
- static set IsPaused(toggle) {
209
- SetPauseMenuActive(toggle);
210
- }
211
- /**
212
- * Get if a loading screen is active.
213
- */
214
- static get IsLoading() {
215
- return GetIsLoadingScreenActive();
216
- }
217
- /**
218
- * Get current input mode.
219
- * @returns InputMode: Mouse & Keyboard or GamePad.
220
- */
221
- static get CurrentInputMode() {
222
- return IsInputDisabled(2) ? InputMode.MouseAndKeyboard : InputMode.GamePad;
223
- }
224
- /**
225
- * Gets the player's current radio station.
226
- *
227
- * @returns A radio station.
228
- */
229
- static get RadioStation() {
230
- const stationName = GetPlayerRadioStationName();
231
- return RadioStation[stationName];
232
- }
233
- /**
234
- * Sets the player's radio station.
235
- *
236
- * @param station A radio station.
237
- */
238
- static set RadioStation(station) {
239
- SetRadioToStationName(station);
240
- }
241
- /**
242
- * Check whether a control is currently pressed.
243
- *
244
- * @param inputMode InputMode
245
- * @param control Control
246
- * @returns True or False.
247
- */
248
- static isControlPressed(inputMode, control) {
249
- return IsControlPressed(inputMode, Number(control));
250
- }
251
- /**
252
- * Check whether a disabled control is currently pressed.
253
- *
254
- * @param inputMode InputMode
255
- * @param control Control
256
- * @returns True or False.
257
- */
258
- static isDisabledControlPressed(inputMode, control) {
259
- return IsDisabledControlPressed(inputMode, Number(control));
260
- }
261
- /**
262
- * Check whether a control has been pressed since last check.
263
- *
264
- * @param inputMode InputMode
265
- * @param control Control
266
- * @returns True or False.
267
- */
268
- static isControlJustPressed(inputMode, control) {
269
- return IsControlJustPressed(inputMode, Number(control));
270
- }
271
- /**
272
- * Check whether a disabled control has been pressed since last check.
273
- *
274
- * @param inputMode InputMode
275
- * @param control Control
276
- * @returns True or False.
277
- */
278
- static isDisabledControlJustPressed(inputMode, control) {
279
- return IsDisabledControlJustPressed(inputMode, Number(control));
280
- }
281
- /**
282
- * Check whether a control is being released.
283
- *
284
- * @param inputMode InputMode
285
- * @param control Control
286
- * @returns True or False.
287
- */
288
- static isControlReleased(inputMode, control) {
289
- return IsControlReleased(inputMode, Number(control));
290
- }
291
- /**
292
- * Check whether a disabled control is being released.
293
- *
294
- * @param inputMode InputMode
295
- * @param control Control
296
- * @returns True or False.
297
- */
298
- static isDisabledControlReleased(inputMode, control) {
299
- return IsDisabledControlReleased(inputMode, Number(control));
300
- }
301
- /**
302
- * Check whether a control has been released since last check.
303
- *
304
- * @param inputMode InputMode
305
- * @param control Control
306
- * @returns True or False.
307
- */
308
- static isControlJustReleased(inputMode, control) {
309
- return IsControlJustReleased(inputMode, Number(control));
310
- }
311
- /**
312
- * Check whether a disabled control has been released since last check.
313
- *
314
- * @param inputMode InputMode
315
- * @param control Control
316
- * @returns True or False.
317
- */
318
- static isDisabledControlJustReleased(inputMode, control) {
319
- return IsDisabledControlJustReleased(inputMode, Number(control));
320
- }
321
- /**
322
- * Check whether a control is enabled this frame.
323
- *
324
- * @param inputMode InputMode
325
- * @param control Control
326
- * @returns True or False.
327
- */
328
- static isControlEnabled(inputMode, control) {
329
- return IsControlEnabled(inputMode, Number(control));
330
- }
331
- /**
332
- * Makes the Game Engine respond to the given Control this frame
333
- *
334
- * @param inputMode InputMode
335
- * @param control Control
336
- */
337
- static enableControlThisFrame(inputMode, control) {
338
- EnableControlAction(inputMode, Number(control), true);
339
- }
340
- /**
341
- * Makes the Game Engine ignore the given Control this frame
342
- *
343
- * @param inputMode InputMode
344
- * @param control Control
345
- */
346
- static disableControlThisFrame(inputMode, control) {
347
- DisableControlAction(inputMode, Number(control), true);
348
- }
349
- /**
350
- * Disables all Controls this frame.
351
- *
352
- * @param inputMode InputMode
353
- */
354
- static disableAllControlsThisFrame(inputMode) {
355
- DisableAllControlActions(inputMode);
356
- }
357
- /**
358
- * Enables all Controls this frame.
359
- *
360
- * @param inputMode InputMode
361
- */
362
- static enableAllControlsThisFrame(inputMode) {
363
- EnableAllControlActions(inputMode);
364
- }
365
- /**
366
- * Get an entity object from an entity handle.
367
- *
368
- * @param handle Handle of entity
369
- * @returns A Ped, Vehicle or Prop object. `undefined` if entity handle doesn't exist.
370
- */
371
- static entityFromHandle(handle) {
372
- switch (GetEntityType(handle)) {
373
- case 1:
374
- return new Ped(handle);
375
- case 2:
376
- return new Vehicle(handle);
377
- case 3:
378
- return new Prop(handle);
379
- }
380
- return null;
381
- }
382
- /**
383
- * Play a sound. Same as Audio.playSound
384
- *
385
- * @param soundFile Name of sound
386
- * @param soundSet The set where the sound is in
387
- */
388
- static playSound(soundFile, soundSet) {
389
- Audio.playSound(soundFile, soundSet);
390
- }
391
- /**
392
- * Play music. Same as Audio.playSound
393
- *
394
- * @param musicFile Music file.
395
- */
396
- static playMusic(musicFile) {
397
- Audio.playMusic(musicFile);
398
- }
399
- /**
400
- * Stop music. If `musicFile` is not given, last played music is stopped. Same as Audio.playSound
401
- *
402
- * @param musicFile (optional) Music file.
403
- */
404
- static stopMusic(musicFile) {
405
- Audio.stopMusic(musicFile);
406
- }
407
- /**
408
- * Determines the game language files contain a entry for the specified GXT key
409
- *
410
- * @param entry - The GXT key.
411
- * @returns true if GXT entry exists; otherwise, false
412
- * @constructor
413
- */
414
- static doesGXTEntryExist(entry) {
415
- if (typeof entry === "number") {
416
- return DoesTextLabelExist(entry.toString());
417
- }
418
- else {
419
- return DoesTextLabelExist(entry);
420
- }
421
- }
422
- /**
423
- * Returns a localised string from the games language files with a specified GXT key
424
- *
425
- * @param entry - The GXT key.
426
- * @returns The localised string if the key exists; otherwise, empty string
427
- */
428
- static getGXTEntry(entry) {
429
- return Game.doesGXTEntryExist(entry) ? GetLabelText(entry.toString()) : "";
430
- }
431
- /**
432
- * Sets the max boundry the local player can go to before they get killed
433
- *
434
- * @param vec - the max bounds for the local player
435
- */
436
- set ExtendWorldBoundry(vec) {
437
- ExtendWorldBoundaryForPlayer(vec.x, vec.y, vec.z);
438
- }
439
- get LastVehicle() {
440
- const vehicle = GetPlayersLastVehicle();
441
- if (vehicle === 0)
442
- return null;
443
- return new Vehicle(vehicle);
444
- }
445
- static getWaypointBlip() {
446
- if (!Game.IsWaypointActive)
447
- return null;
448
- for (let handle = GetBlipInfoIdIterator(), blip = GetFirstBlipInfoId(handle); DoesBlipExist(handle); blip = GetNextBlipInfoId(handle)) {
449
- if (GetBlipInfoIdType(blip) === 4)
450
- return new Blip(blip);
451
- }
452
- return null;
453
- }
454
- static removeWaypoint() {
455
- SetWaypointOff();
456
- }
457
- static get WaypointPosition() {
458
- const waypointBlip = this.getWaypointBlip();
459
- if (waypointBlip == null) {
460
- return Vector3.Zero;
461
- }
462
- const position = waypointBlip.Position;
463
- position.z = this.getGroundHeight(position);
464
- return position;
465
- }
466
- static set WaypointPosition(position) {
467
- SetNewWaypoint(position.x, position.y);
468
- }
469
- static getGroundHeight(position) {
470
- RequestCollisionAtCoord(position.x, position.z, 1000.0);
471
- return GetGroundZFor_3dCoord(position.x, position.y, 1000.0, false)[1];
472
- }
473
- static cachedPlayer;
474
- }
package/GameplayCamera.js DELETED
@@ -1,141 +0,0 @@
1
- import { Camera } from "./Camera";
2
- import { Vector3 } from "./utils";
3
- /**
4
- * The current rendering gameplay camera
5
- */
6
- export class GameplayCamera {
7
- /**
8
- * Get the world position of gameplay camera.
9
- */
10
- static get Position() {
11
- return Vector3.fromArray(GetGameplayCamCoords());
12
- }
13
- /**
14
- * Get the rotation of gameplay camera.
15
- */
16
- static get Rotation() {
17
- return Vector3.fromArray(GetGameplayCamRot(2));
18
- }
19
- /**
20
- * Get the forward vector of gameplay camera.
21
- */
22
- static get ForwardVector() {
23
- const rotation = Vector3.multiply(this.Rotation, Math.PI / 180);
24
- return Vector3.normalize(new Vector3(-Math.sin(rotation.z) * Math.abs(Math.cos(rotation.x)), Math.cos(rotation.z) * Math.abs(Math.cos(rotation.x)), Math.sin(rotation.x)));
25
- }
26
- /**
27
- * Get the pitch of the gameplay camera relative to player.
28
- */
29
- static get RelativePitch() {
30
- return GetGameplayCamRelativePitch();
31
- }
32
- /**
33
- * Set gameplay camera pitch relative to player.
34
- */
35
- static set RelativePitch(pitch) {
36
- SetGameplayCamRelativePitch(pitch, 1);
37
- }
38
- /**
39
- * Get heading of gameplay camera.
40
- */
41
- static get RelativeHeading() {
42
- return GetGameplayCamRelativeHeading();
43
- }
44
- /**
45
- * Get heading of gameplay camera.
46
- */
47
- static set RelativeHeading(heading) {
48
- SetGameplayCamRelativeHeading(heading);
49
- }
50
- /**
51
- * Clamps the yaw of the gameplay camera.
52
- *
53
- * @param min The minimum yaw value.
54
- * @param max The maximum yaw value.
55
- */
56
- static clampYaw(min, max) {
57
- ClampGameplayCamYaw(min, max);
58
- }
59
- /**
60
- * Clamps the pitch of the gameplay camera.
61
- *
62
- * @param min The minimum pitch value.
63
- * @param max The maximum pitch value.
64
- */
65
- static clampPitch(min, max) {
66
- ClampGameplayCamPitch(min, max);
67
- }
68
- /**
69
- * Gets zoom of the gameplay camera.
70
- */
71
- static get Zoom() {
72
- return GetGameplayCamZoom();
73
- }
74
- /**
75
- * Gets field of view of the gameplay camera.
76
- */
77
- static get FieldOfView() {
78
- return GetGameplayCamFov();
79
- }
80
- /**
81
- * Gets a value indicating whether the gameplay camera is rendering.
82
- *
83
- * @returns true if the gameplay camera is rendering; otherwise, false.
84
- */
85
- static get IsRendering() {
86
- return IsGameplayCamRendering();
87
- }
88
- /**
89
- * Gets a value indicating whether the aiming camera is rendering.
90
- *
91
- * @returns true if the aiming camera is rendering; otherwise, false.
92
- */
93
- static get IsAimCamActive() {
94
- return IsAimCamActive();
95
- }
96
- /**
97
- * Gets a value indicating whether the first person aiming camera is rendering.
98
- *
99
- * @returns true if the first person aiming camera is rendering; otherwise, false.
100
- */
101
- static get IsFirstPersonAimCamActive() {
102
- return IsFirstPersonAimCamActive();
103
- }
104
- /**
105
- * Gets a value indicating whether the gameplay camera is looking behind.
106
- *
107
- * @returns true if the gameplay camera is looking behind; otherwise, false.
108
- */
109
- static get IsLookingBehind() {
110
- return IsGameplayCamLookingBehind();
111
- }
112
- /**
113
- * Shakes the gameplay camera.
114
- *
115
- * @param shakeType Type of the shake to apply.
116
- * @param amplitude The amplitude of the shaking.
117
- */
118
- static shake(shakeType, amplitude) {
119
- ShakeGameplayCam(Camera.shakeNames[Number(shakeType)], amplitude);
120
- }
121
- /**
122
- * Stops shaking the gameplay camera.
123
- */
124
- static stopShaking() {
125
- StopGameplayCamShaking(true);
126
- }
127
- /**
128
- * Gets a value indicating whether the gameplay camera is shaking.
129
- *
130
- * @returns true if the gameplay camera is shaking; otherwise, false.
131
- */
132
- static get IsShaking() {
133
- return IsGameplayCamShaking();
134
- }
135
- /**
136
- * Sets the shake amplitude for the gameplay camera.
137
- */
138
- static set ShakeAmplitude(value) {
139
- SetGameplayCamShakeAmplitude(value);
140
- }
141
- }