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