@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.
- package/Audio.d.ts +2 -2
- package/Audio.js +99 -0
- package/Blip.d.ts +4 -3
- package/Blip.js +113 -0
- package/Camera.d.ts +3 -3
- package/Camera.js +190 -0
- package/Checkpoint.d.ts +2 -2
- package/Checkpoint.js +51 -0
- package/Events.js +80 -0
- package/Game.d.ts +10 -3
- package/Game.js +478 -0
- package/GameplayCamera.d.ts +2 -2
- package/GameplayCamera.js +152 -0
- package/Model.js +210 -0
- package/NetworkedScene.d.ts +2 -1
- package/NetworkedScene.js +50 -0
- package/ParticleEffect.d.ts +4 -3
- package/ParticleEffect.js +128 -0
- package/ParticleEffectAsset.d.ts +2 -2
- package/ParticleEffectAsset.js +133 -0
- package/Pickup.d.ts +1 -1
- package/Pickup.js +27 -0
- package/Raycast.d.ts +5 -3
- package/Raycast.js +132 -0
- package/RelationshipGroup.d.ts +1 -1
- package/RelationshipGroup.js +72 -0
- package/Rope.d.ts +1 -1
- package/Rope.js +149 -0
- package/TaskSequence.js +52 -0
- package/Tasks.d.ts +8 -3
- package/Tasks.js +334 -0
- package/World.d.ts +13 -4
- package/World.js +945 -0
- package/cfx/StateBagChangeHandler.js +0 -0
- package/cfx/index.d.ts +1 -1
- package/cfx/index.js +4 -0
- package/common/Command.js +111 -0
- package/common/Convar.js +58 -0
- package/common/GlobalData.js +16 -0
- package/common/Kvp.js +137 -0
- package/common/Resource.js +54 -0
- package/common/decors/Events.js +170 -0
- package/common/net/NetworkedMap.js +225 -0
- package/common/types.js +0 -0
- package/common/utils/ClassTypes.js +15 -0
- package/common/utils/Color.js +33 -0
- package/common/utils/Delay.d.ts +1 -0
- package/common/utils/Delay.js +6 -0
- package/common/utils/Maths.js +18 -0
- package/common/utils/Point.d.ts +9 -0
- package/common/utils/Point.js +36 -0
- package/common/utils/PointF.d.ts +1 -1
- package/common/utils/PointF.js +18 -0
- package/common/utils/Quaternion.d.ts +1 -1
- package/common/utils/Quaternion.js +33 -0
- package/common/utils/Vector.js +589 -0
- package/common/utils/cleanPlayerName.js +17 -0
- package/common/utils/enumValues.js +20 -0
- package/common/utils/getStringFromUInt8Array.js +6 -0
- package/common/utils/getUInt32FromUint8Array.js +6 -0
- package/enums/Alignment.js +9 -0
- package/enums/AnimationFlags.js +38 -0
- package/enums/AudioFlag.js +41 -0
- package/enums/BadgeStyle.js +186 -0
- package/enums/Blip.js +229 -0
- package/enums/Bone.js +105 -0
- package/enums/CameraShake.js +17 -0
- package/enums/CameraTypes.js +11 -0
- package/enums/CheckboxStyle.js +8 -0
- package/enums/Checkpoint.js +68 -0
- package/enums/CloudHat.js +27 -0
- package/enums/Control.js +364 -0
- package/enums/CursorSprite.js +18 -0
- package/enums/Driving.js +38 -0
- package/enums/ExplosionType.js +45 -0
- package/enums/FiringPattern.js +23 -0
- package/enums/Font.js +11 -0
- package/enums/ForceType.js +12 -0
- package/enums/Gender.js +8 -0
- package/enums/HelmetType.js +9 -0
- package/enums/HudColor.js +187 -0
- package/enums/HudComponent.js +57 -0
- package/enums/InputMode.js +8 -0
- package/enums/InvertAxis.js +10 -0
- package/enums/Language.js +18 -0
- package/enums/LeaveVehicleFlags.js +14 -0
- package/enums/LoadingSpinnerType.js +11 -0
- package/enums/MarkerType.js +48 -0
- package/enums/MenuAlignment.js +8 -0
- package/enums/NotificationType.js +14 -0
- package/enums/Parachute.js +19 -0
- package/enums/PickupType.js +77 -0
- package/enums/RadioStation.js +28 -0
- package/enums/RagdollType.js +10 -0
- package/enums/RaycastEnums.js +33 -0
- package/enums/Relationship.js +13 -0
- package/enums/RopeType.js +9 -0
- package/enums/ScreenEffect.js +87 -0
- package/enums/SpeechModifier.js +43 -0
- package/enums/Vehicle.js +396 -0
- package/enums/Weather.js +22 -0
- package/enums/ZoneID.js +95 -0
- package/hashes/MaterialHash.js +220 -0
- package/hashes/PedHash.js +728 -0
- package/hashes/VehicleHash.js +526 -0
- package/hashes/WeaponHash.js +155 -0
- package/hashes/WeatherTypeHash.js +22 -0
- package/index.js +166 -18794
- package/interfaces/Dimensions.d.ts +1 -1
- package/interfaces/Dimensions.js +0 -0
- package/models/BaseEntity.d.ts +10 -8
- package/models/BaseEntity.js +576 -0
- package/models/Entity.d.ts +0 -1
- package/models/Entity.js +0 -0
- package/models/EntityBone.d.ts +1 -1
- package/models/EntityBone.js +32 -0
- package/models/EntityBoneCollection.d.ts +1 -1
- package/models/EntityBoneCollection.js +27 -0
- package/models/Ped.d.ts +13 -5
- package/models/Ped.js +711 -0
- package/models/PedBone.d.ts +3 -2
- package/models/PedBone.js +18 -0
- package/models/PedBoneCollection.d.ts +3 -1
- package/models/PedBoneCollection.js +31 -0
- package/models/Player.d.ts +4 -2
- package/models/Player.js +188 -0
- package/models/Prop.d.ts +1 -1
- package/models/Prop.js +34 -0
- package/models/Vehicle.d.ts +9 -4
- package/models/Vehicle.js +582 -0
- package/models/VehicleDoor.d.ts +1 -1
- package/models/VehicleDoor.js +52 -0
- package/models/VehicleDoorCollection.d.ts +1 -1
- package/models/VehicleDoorCollection.js +66 -0
- package/models/VehicleMod.d.ts +1 -1
- package/models/VehicleMod.js +43 -0
- package/models/VehicleModCollection.d.ts +2 -2
- package/models/VehicleModCollection.js +227 -0
- package/models/VehicleToggleMod.d.ts +1 -1
- package/models/VehicleToggleMod.js +37 -0
- package/models/VehicleWheel.js +31 -0
- package/models/VehicleWheelCollection.d.ts +1 -1
- package/models/VehicleWheelCollection.js +61 -0
- package/models/VehicleWindow.d.ts +1 -1
- package/models/VehicleWindow.js +43 -0
- package/models/VehicleWindowCollection.d.ts +1 -1
- package/models/VehicleWindowCollection.js +62 -0
- package/package.json +2 -2
- package/ui/Container.d.ts +4 -2
- package/ui/Container.js +39 -0
- package/ui/Effects.d.ts +1 -1
- package/ui/Effects.js +112 -0
- package/ui/Fading.js +74 -0
- package/ui/Hud.d.ts +3 -2
- package/ui/Hud.js +47 -0
- package/ui/InstructionalButtons.js +42 -0
- package/ui/LoadingPrompt.d.ts +1 -1
- package/ui/LoadingPrompt.js +37 -0
- package/ui/Notification.js +17 -0
- package/ui/Rectangle.d.ts +4 -2
- package/ui/Rectangle.js +46 -0
- package/ui/Scaleform.d.ts +2 -1
- package/ui/Scaleform.js +240 -0
- package/ui/Screen.d.ts +6 -3
- package/ui/Screen.js +83 -0
- package/ui/Sprite.d.ts +3 -1
- package/ui/Sprite.js +70 -0
- package/ui/Text.d.ts +6 -3
- package/ui/Text.js +119 -0
- package/ui/Timerbar.js +241 -0
- package/ui/interfaces/IButton.d.ts +1 -1
- package/ui/interfaces/IButton.js +0 -0
- package/ui/interfaces/IDrawable.d.ts +3 -1
- package/ui/interfaces/IDrawable.js +0 -0
- package/ui/menu/Menu.d.ts +9 -4
- package/ui/menu/Menu.js +830 -0
- package/ui/menu/MenuControl.js +20 -0
- package/ui/menu/MenuControls.js +17 -0
- package/ui/menu/MenuSettings.d.ts +1 -1
- package/ui/menu/MenuSettings.js +57 -0
- package/ui/menu/items/UIMenuCheckboxItem.d.ts +3 -3
- package/ui/menu/items/UIMenuCheckboxItem.js +70 -0
- package/ui/menu/items/UIMenuItem.d.ts +10 -4
- package/ui/menu/items/UIMenuItem.js +1103 -0
- package/ui/menu/items/UIMenuListItem.d.ts +3 -3
- package/ui/menu/items/UIMenuListItem.js +118 -0
- package/ui/menu/items/UIMenuSeparatorItem.d.ts +1 -1
- package/ui/menu/items/UIMenuSeparatorItem.js +37 -0
- package/ui/menu/items/UIMenuSliderItem.d.ts +4 -3
- package/ui/menu/items/UIMenuSliderItem.js +180 -0
- package/ui/menu/items/panels/AbstractUIMenuPanel.d.ts +4 -3
- package/ui/menu/items/panels/AbstractUIMenuPanel.js +49 -0
- package/ui/menu/items/panels/UIMenuColorPanel.d.ts +3 -3
- package/ui/menu/items/panels/UIMenuColorPanel.js +215 -0
- package/ui/menu/items/panels/UIMenuGridPanel.d.ts +3 -3
- package/ui/menu/items/panels/UIMenuGridPanel.js +216 -0
- package/ui/menu/items/panels/UIMenuPercentagePanel.d.ts +2 -2
- package/ui/menu/items/panels/UIMenuPercentagePanel.js +138 -0
- package/ui/menu/items/panels/UIMenuStatisticsPanel.d.ts +3 -2
- package/ui/menu/items/panels/UIMenuStatisticsPanel.js +88 -0
- package/ui/menu/items/panels/UIMenuStatisticsPanelItem.d.ts +2 -1
- package/ui/menu/items/panels/UIMenuStatisticsPanelItem.js +48 -0
- package/ui/menu/modules/ListItem.js +18 -0
- package/utils/Animations.js +43 -0
- package/utils/Crypto.js +33 -0
- package/utils/LiteEvent.js +25 -0
- package/utils/Maths.js +18 -0
- package/utils/Point.js +36 -0
- package/utils/Size.js +16 -0
- package/utils/String.d.ts +1 -1
- package/utils/String.js +35 -0
- package/weapon/DlcWeaponData.d.ts +1 -1
- package/weapon/DlcWeaponData.js +40 -0
- package/weapon/Mk2WeaponHash.js +18 -0
- package/weapon/Weapon.d.ts +7 -7
- package/weapon/Weapon.js +276 -0
- package/weapon/WeaponAsset.d.ts +1 -1
- package/weapon/WeaponAsset.js +87 -0
- package/weapon/WeaponCollection.d.ts +3 -2
- package/weapon/WeaponCollection.js +179 -0
- package/weapon/WeaponDisplayNameByHash.d.ts +1 -1
- package/weapon/WeaponDisplayNameByHash.js +73 -0
- package/weapon/WeaponGroup.js +22 -0
- package/weapon/WeaponHudStats.d.ts +1 -1
- package/weapon/WeaponHudStats.js +33 -0
- package/weapon/WeaponLivery.js +17 -0
- package/weapon/WeaponLiveryColor.js +38 -0
- package/weapon/WeaponTint.js +46 -0
- package/weaponComponent/ComponentAttachmentPoint.js +22 -0
- package/weaponComponent/ComponentAttachmentPointByHash.js +307 -0
- package/weaponComponent/ComponentDisplayNameByHash.js +278 -0
- package/weaponComponent/DlcWeaponComponentData.js +40 -0
- package/weaponComponent/InvalidWeaponComponent.d.ts +1 -1
- package/weaponComponent/InvalidWeaponComponent.js +31 -0
- package/weaponComponent/WeaponComponent.d.ts +4 -4
- package/weaponComponent/WeaponComponent.js +124 -0
- package/weaponComponent/WeaponComponentCollection.d.ts +2 -2
- package/weaponComponent/WeaponComponentCollection.js +187 -0
- package/weaponComponent/WeaponComponentHash.js +670 -0
- package/weaponComponent/WeaponComponentHashesByWeaponHash.d.ts +1 -1
- package/weaponComponent/WeaponComponentHashesByWeaponHash.js +864 -0
- package/weaponComponent/WeaponComponentHudStats.js +33 -0
- package/common/index.d.ts +0 -8
- package/common/utils/Vector2.d.ts +0 -1
- package/common/utils/Vector3.d.ts +0 -1
- package/common/utils/Vector4.d.ts +0 -1
- package/common/utils/index.d.ts +0 -12
- package/enums/index.d.ts +0 -42
- package/hashes/index.d.ts +0 -5
- package/index.d.ts +0 -25
- package/models/index.d.ts +0 -18
- package/ui/index.d.ts +0 -15
- package/ui/interfaces/index.d.ts +0 -2
- package/ui/menu/index.d.ts +0 -6
- package/ui/menu/items/index.d.ts +0 -6
- package/ui/menu/items/panels/index.d.ts +0 -6
- package/ui/menu/modules/index.d.ts +0 -1
- package/utils/PointF.d.ts +0 -7
- package/utils/Quaternion.d.ts +0 -10
- package/utils/enumValues.d.ts +0 -12
- package/utils/getStringFromUInt8Array.d.ts +0 -8
- package/utils/getUInt32FromUint8Array.d.ts +0 -8
- package/utils/index.d.ts +0 -9
- package/weapon/index.d.ts +0 -8
- package/weaponComponent/index.d.ts +0 -5
package/Model.js
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
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 { Game } from "./Game";
|
|
5
|
+
import { VehicleHash } from "./hashes/VehicleHash";
|
|
6
|
+
class Model {
|
|
7
|
+
static {
|
|
8
|
+
__name(this, "Model");
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Hash of this model.
|
|
12
|
+
*/
|
|
13
|
+
hash;
|
|
14
|
+
requestedModel = false;
|
|
15
|
+
/**
|
|
16
|
+
* Creates a model object based on the hash key or model string.
|
|
17
|
+
*
|
|
18
|
+
* @param hash A number or string of the model's hash. Example: "mp_m_freemode_01"
|
|
19
|
+
*/
|
|
20
|
+
constructor(hash) {
|
|
21
|
+
if (typeof hash === "string") {
|
|
22
|
+
this.hash = Game.generateHash(hash);
|
|
23
|
+
} else {
|
|
24
|
+
this.hash = hash;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
[Symbol.dispose]() {
|
|
28
|
+
if (this.requestedModel) {
|
|
29
|
+
this.markAsNoLongerNeeded();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Gets the hash of the model.
|
|
34
|
+
*
|
|
35
|
+
* @returns The hash key.
|
|
36
|
+
*/
|
|
37
|
+
get Hash() {
|
|
38
|
+
return this.hash;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Gets if the model is valid or not.
|
|
42
|
+
*
|
|
43
|
+
* @returns Whether this model is valid.
|
|
44
|
+
*/
|
|
45
|
+
get IsValid() {
|
|
46
|
+
return IsModelValid(this.hash);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Gets if the model is in cd image or not.
|
|
50
|
+
*
|
|
51
|
+
* @returns Whether this model is in cd image.
|
|
52
|
+
*/
|
|
53
|
+
get IsInCdImage() {
|
|
54
|
+
return IsModelInCdimage(this.hash);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Gets if the model is loaded or not.
|
|
58
|
+
*
|
|
59
|
+
* @returns Whether this model is loaded.
|
|
60
|
+
*/
|
|
61
|
+
get IsLoaded() {
|
|
62
|
+
return HasModelLoaded(this.hash);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Gets if the model collision is loaded or not.
|
|
66
|
+
*
|
|
67
|
+
* @returns Whether this model collision is loaded.
|
|
68
|
+
*/
|
|
69
|
+
get IsCollisionLoaded() {
|
|
70
|
+
return HasCollisionForModelLoaded(this.hash);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Gets if the model is a bicycle or not.
|
|
74
|
+
*
|
|
75
|
+
* @returns Whether this model is a bicycle.
|
|
76
|
+
*/
|
|
77
|
+
get IsBicycle() {
|
|
78
|
+
return IsThisModelABicycle(this.hash);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Gets if the model is a motorbike or not.
|
|
82
|
+
*
|
|
83
|
+
* @returns Whether this model is a motorbike.
|
|
84
|
+
*/
|
|
85
|
+
get IsBike() {
|
|
86
|
+
return IsThisModelABike(this.hash);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Gets if the model is a boat or not.
|
|
90
|
+
*
|
|
91
|
+
* @returns Whether this model is a boat.
|
|
92
|
+
*/
|
|
93
|
+
get IsBoat() {
|
|
94
|
+
return IsThisModelABoat(this.hash);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Gets if the model is a car or not.
|
|
98
|
+
*
|
|
99
|
+
* @returns Whether this model is a car.
|
|
100
|
+
*/
|
|
101
|
+
get IsCar() {
|
|
102
|
+
return IsThisModelACar(this.hash);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Gets if the model is a cargobob or not.
|
|
106
|
+
*
|
|
107
|
+
* @returns Whether this model is a cargobob.
|
|
108
|
+
*/
|
|
109
|
+
get IsCargobob() {
|
|
110
|
+
return this.hash === VehicleHash.Cargobob || this.hash === VehicleHash.Cargobob2 || this.hash === VehicleHash.Cargobob3 || this.hash === VehicleHash.Cargobob4;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Gets if the model is a helicopter or not.
|
|
114
|
+
*
|
|
115
|
+
* @returns Whether this model is a helicopter.
|
|
116
|
+
*/
|
|
117
|
+
get IsHelicopter() {
|
|
118
|
+
return IsThisModelAHeli(this.hash);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Gets if the model is a Ped or not.
|
|
122
|
+
*
|
|
123
|
+
* @returns Whether this model is a Ped.
|
|
124
|
+
*/
|
|
125
|
+
get IsPed() {
|
|
126
|
+
return IsModelAPed(this.hash);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Gets if the model is a plane or not.
|
|
130
|
+
*
|
|
131
|
+
* @returns Whether this model is a plane.
|
|
132
|
+
*/
|
|
133
|
+
get IsPlane() {
|
|
134
|
+
return IsThisModelAPlane(this.hash);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Gets if the model is a prop or not.
|
|
138
|
+
*
|
|
139
|
+
* @returns Whether this model is a prop.
|
|
140
|
+
*/
|
|
141
|
+
get IsProp() {
|
|
142
|
+
return this.IsValid && !this.IsPed && !this.IsVehicle && !IsWeaponValid(this.hash);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Gets if the model is a quadbike or not.
|
|
146
|
+
*
|
|
147
|
+
* @returns Whether this model is a quadbike.
|
|
148
|
+
*/
|
|
149
|
+
get IsQuadbike() {
|
|
150
|
+
return IsThisModelAQuadbike(this.hash);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Gets if the model is a train or not.
|
|
154
|
+
*
|
|
155
|
+
* @returns Whether this model is a train.
|
|
156
|
+
*/
|
|
157
|
+
get IsTrain() {
|
|
158
|
+
return IsThisModelATrain(this.hash);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Gets if the model is a Vehicle or not.
|
|
162
|
+
*
|
|
163
|
+
* @returns Whether this model is a Vehicle.
|
|
164
|
+
*/
|
|
165
|
+
get IsVehicle() {
|
|
166
|
+
return IsModelAVehicle(this.hash);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Gets the model dimensions.
|
|
170
|
+
*
|
|
171
|
+
* @returns This model min & max dimensions.
|
|
172
|
+
*/
|
|
173
|
+
get Dimensions() {
|
|
174
|
+
const [minArray, maxArray] = GetModelDimensions(this.hash);
|
|
175
|
+
const min = Vector3.fromArray(minArray);
|
|
176
|
+
const max = Vector3.fromArray(maxArray);
|
|
177
|
+
return { min, max };
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Request and load the model with a specified timeout. Default timeout is 1000 (recommended).
|
|
181
|
+
* This function will not automatically set the model as no longer needed when
|
|
182
|
+
* done.
|
|
183
|
+
*
|
|
184
|
+
* @param timeoutMs Maximum allowed time for model to load.
|
|
185
|
+
*/
|
|
186
|
+
async request(timeoutMs = 1e3) {
|
|
187
|
+
if (!this.IsInCdImage && !this.IsValid && !IsWeaponValid(this.hash)) {
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
if (this.IsLoaded) {
|
|
191
|
+
return true;
|
|
192
|
+
}
|
|
193
|
+
RequestModel(this.hash);
|
|
194
|
+
const timeout = GetGameTimer() + timeoutMs;
|
|
195
|
+
while (!this.IsLoaded && GetGameTimer() < timeout) {
|
|
196
|
+
await Wait(0);
|
|
197
|
+
}
|
|
198
|
+
this.requestedModel = true;
|
|
199
|
+
return this.IsLoaded;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Sets the model as no longer needed allowing the game engine to free memory.
|
|
203
|
+
*/
|
|
204
|
+
markAsNoLongerNeeded() {
|
|
205
|
+
SetModelAsNoLongerNeeded(this.hash);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
export {
|
|
209
|
+
Model
|
|
210
|
+
};
|
package/NetworkedScene.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Vector3 } from "./common/utils/Vector";
|
|
2
2
|
import type { BaseEntity } from "./models/BaseEntity";
|
|
3
|
+
import type { Ped } from "./models/Ped";
|
|
3
4
|
export declare class NetworkedScene {
|
|
4
5
|
private scene;
|
|
5
6
|
constructor(pos: Vector3, rot: Vector3, rotationOrder: number, holdLastFrame: boolean, looped: boolean, sceneHash: number, animTime: number, animSpeed: number);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
class NetworkedScene {
|
|
4
|
+
static {
|
|
5
|
+
__name(this, "NetworkedScene");
|
|
6
|
+
}
|
|
7
|
+
scene;
|
|
8
|
+
constructor(pos, rot, rotationOrder, holdLastFrame, looped, sceneHash, animTime, animSpeed) {
|
|
9
|
+
this.scene = NetworkCreateSynchronisedScene(
|
|
10
|
+
pos.x,
|
|
11
|
+
pos.y,
|
|
12
|
+
pos.z,
|
|
13
|
+
rot.x,
|
|
14
|
+
rot.y,
|
|
15
|
+
rot.z,
|
|
16
|
+
rotationOrder,
|
|
17
|
+
holdLastFrame,
|
|
18
|
+
looped,
|
|
19
|
+
sceneHash,
|
|
20
|
+
animTime + 0,
|
|
21
|
+
animSpeed + 0
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
addPed(ped, animDict, animName, blendInSpeed, blendOutSpeed, duration, flag, playbackRate, p9) {
|
|
25
|
+
NetworkAddPedToSynchronisedScene(
|
|
26
|
+
ped.Handle,
|
|
27
|
+
this.scene,
|
|
28
|
+
animDict,
|
|
29
|
+
animName,
|
|
30
|
+
blendInSpeed,
|
|
31
|
+
blendOutSpeed,
|
|
32
|
+
duration,
|
|
33
|
+
flag,
|
|
34
|
+
playbackRate,
|
|
35
|
+
p9
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
addEntity(entity, animDict, animName, speed, speedMultiplier, flag) {
|
|
39
|
+
NetworkAddEntityToSynchronisedScene(entity.Handle, this.scene, animDict, animName, speed, speedMultiplier, flag);
|
|
40
|
+
}
|
|
41
|
+
start() {
|
|
42
|
+
NetworkStartSynchronisedScene(this.scene);
|
|
43
|
+
}
|
|
44
|
+
stop() {
|
|
45
|
+
NetworkStopSynchronisedScene(this.scene);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
NetworkedScene
|
|
50
|
+
};
|
package/ParticleEffect.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { Color } from "./common/utils/Color";
|
|
2
|
+
import { Vector3 } from "./common/utils/Vector";
|
|
3
|
+
import { type InvertAxis } from "./enums/InvertAxis";
|
|
4
|
+
import type { ParticleEffectAsset } from "./ParticleEffectAsset";
|
|
4
5
|
/**
|
|
5
6
|
* UNFINISHED! Class to manage particle effects.
|
|
6
7
|
*/
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { Color } from "./common/utils/Color";
|
|
4
|
+
import { Vector3 } from "./common/utils/Vector";
|
|
5
|
+
import { InvertAxisFlags } from "./enums/InvertAxis";
|
|
6
|
+
class ParticleEffect {
|
|
7
|
+
static {
|
|
8
|
+
__name(this, "ParticleEffect");
|
|
9
|
+
}
|
|
10
|
+
asset;
|
|
11
|
+
effectName;
|
|
12
|
+
offset = new Vector3(0, 0, 0);
|
|
13
|
+
rotation = new Vector3(0, 0, 0);
|
|
14
|
+
color = Color.Transparent;
|
|
15
|
+
scale = 1;
|
|
16
|
+
range = 1;
|
|
17
|
+
invertAxis = { flags: InvertAxisFlags.None };
|
|
18
|
+
handle;
|
|
19
|
+
/**
|
|
20
|
+
* Creates a particle effect.
|
|
21
|
+
*
|
|
22
|
+
* @param asset Particle effect asset.
|
|
23
|
+
* @param effectName Name of effect.
|
|
24
|
+
*/
|
|
25
|
+
constructor(asset, effectName) {
|
|
26
|
+
this.handle = -1;
|
|
27
|
+
this.asset = asset;
|
|
28
|
+
this.effectName = effectName;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Get the particle effect handle.
|
|
32
|
+
*/
|
|
33
|
+
get Handle() {
|
|
34
|
+
return this.handle;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get whether particle effect is currently active.
|
|
38
|
+
*/
|
|
39
|
+
get IsActive() {
|
|
40
|
+
return this.Handle !== -1 && DoesParticleFxLoopedExist(this.Handle);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Stop a particle effect.
|
|
44
|
+
*/
|
|
45
|
+
stop() {
|
|
46
|
+
if (this.IsActive) {
|
|
47
|
+
RemoveParticleFx(this.Handle, false);
|
|
48
|
+
}
|
|
49
|
+
this.handle = -1;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Get the rotation of the particle effect.
|
|
53
|
+
*/
|
|
54
|
+
get Rotation() {
|
|
55
|
+
return this.rotation;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Set the rotation of the particle effect.
|
|
59
|
+
*/
|
|
60
|
+
set Rotation(rotation) {
|
|
61
|
+
this.rotation = rotation;
|
|
62
|
+
if (this.IsActive) {
|
|
63
|
+
const off = this.offset;
|
|
64
|
+
SetParticleFxLoopedOffsets(this.Handle, off.x, off.y, off.z, rotation.x, rotation.y, rotation.z);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Get the range of the particle effect.
|
|
69
|
+
*/
|
|
70
|
+
get Range() {
|
|
71
|
+
return this.range;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Set the range of the particle effect.
|
|
75
|
+
*/
|
|
76
|
+
set Range(range) {
|
|
77
|
+
this.range = range;
|
|
78
|
+
SetParticleFxLoopedRange(this.Handle, range);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Get the invert axis flag of the particle effect.
|
|
82
|
+
*/
|
|
83
|
+
get InvertAxis() {
|
|
84
|
+
return this.invertAxis;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Set the inverted axis of the particle effect.
|
|
88
|
+
*/
|
|
89
|
+
set InvertAxis(invertAxis) {
|
|
90
|
+
this.invertAxis = invertAxis;
|
|
91
|
+
if (this.IsActive) {
|
|
92
|
+
this.stop();
|
|
93
|
+
this.start();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Set a paramaeter of a particle effect.
|
|
98
|
+
*
|
|
99
|
+
* @param parameterName Name of parameter.
|
|
100
|
+
* @param value Value of parameter.
|
|
101
|
+
*/
|
|
102
|
+
setParameter(parameterName, value) {
|
|
103
|
+
if (this.IsActive) {
|
|
104
|
+
SetParticleFxLoopedEvolution(this.Handle, parameterName, value, false);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Get the name of the particle effect asset. Same as ParticleEffect.AssetName.
|
|
109
|
+
*/
|
|
110
|
+
get AssetName() {
|
|
111
|
+
return this.asset.AssetName;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Get the name of the particle effect.
|
|
115
|
+
*/
|
|
116
|
+
get EffectName() {
|
|
117
|
+
return this.effectName;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Return the particle effect as string. `AssetName`\\`EffectName`.
|
|
121
|
+
*/
|
|
122
|
+
toString() {
|
|
123
|
+
return `${this.AssetName}\\${this.EffectName}`;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
export {
|
|
127
|
+
ParticleEffect
|
|
128
|
+
};
|
package/ParticleEffectAsset.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Vector3 } from "./common/utils/Vector";
|
|
2
|
+
import { type InvertAxis } from "./enums/InvertAxis";
|
|
2
3
|
import type { BaseEntity } from "./models/BaseEntity";
|
|
3
|
-
import { Vector3 } from "./utils";
|
|
4
4
|
/**
|
|
5
5
|
* UNFINISHED! Class that represents a particle effect asset.
|
|
6
6
|
*/
|
|
@@ -0,0 +1,133 @@
|
|
|
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 { InvertAxisFlags } from "./enums/InvertAxis";
|
|
5
|
+
class ParticleEffectAsset {
|
|
6
|
+
static {
|
|
7
|
+
__name(this, "ParticleEffectAsset");
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Returns the name of the asset. Same as AssetName.
|
|
11
|
+
*/
|
|
12
|
+
get Asset() {
|
|
13
|
+
return this.assetName;
|
|
14
|
+
}
|
|
15
|
+
assetName;
|
|
16
|
+
constructor(assetName) {
|
|
17
|
+
this.assetName = assetName;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get the name of the particle effect.
|
|
21
|
+
*/
|
|
22
|
+
get AssetName() {
|
|
23
|
+
return this.assetName;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Get whether the particle effect has loaded into game memory.
|
|
27
|
+
*/
|
|
28
|
+
get IsLoaded() {
|
|
29
|
+
return HasNamedPtfxAssetLoaded(this.assetName);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Start a particle effect at a world position.
|
|
33
|
+
*
|
|
34
|
+
* @param effectName Name of effect.
|
|
35
|
+
* @param rot Rotation from entity position.
|
|
36
|
+
* @param scale Size of the effect.
|
|
37
|
+
* @param invertAxis Which axis to invert (default none).
|
|
38
|
+
*/
|
|
39
|
+
startNonLoopedAtCoord(effectName, pos, rot = new Vector3(0, 0, 0), scale = 1, invertAxis = { flags: InvertAxisFlags.None }) {
|
|
40
|
+
if (!this.setNextCall()) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
const invertAxisFlags = invertAxis.flags;
|
|
44
|
+
SetPtfxAssetNextCall(this.assetName);
|
|
45
|
+
return StartParticleFxLoopedAtCoord(
|
|
46
|
+
effectName,
|
|
47
|
+
pos.x,
|
|
48
|
+
pos.y,
|
|
49
|
+
pos.z,
|
|
50
|
+
rot.x,
|
|
51
|
+
rot.y,
|
|
52
|
+
rot.z,
|
|
53
|
+
scale,
|
|
54
|
+
!!(invertAxisFlags & InvertAxisFlags.X),
|
|
55
|
+
!!(invertAxisFlags & InvertAxisFlags.Y),
|
|
56
|
+
!!(invertAxisFlags & InvertAxisFlags.Z),
|
|
57
|
+
false
|
|
58
|
+
) > 0;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Start a particle effect on an entity
|
|
62
|
+
*
|
|
63
|
+
* @param effectName Name of effect.
|
|
64
|
+
* @param entity Entity to use effect on.
|
|
65
|
+
* @param off Offset from entity position.
|
|
66
|
+
* @param rot Rotation from entity position.
|
|
67
|
+
* @param scale Size of the effect.
|
|
68
|
+
* @param invertAxis Which axis to invert (default none).
|
|
69
|
+
*/
|
|
70
|
+
startNonLoopedOnEntity(effectName, entity, off = new Vector3(0, 0, 0), rot = new Vector3(0, 0, 0), scale = 1, invertAxis = { flags: InvertAxisFlags.None }) {
|
|
71
|
+
if (!this.setNextCall()) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
const invertAxisFlags = invertAxis.flags;
|
|
75
|
+
SetPtfxAssetNextCall(this.assetName);
|
|
76
|
+
return !!StartParticleFxLoopedOnEntity(
|
|
77
|
+
effectName,
|
|
78
|
+
entity.Handle,
|
|
79
|
+
off.x,
|
|
80
|
+
off.y,
|
|
81
|
+
off.z,
|
|
82
|
+
rot.x,
|
|
83
|
+
rot.y,
|
|
84
|
+
rot.z,
|
|
85
|
+
scale,
|
|
86
|
+
!!(invertAxisFlags & InvertAxisFlags.X),
|
|
87
|
+
!!(invertAxisFlags & InvertAxisFlags.Y),
|
|
88
|
+
!!(invertAxisFlags & InvertAxisFlags.Z)
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Load a particle effect into the game memory.
|
|
93
|
+
*
|
|
94
|
+
* @param timeout Max time to load Particle Effect
|
|
95
|
+
*/
|
|
96
|
+
request(timeout) {
|
|
97
|
+
return new Promise((resolve) => {
|
|
98
|
+
if (!this.IsLoaded) {
|
|
99
|
+
RequestNamedPtfxAsset(this.assetName);
|
|
100
|
+
const start = GetGameTimer();
|
|
101
|
+
const interval = setInterval(() => {
|
|
102
|
+
if (this.IsLoaded || GetGameTimer() - start >= timeout) {
|
|
103
|
+
clearInterval(interval);
|
|
104
|
+
resolve(this.IsLoaded);
|
|
105
|
+
}
|
|
106
|
+
}, 0);
|
|
107
|
+
} else {
|
|
108
|
+
resolve(this.IsLoaded);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Allow game engine to safely unload particle effect model from memory.
|
|
114
|
+
*/
|
|
115
|
+
markAsNoLongerNeeded() {
|
|
116
|
+
RemoveNamedPtfxAsset(this.assetName);
|
|
117
|
+
}
|
|
118
|
+
toString() {
|
|
119
|
+
return this.assetName;
|
|
120
|
+
}
|
|
121
|
+
setNextCall() {
|
|
122
|
+
if (!this.IsLoaded) {
|
|
123
|
+
RequestNamedPtfxAsset(this.assetName);
|
|
124
|
+
} else {
|
|
125
|
+
SetPtfxAssetNextCall(this.assetName);
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
export {
|
|
132
|
+
ParticleEffectAsset
|
|
133
|
+
};
|
package/Pickup.d.ts
CHANGED
package/Pickup.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
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 Pickup {
|
|
5
|
+
static {
|
|
6
|
+
__name(this, "Pickup");
|
|
7
|
+
}
|
|
8
|
+
handle;
|
|
9
|
+
constructor(handle) {
|
|
10
|
+
this.handle = handle;
|
|
11
|
+
}
|
|
12
|
+
get Position() {
|
|
13
|
+
return Vector3.fromArray(GetPickupCoords(this.handle));
|
|
14
|
+
}
|
|
15
|
+
get IsCollected() {
|
|
16
|
+
return HasPickupBeenCollected(this.handle);
|
|
17
|
+
}
|
|
18
|
+
delete() {
|
|
19
|
+
RemovePickup(this.handle);
|
|
20
|
+
}
|
|
21
|
+
exists() {
|
|
22
|
+
return DoesPickupExist(this.handle);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
Pickup
|
|
27
|
+
};
|
package/Raycast.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
1
|
+
import { Vector3 } from "./common/utils/Vector";
|
|
2
|
+
import type { MaterialHash } from "./hashes/MaterialHash";
|
|
3
|
+
import type { Ped } from "./models/Ped";
|
|
4
|
+
import type { Prop } from "./models/Prop";
|
|
5
|
+
import type { Vehicle } from "./models/Vehicle";
|
|
4
6
|
/**
|
|
5
7
|
* Class that represents the result of a raycast.
|
|
6
8
|
*/
|