@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.
- package/Audio.d.ts +2 -2
- package/Blip.d.ts +2 -2
- package/Camera.d.ts +1 -1
- package/Game.d.ts +1 -1
- package/GameplayCamera.d.ts +1 -1
- package/Model.d.ts +1 -1
- package/ParticleEffect.d.ts +2 -2
- package/ParticleEffectAsset.d.ts +1 -1
- package/README.md +45 -0
- package/Raycast.d.ts +2 -2
- package/RelationshipGroup.d.ts +1 -1
- package/Tasks.d.ts +3 -3
- package/World.d.ts +2 -2
- package/cfx/StateBagChangeHandler.d.ts +1 -3
- package/common/Command.d.ts +30 -0
- package/common/Convar.d.ts +13 -0
- package/common/GlobalData.d.ts +8 -0
- package/common/Kvp.d.ts +69 -0
- package/common/Resource.d.ts +14 -0
- package/common/decors/Events.d.ts +54 -0
- package/common/index.d.ts +8 -0
- package/common/net/NetworkedMap.d.ts +28 -0
- package/common/types.d.ts +5 -0
- package/common/utils/ClassTypes.d.ts +11 -0
- package/common/utils/Color.d.ts +14 -0
- package/common/utils/Maths.d.ts +4 -0
- package/common/utils/PointF.d.ts +12 -0
- package/common/utils/Quaternion.d.ts +10 -0
- package/common/utils/Vector.d.ts +429 -0
- package/common/utils/Vector2.d.ts +1 -0
- package/common/utils/Vector3.d.ts +1 -0
- package/common/utils/Vector4.d.ts +1 -0
- package/common/utils/cleanPlayerName.d.ts +6 -0
- package/common/utils/enumValues.d.ts +12 -0
- package/{utils/getStringFromUInt8Array.js → common/utils/getStringFromUInt8Array.d.ts} +1 -3
- package/{utils/getUInt32FromUint8Array.js → common/utils/getUInt32FromUint8Array.d.ts} +1 -1
- package/common/utils/index.d.ts +12 -0
- package/index.d.ts +1 -1
- package/index.js +20136 -26
- package/interfaces/Dimensions.d.ts +1 -1
- package/models/BaseEntity.d.ts +3 -3
- package/models/Ped.d.ts +2 -2
- package/models/PedBone.d.ts +1 -1
- package/models/PedBoneCollection.d.ts +1 -1
- package/models/Player.d.ts +1 -1
- package/models/Vehicle.d.ts +2 -2
- package/models/VehicleDoor.d.ts +2 -2
- package/models/VehicleDoorCollection.d.ts +1 -1
- package/models/VehicleMod.d.ts +2 -2
- package/models/VehicleModCollection.d.ts +2 -2
- package/models/VehicleToggleMod.d.ts +2 -2
- package/models/VehicleWheel.d.ts +1 -1
- package/models/VehicleWheelCollection.d.ts +1 -1
- package/models/VehicleWindow.d.ts +2 -2
- package/models/VehicleWindowCollection.d.ts +1 -1
- package/package.json +6 -4
- package/ui/Container.d.ts +2 -2
- package/ui/Effects.d.ts +1 -1
- package/ui/Hud.d.ts +2 -2
- package/ui/InstructionalButtons.d.ts +1 -1
- package/ui/Rectangle.d.ts +2 -2
- package/ui/Scaleform.d.ts +1 -1
- package/ui/Screen.d.ts +1 -1
- package/ui/Text.d.ts +1 -1
- package/ui/interfaces/IButton.d.ts +1 -1
- package/ui/interfaces/IDrawable.d.ts +1 -1
- package/ui/menu/items/UIMenuItem.d.ts +1 -1
- package/ui/menu/items/UIMenuListItem.d.ts +1 -1
- package/ui/menu/items/panels/AbstractUIMenuPanel.d.ts +2 -2
- package/ui/menu/items/panels/UIMenuStatisticsPanel.d.ts +1 -1
- package/utils/LiteEvent.d.ts +2 -6
- package/utils/index.d.ts +1 -1
- package/weapon/DlcWeaponData.d.ts +1 -1
- package/weapon/Weapon.d.ts +7 -7
- package/weapon/WeaponAsset.d.ts +1 -1
- package/weapon/WeaponCollection.d.ts +2 -2
- package/weaponComponent/DlcWeaponComponentData.d.ts +1 -1
- package/weaponComponent/InvalidWeaponComponent.d.ts +1 -1
- package/weaponComponent/WeaponComponent.d.ts +3 -3
- package/weaponComponent/WeaponComponentCollection.d.ts +3 -3
- package/Audio.js +0 -93
- package/Blip.js +0 -105
- package/Camera.js +0 -162
- package/Checkpoint.js +0 -43
- package/Events.js +0 -74
- package/Game.js +0 -474
- package/GameplayCamera.js +0 -141
- package/Model.js +0 -213
- package/NetworkedScene.js +0 -18
- package/ParticleEffect.js +0 -123
- package/ParticleEffectAsset.js +0 -105
- package/Pickup.js +0 -19
- package/Raycast.js +0 -123
- package/RelationshipGroup.js +0 -67
- package/Rope.js +0 -129
- package/TaskSequence.js +0 -48
- package/Tasks.js +0 -241
- package/World.js +0 -765
- package/cfx/StateBagChangeHandler.js +0 -1
- package/cfx/index.js +0 -1
- package/enums/Alignment.js +0 -6
- package/enums/AnimationFlags.js +0 -35
- package/enums/AudioFlag.js +0 -38
- package/enums/BadgeStyle.js +0 -183
- package/enums/Blip.js +0 -225
- package/enums/Bone.js +0 -103
- package/enums/CameraShake.js +0 -14
- package/enums/CameraTypes.js +0 -8
- package/enums/CheckboxStyle.js +0 -5
- package/enums/Checkpoint.js +0 -67
- package/enums/CloudHat.js +0 -27
- package/enums/Control.js +0 -361
- package/enums/CursorSprite.js +0 -15
- package/enums/Driving.js +0 -34
- package/enums/ExplosionType.js +0 -45
- package/enums/FiringPattern.js +0 -20
- package/enums/Font.js +0 -8
- package/enums/ForceType.js +0 -9
- package/enums/Gender.js +0 -5
- package/enums/HelmetType.js +0 -6
- package/enums/HudColor.js +0 -184
- package/enums/HudComponent.js +0 -54
- package/enums/InputMode.js +0 -5
- package/enums/InvertAxis.js +0 -7
- package/enums/Language.js +0 -15
- package/enums/LeaveVehicleFlags.js +0 -11
- package/enums/LoadingSpinnerType.js +0 -8
- package/enums/MarkerType.js +0 -50
- package/enums/MenuAlignment.js +0 -5
- package/enums/NotificationType.js +0 -11
- package/enums/Parachute.js +0 -15
- package/enums/PickupType.js +0 -74
- package/enums/RadioStation.js +0 -25
- package/enums/RagdollType.js +0 -7
- package/enums/RaycastEnums.js +0 -32
- package/enums/Relationship.js +0 -10
- package/enums/RopeType.js +0 -6
- package/enums/ScreenEffect.js +0 -84
- package/enums/SpeechModifier.js +0 -40
- package/enums/Vehicle.js +0 -376
- package/enums/Weather.js +0 -22
- package/enums/ZoneID.js +0 -95
- package/enums/index.js +0 -42
- package/hashes/MaterialHash.js +0 -217
- package/hashes/PedHash.js +0 -725
- package/hashes/VehicleHash.js +0 -523
- package/hashes/WeaponHash.js +0 -161
- package/hashes/WeatherTypeHash.js +0 -22
- package/hashes/index.js +0 -5
- package/interfaces/Dimensions.js +0 -1
- package/models/BaseEntity.js +0 -477
- package/models/Entity.js +0 -25
- package/models/EntityBone.js +0 -26
- package/models/EntityBoneCollection.js +0 -18
- package/models/Ped.js +0 -692
- package/models/PedBone.js +0 -9
- package/models/PedBoneCollection.js +0 -21
- package/models/Player.js +0 -186
- package/models/Prop.js +0 -26
- package/models/Vehicle.js +0 -576
- package/models/VehicleDoor.js +0 -44
- package/models/VehicleDoorCollection.js +0 -62
- package/models/VehicleMod.js +0 -35
- package/models/VehicleModCollection.js +0 -227
- package/models/VehicleToggleMod.js +0 -29
- package/models/VehicleWheel.js +0 -23
- package/models/VehicleWheelCollection.js +0 -57
- package/models/VehicleWindow.js +0 -35
- package/models/VehicleWindowCollection.js +0 -57
- package/models/index.js +0 -19
- package/ui/Container.js +0 -31
- package/ui/Effects.js +0 -106
- package/ui/Fading.js +0 -69
- package/ui/Hud.js +0 -39
- package/ui/InstructionalButtons.js +0 -54
- package/ui/LoadingPrompt.js +0 -45
- package/ui/Notification.js +0 -9
- package/ui/Rectangle.js +0 -40
- package/ui/Scaleform.js +0 -236
- package/ui/Screen.js +0 -72
- package/ui/Sprite.js +0 -60
- package/ui/Text.js +0 -115
- package/ui/Timerbar.js +0 -248
- package/ui/index.js +0 -15
- package/ui/interfaces/IButton.js +0 -1
- package/ui/interfaces/IDrawable.js +0 -1
- package/ui/interfaces/index.js +0 -1
- package/ui/menu/Menu.js +0 -831
- package/ui/menu/MenuControl.js +0 -12
- package/ui/menu/MenuControls.js +0 -9
- package/ui/menu/MenuSettings.js +0 -54
- package/ui/menu/index.js +0 -6
- package/ui/menu/items/UIMenuCheckboxItem.js +0 -59
- package/ui/menu/items/UIMenuItem.js +0 -1111
- package/ui/menu/items/UIMenuListItem.js +0 -119
- package/ui/menu/items/UIMenuSeparatorItem.js +0 -29
- package/ui/menu/items/UIMenuSliderItem.js +0 -191
- package/ui/menu/items/index.js +0 -6
- package/ui/menu/items/panels/AbstractUIMenuPanel.js +0 -44
- package/ui/menu/items/panels/UIMenuColorPanel.js +0 -217
- package/ui/menu/items/panels/UIMenuGridPanel.js +0 -261
- package/ui/menu/items/panels/UIMenuPercentagePanel.js +0 -124
- package/ui/menu/items/panels/UIMenuStatisticsPanel.js +0 -79
- package/ui/menu/items/panels/UIMenuStatisticsPanelItem.js +0 -35
- package/ui/menu/items/panels/index.js +0 -6
- package/ui/menu/modules/ListItem.js +0 -10
- package/ui/menu/modules/index.js +0 -1
- package/utils/Animations.js +0 -55
- package/utils/Crypto.js +0 -25
- package/utils/LiteEvent.js +0 -19
- package/utils/Maths.js +0 -10
- package/utils/Point.js +0 -30
- package/utils/PointF.js +0 -14
- package/utils/Quaternion.js +0 -27
- package/utils/Size.js +0 -8
- package/utils/String.js +0 -25
- package/utils/enumValues.js +0 -14
- package/utils/index.js +0 -9
- package/weapon/DlcWeaponData.js +0 -44
- package/weapon/Mk2WeaponHash.js +0 -25
- package/weapon/Weapon.js +0 -270
- package/weapon/WeaponAsset.js +0 -84
- package/weapon/WeaponCollection.js +0 -187
- package/weapon/WeaponDisplayNameByHash.js +0 -75
- package/weapon/WeaponGroup.js +0 -19
- package/weapon/WeaponHudStats.js +0 -38
- package/weapon/WeaponLivery.js +0 -14
- package/weapon/WeaponLiveryColor.js +0 -35
- package/weapon/WeaponTint.js +0 -43
- package/weapon/index.js +0 -8
- package/weaponComponent/ComponentAttachmentPoint.js +0 -19
- package/weaponComponent/ComponentAttachmentPointByHash.js +0 -573
- package/weaponComponent/ComponentDisplayNameByHash.js +0 -280
- package/weaponComponent/DlcWeaponComponentData.js +0 -44
- package/weaponComponent/InvalidWeaponComponent.js +0 -28
- package/weaponComponent/WeaponComponent.js +0 -123
- package/weaponComponent/WeaponComponentCollection.js +0 -174
- package/weaponComponent/WeaponComponentHash.js +0 -887
- package/weaponComponent/WeaponComponentHashesByWeaponHash.js +0 -829
- package/weaponComponent/WeaponComponentHudStats.js +0 -34
- package/weaponComponent/index.js +0 -5
package/Model.js
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import { Game } from "./Game";
|
|
2
|
-
import { VehicleHash } from "./hashes";
|
|
3
|
-
import { Vector3, Wait } from "./utils";
|
|
4
|
-
/**
|
|
5
|
-
* Class to create and manage entity models.
|
|
6
|
-
*/
|
|
7
|
-
export class Model {
|
|
8
|
-
/**
|
|
9
|
-
* Hash of this model.
|
|
10
|
-
*/
|
|
11
|
-
hash;
|
|
12
|
-
requestedModel = false;
|
|
13
|
-
/**
|
|
14
|
-
* Creates a model object based on the hash key or model string.
|
|
15
|
-
*
|
|
16
|
-
* @param hash A number or string of the model's hash. Example: "mp_m_freemode_01"
|
|
17
|
-
*/
|
|
18
|
-
constructor(hash) {
|
|
19
|
-
if (typeof hash === "string") {
|
|
20
|
-
this.hash = Game.generateHash(hash);
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
this.hash = hash;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
[Symbol.dispose]() {
|
|
27
|
-
if (this.requestedModel) {
|
|
28
|
-
this.markAsNoLongerNeeded();
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Gets the hash of the model.
|
|
33
|
-
*
|
|
34
|
-
* @returns The hash key.
|
|
35
|
-
*/
|
|
36
|
-
get Hash() {
|
|
37
|
-
return this.hash;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Gets if the model is valid or not.
|
|
41
|
-
*
|
|
42
|
-
* @returns Whether this model is valid.
|
|
43
|
-
*/
|
|
44
|
-
get IsValid() {
|
|
45
|
-
return IsModelValid(this.hash);
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Gets if the model is in cd image or not.
|
|
49
|
-
*
|
|
50
|
-
* @returns Whether this model is in cd image.
|
|
51
|
-
*/
|
|
52
|
-
get IsInCdImage() {
|
|
53
|
-
return IsModelInCdimage(this.hash);
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Gets if the model is loaded or not.
|
|
57
|
-
*
|
|
58
|
-
* @returns Whether this model is loaded.
|
|
59
|
-
*/
|
|
60
|
-
get IsLoaded() {
|
|
61
|
-
return HasModelLoaded(this.hash);
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Gets if the model collision is loaded or not.
|
|
65
|
-
*
|
|
66
|
-
* @returns Whether this model collision is loaded.
|
|
67
|
-
*/
|
|
68
|
-
get IsCollisionLoaded() {
|
|
69
|
-
return HasCollisionForModelLoaded(this.hash);
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Gets if the model is a bicycle or not.
|
|
73
|
-
*
|
|
74
|
-
* @returns Whether this model is a bicycle.
|
|
75
|
-
*/
|
|
76
|
-
get IsBicycle() {
|
|
77
|
-
return IsThisModelABicycle(this.hash);
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Gets if the model is a motorbike or not.
|
|
81
|
-
*
|
|
82
|
-
* @returns Whether this model is a motorbike.
|
|
83
|
-
*/
|
|
84
|
-
get IsBike() {
|
|
85
|
-
return IsThisModelABike(this.hash);
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Gets if the model is a boat or not.
|
|
89
|
-
*
|
|
90
|
-
* @returns Whether this model is a boat.
|
|
91
|
-
*/
|
|
92
|
-
get IsBoat() {
|
|
93
|
-
return IsThisModelABoat(this.hash);
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Gets if the model is a car or not.
|
|
97
|
-
*
|
|
98
|
-
* @returns Whether this model is a car.
|
|
99
|
-
*/
|
|
100
|
-
get IsCar() {
|
|
101
|
-
return IsThisModelACar(this.hash);
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Gets if the model is a cargobob or not.
|
|
105
|
-
*
|
|
106
|
-
* @returns Whether this model is a cargobob.
|
|
107
|
-
*/
|
|
108
|
-
get IsCargobob() {
|
|
109
|
-
return (this.hash === VehicleHash.Cargobob ||
|
|
110
|
-
this.hash === VehicleHash.Cargobob2 ||
|
|
111
|
-
this.hash === VehicleHash.Cargobob3 ||
|
|
112
|
-
this.hash === VehicleHash.Cargobob4);
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Gets if the model is a helicopter or not.
|
|
116
|
-
*
|
|
117
|
-
* @returns Whether this model is a helicopter.
|
|
118
|
-
*/
|
|
119
|
-
get IsHelicopter() {
|
|
120
|
-
return IsThisModelAHeli(this.hash);
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Gets if the model is a Ped or not.
|
|
124
|
-
*
|
|
125
|
-
* @returns Whether this model is a Ped.
|
|
126
|
-
*/
|
|
127
|
-
get IsPed() {
|
|
128
|
-
return IsModelAPed(this.hash);
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Gets if the model is a plane or not.
|
|
132
|
-
*
|
|
133
|
-
* @returns Whether this model is a plane.
|
|
134
|
-
*/
|
|
135
|
-
get IsPlane() {
|
|
136
|
-
return IsThisModelAPlane(this.hash);
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Gets if the model is a prop or not.
|
|
140
|
-
*
|
|
141
|
-
* @returns Whether this model is a prop.
|
|
142
|
-
*/
|
|
143
|
-
get IsProp() {
|
|
144
|
-
return (this.IsValid &&
|
|
145
|
-
!this.IsPed &&
|
|
146
|
-
!this.IsVehicle &&
|
|
147
|
-
!IsWeaponValid(this.hash));
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Gets if the model is a quadbike or not.
|
|
151
|
-
*
|
|
152
|
-
* @returns Whether this model is a quadbike.
|
|
153
|
-
*/
|
|
154
|
-
get IsQuadbike() {
|
|
155
|
-
return IsThisModelAQuadbike(this.hash);
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Gets if the model is a train or not.
|
|
159
|
-
*
|
|
160
|
-
* @returns Whether this model is a train.
|
|
161
|
-
*/
|
|
162
|
-
get IsTrain() {
|
|
163
|
-
return IsThisModelATrain(this.hash);
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Gets if the model is a Vehicle or not.
|
|
167
|
-
*
|
|
168
|
-
* @returns Whether this model is a Vehicle.
|
|
169
|
-
*/
|
|
170
|
-
get IsVehicle() {
|
|
171
|
-
return IsModelAVehicle(this.hash);
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Gets the model dimensions.
|
|
175
|
-
*
|
|
176
|
-
* @returns This model min & max dimensions.
|
|
177
|
-
*/
|
|
178
|
-
get Dimensions() {
|
|
179
|
-
const [minArray, maxArray] = GetModelDimensions(this.hash);
|
|
180
|
-
const min = Vector3.fromArray(minArray);
|
|
181
|
-
const max = Vector3.fromArray(maxArray);
|
|
182
|
-
return { min, max };
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Request and load the model with a specified timeout. Default timeout is 1000 (recommended).
|
|
186
|
-
* This function will not automatically set the model as no longer needed when
|
|
187
|
-
* done.
|
|
188
|
-
*
|
|
189
|
-
* @param timeoutMs Maximum allowed time for model to load.
|
|
190
|
-
*/
|
|
191
|
-
async request(timeoutMs = 1000) {
|
|
192
|
-
if (!this.IsInCdImage && !this.IsValid && !IsWeaponValid(this.hash)) {
|
|
193
|
-
return false;
|
|
194
|
-
}
|
|
195
|
-
// pre-check so if its already loaded we don't add another ref
|
|
196
|
-
if (this.IsLoaded) {
|
|
197
|
-
return true;
|
|
198
|
-
}
|
|
199
|
-
RequestModel(this.hash);
|
|
200
|
-
const timeout = GetGameTimer() + timeoutMs;
|
|
201
|
-
while (!this.IsLoaded && GetGameTimer() < timeout) {
|
|
202
|
-
await Wait(0);
|
|
203
|
-
}
|
|
204
|
-
this.requestedModel = true;
|
|
205
|
-
return this.IsLoaded;
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Sets the model as no longer needed allowing the game engine to free memory.
|
|
209
|
-
*/
|
|
210
|
-
markAsNoLongerNeeded() {
|
|
211
|
-
SetModelAsNoLongerNeeded(this.hash);
|
|
212
|
-
}
|
|
213
|
-
}
|
package/NetworkedScene.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export class NetworkedScene {
|
|
2
|
-
scene;
|
|
3
|
-
constructor(pos, rot, rotationOrder, holdLastFrame, looped, sceneHash, animTime, animSpeed) {
|
|
4
|
-
this.scene = NetworkCreateSynchronisedScene(pos.x, pos.y, pos.z, rot.x, rot.y, rot.z, rotationOrder, holdLastFrame, looped, sceneHash, animTime + 0.0, animSpeed + 0.0);
|
|
5
|
-
}
|
|
6
|
-
addPed(ped, animDict, animName, blendInSpeed, blendOutSpeed, duration, flag, playbackRate, p9) {
|
|
7
|
-
NetworkAddPedToSynchronisedScene(ped.Handle, this.scene, animDict, animName, blendInSpeed, blendOutSpeed, duration, flag, playbackRate, p9);
|
|
8
|
-
}
|
|
9
|
-
addEntity(entity, animDict, animName, speed, speedMultiplier, flag) {
|
|
10
|
-
NetworkAddEntityToSynchronisedScene(entity.Handle, this.scene, animDict, animName, speed, speedMultiplier, flag);
|
|
11
|
-
}
|
|
12
|
-
start() {
|
|
13
|
-
NetworkStartSynchronisedScene(this.scene);
|
|
14
|
-
}
|
|
15
|
-
stop() {
|
|
16
|
-
NetworkStopSynchronisedScene(this.scene);
|
|
17
|
-
}
|
|
18
|
-
}
|
package/ParticleEffect.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { InvertAxisFlags } from "./enums";
|
|
2
|
-
import { Color, Vector3 } from "./utils";
|
|
3
|
-
// TODO: Lots of Matrix stuff through memory access
|
|
4
|
-
/**
|
|
5
|
-
* UNFINISHED! Class to manage particle effects.
|
|
6
|
-
*/
|
|
7
|
-
export class ParticleEffect {
|
|
8
|
-
asset;
|
|
9
|
-
effectName;
|
|
10
|
-
offset = new Vector3(0, 0, 0);
|
|
11
|
-
rotation = new Vector3(0, 0, 0);
|
|
12
|
-
color = Color.Transparent;
|
|
13
|
-
scale = 1.0;
|
|
14
|
-
range = 1.0;
|
|
15
|
-
invertAxis = { flags: InvertAxisFlags.None };
|
|
16
|
-
handle;
|
|
17
|
-
/**
|
|
18
|
-
* Creates a particle effect.
|
|
19
|
-
*
|
|
20
|
-
* @param asset Particle effect asset.
|
|
21
|
-
* @param effectName Name of effect.
|
|
22
|
-
*/
|
|
23
|
-
constructor(asset, effectName) {
|
|
24
|
-
this.handle = -1;
|
|
25
|
-
this.asset = asset;
|
|
26
|
-
this.effectName = effectName;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Get the particle effect handle.
|
|
30
|
-
*/
|
|
31
|
-
get Handle() {
|
|
32
|
-
return this.handle;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Get whether particle effect is currently active.
|
|
36
|
-
*/
|
|
37
|
-
get IsActive() {
|
|
38
|
-
return this.Handle !== -1 && DoesParticleFxLoopedExist(this.Handle);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Stop a particle effect.
|
|
42
|
-
*/
|
|
43
|
-
stop() {
|
|
44
|
-
if (this.IsActive) {
|
|
45
|
-
RemoveParticleFx(this.Handle, false);
|
|
46
|
-
}
|
|
47
|
-
this.handle = -1;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Get the rotation of the particle effect.
|
|
51
|
-
*/
|
|
52
|
-
get Rotation() {
|
|
53
|
-
return this.rotation;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Set the rotation of the particle effect.
|
|
57
|
-
*/
|
|
58
|
-
set Rotation(rotation) {
|
|
59
|
-
this.rotation = rotation;
|
|
60
|
-
if (this.IsActive) {
|
|
61
|
-
const off = this.offset; // TODO Matrix stuff to access from memory
|
|
62
|
-
SetParticleFxLoopedOffsets(this.Handle, off.x, off.y, off.z, rotation.x, rotation.y, rotation.z);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Get the range of the particle effect.
|
|
67
|
-
*/
|
|
68
|
-
get Range() {
|
|
69
|
-
return this.range;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Set the range of the particle effect.
|
|
73
|
-
*/
|
|
74
|
-
set Range(range) {
|
|
75
|
-
this.range = range;
|
|
76
|
-
SetParticleFxLoopedRange(this.Handle, range);
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Get the invert axis flag of the particle effect.
|
|
80
|
-
*/
|
|
81
|
-
get InvertAxis() {
|
|
82
|
-
return this.invertAxis;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Set the inverted axis of the particle effect.
|
|
86
|
-
*/
|
|
87
|
-
set InvertAxis(invertAxis) {
|
|
88
|
-
this.invertAxis = invertAxis;
|
|
89
|
-
if (this.IsActive) {
|
|
90
|
-
this.stop();
|
|
91
|
-
this.start();
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Set a paramaeter of a particle effect.
|
|
96
|
-
*
|
|
97
|
-
* @param parameterName Name of parameter.
|
|
98
|
-
* @param value Value of parameter.
|
|
99
|
-
*/
|
|
100
|
-
setParameter(parameterName, value) {
|
|
101
|
-
if (this.IsActive) {
|
|
102
|
-
SetParticleFxLoopedEvolution(this.Handle, parameterName, value, false);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Get the name of the particle effect asset. Same as ParticleEffect.AssetName.
|
|
107
|
-
*/
|
|
108
|
-
get AssetName() {
|
|
109
|
-
return this.asset.AssetName;
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Get the name of the particle effect.
|
|
113
|
-
*/
|
|
114
|
-
get EffectName() {
|
|
115
|
-
return this.effectName;
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Return the particle effect as string. `AssetName`\\`EffectName`.
|
|
119
|
-
*/
|
|
120
|
-
toString() {
|
|
121
|
-
return `${this.AssetName}\\${this.EffectName}`;
|
|
122
|
-
}
|
|
123
|
-
}
|
package/ParticleEffectAsset.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { InvertAxisFlags } from "./enums";
|
|
2
|
-
import { Vector3 } from "./utils";
|
|
3
|
-
/**
|
|
4
|
-
* UNFINISHED! Class that represents a particle effect asset.
|
|
5
|
-
*/
|
|
6
|
-
export class ParticleEffectAsset {
|
|
7
|
-
/**
|
|
8
|
-
* Returns the name of the asset. Same as AssetName.
|
|
9
|
-
*/
|
|
10
|
-
get Asset() {
|
|
11
|
-
return this.assetName;
|
|
12
|
-
}
|
|
13
|
-
assetName;
|
|
14
|
-
constructor(assetName) {
|
|
15
|
-
this.assetName = assetName;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Get the name of the particle effect.
|
|
19
|
-
*/
|
|
20
|
-
get AssetName() {
|
|
21
|
-
return this.assetName;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Get whether the particle effect has loaded into game memory.
|
|
25
|
-
*/
|
|
26
|
-
get IsLoaded() {
|
|
27
|
-
return HasNamedPtfxAssetLoaded(this.assetName);
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Start a particle effect at a world position.
|
|
31
|
-
*
|
|
32
|
-
* @param effectName Name of effect.
|
|
33
|
-
* @param rot Rotation from entity position.
|
|
34
|
-
* @param scale Size of the effect.
|
|
35
|
-
* @param invertAxis Which axis to invert (default none).
|
|
36
|
-
*/
|
|
37
|
-
startNonLoopedAtCoord(effectName, pos, rot = new Vector3(0, 0, 0), scale = 1.0, invertAxis = { flags: InvertAxisFlags.None }) {
|
|
38
|
-
if (!this.setNextCall()) {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
const invertAxisFlags = invertAxis.flags;
|
|
42
|
-
SetPtfxAssetNextCall(this.assetName);
|
|
43
|
-
return (StartParticleFxLoopedAtCoord(effectName, pos.x, pos.y, pos.z, rot.x, rot.y, rot.z, scale, !!(invertAxisFlags & InvertAxisFlags.X), !!(invertAxisFlags & InvertAxisFlags.Y), !!(invertAxisFlags & InvertAxisFlags.Z), false) > 0);
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Start a particle effect on an entity
|
|
47
|
-
*
|
|
48
|
-
* @param effectName Name of effect.
|
|
49
|
-
* @param entity Entity to use effect on.
|
|
50
|
-
* @param off Offset from entity position.
|
|
51
|
-
* @param rot Rotation from entity position.
|
|
52
|
-
* @param scale Size of the effect.
|
|
53
|
-
* @param invertAxis Which axis to invert (default none).
|
|
54
|
-
*/
|
|
55
|
-
startNonLoopedOnEntity(effectName, entity, off = new Vector3(0, 0, 0), rot = new Vector3(0, 0, 0), scale = 1.0, invertAxis = { flags: InvertAxisFlags.None }) {
|
|
56
|
-
if (!this.setNextCall()) {
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
const invertAxisFlags = invertAxis.flags;
|
|
60
|
-
SetPtfxAssetNextCall(this.assetName);
|
|
61
|
-
// This still returns
|
|
62
|
-
return !!StartParticleFxLoopedOnEntity(effectName, entity.Handle, off.x, off.y, off.z, rot.x, rot.y, rot.z, scale, !!(invertAxisFlags & InvertAxisFlags.X), !!(invertAxisFlags & InvertAxisFlags.Y), !!(invertAxisFlags & InvertAxisFlags.Z));
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Load a particle effect into the game memory.
|
|
66
|
-
*
|
|
67
|
-
* @param timeout Max time to load Particle Effect
|
|
68
|
-
*/
|
|
69
|
-
request(timeout) {
|
|
70
|
-
return new Promise((resolve) => {
|
|
71
|
-
if (!this.IsLoaded) {
|
|
72
|
-
RequestNamedPtfxAsset(this.assetName);
|
|
73
|
-
const start = GetGameTimer();
|
|
74
|
-
const interval = setInterval(() => {
|
|
75
|
-
if (this.IsLoaded || GetGameTimer() - start >= timeout) {
|
|
76
|
-
clearInterval(interval);
|
|
77
|
-
resolve(this.IsLoaded);
|
|
78
|
-
}
|
|
79
|
-
}, 0);
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
resolve(this.IsLoaded);
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Allow game engine to safely unload particle effect model from memory.
|
|
88
|
-
*/
|
|
89
|
-
markAsNoLongerNeeded() {
|
|
90
|
-
RemoveNamedPtfxAsset(this.assetName);
|
|
91
|
-
}
|
|
92
|
-
toString() {
|
|
93
|
-
return this.assetName;
|
|
94
|
-
}
|
|
95
|
-
setNextCall() {
|
|
96
|
-
if (!this.IsLoaded) {
|
|
97
|
-
RequestNamedPtfxAsset(this.assetName);
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
SetPtfxAssetNextCall(this.assetName);
|
|
101
|
-
return true;
|
|
102
|
-
}
|
|
103
|
-
return false;
|
|
104
|
-
}
|
|
105
|
-
}
|
package/Pickup.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Vector3 } from "./utils";
|
|
2
|
-
export class Pickup {
|
|
3
|
-
handle;
|
|
4
|
-
constructor(handle) {
|
|
5
|
-
this.handle = handle;
|
|
6
|
-
}
|
|
7
|
-
get Position() {
|
|
8
|
-
return Vector3.fromArray(GetPickupCoords(this.handle));
|
|
9
|
-
}
|
|
10
|
-
get IsCollected() {
|
|
11
|
-
return HasPickupBeenCollected(this.handle);
|
|
12
|
-
}
|
|
13
|
-
delete() {
|
|
14
|
-
RemovePickup(this.handle);
|
|
15
|
-
}
|
|
16
|
-
exists() {
|
|
17
|
-
return DoesPickupExist(this.handle);
|
|
18
|
-
}
|
|
19
|
-
}
|
package/Raycast.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { ShapeTestStatus } from "./enums/RaycastEnums";
|
|
2
|
-
import { Game } from "./Game";
|
|
3
|
-
import { Delay, Vector3 } from "./utils";
|
|
4
|
-
/**
|
|
5
|
-
* Class that represents the result of a raycast.
|
|
6
|
-
*/
|
|
7
|
-
class RaycastResult {
|
|
8
|
-
/**
|
|
9
|
-
* Return the entity that was hit.
|
|
10
|
-
*/
|
|
11
|
-
get HitEntity() {
|
|
12
|
-
return this.entityHandleArg;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Get the position of the entity that was hit.
|
|
16
|
-
*/
|
|
17
|
-
get HitPosition() {
|
|
18
|
-
return this.hitPositionArg;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Return the vector perpendicular to the tangent plane.
|
|
22
|
-
*/
|
|
23
|
-
get SurfaceNormal() {
|
|
24
|
-
return this.surfaceNormalArg;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Whether we hit anything.
|
|
28
|
-
*/
|
|
29
|
-
get DidHit() {
|
|
30
|
-
return this.hitSomethingArg;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Whether the entity hit exists.
|
|
34
|
-
*/
|
|
35
|
-
get DidHitEntity() {
|
|
36
|
-
return this.entityHandleArg !== null && this.entityHandleArg.Handle !== 0;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Material type that was hit.
|
|
40
|
-
*/
|
|
41
|
-
get Material() {
|
|
42
|
-
return this.materialArg;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Raycast result's handle.
|
|
46
|
-
*/
|
|
47
|
-
get Result() {
|
|
48
|
-
return this.result;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* @returns if the shape test handle was already discarded
|
|
52
|
-
*/
|
|
53
|
-
get WasDiscarded() {
|
|
54
|
-
return this.result === ShapeTestStatus.Discarded;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* NOTE: These will not be updated unless polled by `resolve` or the shape
|
|
58
|
-
* test is synchronous
|
|
59
|
-
* @returns if the raycast has been marked as ready by the engine
|
|
60
|
-
*/
|
|
61
|
-
get HasResolved() {
|
|
62
|
-
return this.result === ShapeTestStatus.Ready;
|
|
63
|
-
}
|
|
64
|
-
applyShapeTestResults() {
|
|
65
|
-
const [result, hit, endCoords, surfaceNormal, materialHash, entityHit] = GetShapeTestResultIncludingMaterial(this.handle);
|
|
66
|
-
this.result = result;
|
|
67
|
-
if (!this.HasResolved || this.WasDiscarded)
|
|
68
|
-
return;
|
|
69
|
-
this.hitSomethingArg = hit;
|
|
70
|
-
this.hitPositionArg = Vector3.fromArray(endCoords);
|
|
71
|
-
this.surfaceNormalArg = Vector3.fromArray(surfaceNormal);
|
|
72
|
-
this.materialArg = materialHash;
|
|
73
|
-
if (entityHit !== 0) {
|
|
74
|
-
this.entityHandleArg = Game.entityFromHandle(entityHit);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
handle;
|
|
78
|
-
hitPositionArg;
|
|
79
|
-
hitSomethingArg;
|
|
80
|
-
entityHandleArg;
|
|
81
|
-
surfaceNormalArg;
|
|
82
|
-
materialArg;
|
|
83
|
-
result;
|
|
84
|
-
/**
|
|
85
|
-
* Create a RaycastResult object that gets the results from a StartShapeTestRay()
|
|
86
|
-
*
|
|
87
|
-
* @param handle The handle returned from StartShapeTestRay()
|
|
88
|
-
*/
|
|
89
|
-
constructor(handle) {
|
|
90
|
-
this.handle = handle;
|
|
91
|
-
this.hitPositionArg = new Vector3(0, 0, 0);
|
|
92
|
-
this.hitSomethingArg = false;
|
|
93
|
-
this.entityHandleArg = null;
|
|
94
|
-
this.surfaceNormalArg = new Vector3(0, 0, 0);
|
|
95
|
-
this.materialArg = 0;
|
|
96
|
-
this.result = ShapeTestStatus.NotReady;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
export class SynchronousRaycastResult extends RaycastResult {
|
|
100
|
-
constructor(handle) {
|
|
101
|
-
super(handle);
|
|
102
|
-
// if we're using a synchronous call then we want to instantly update our
|
|
103
|
-
// data, if its invalid then the caller can deal with it.
|
|
104
|
-
this.applyShapeTestResults();
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
export class AsynchronousRaycastResult extends RaycastResult {
|
|
108
|
-
/**
|
|
109
|
-
* waits until the shape test handle is valid and then sets the expected
|
|
110
|
-
* values on the RaycastResult
|
|
111
|
-
*/
|
|
112
|
-
async resolve(timeoutInMs = 1000) {
|
|
113
|
-
const timeout = GetGameTimer() + timeoutInMs;
|
|
114
|
-
// this has to be polled every frame or the engien will mark the field shape
|
|
115
|
-
// test handle as discarded
|
|
116
|
-
while (!this.HasResolved && !this.WasDiscarded) {
|
|
117
|
-
this.applyShapeTestResults();
|
|
118
|
-
if (timeout < GetGameTimer())
|
|
119
|
-
break;
|
|
120
|
-
await Delay(0);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
package/RelationshipGroup.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Class to create and manage a relationship group. Useful to manage behavior between Peds.
|
|
3
|
-
*/
|
|
4
|
-
export class RelationshipGroup {
|
|
5
|
-
/**
|
|
6
|
-
* The hash of the relationship group
|
|
7
|
-
*/
|
|
8
|
-
hash;
|
|
9
|
-
/**
|
|
10
|
-
* Create a relationship group. Optionally pass a group hash.
|
|
11
|
-
*
|
|
12
|
-
* @param name Name of the relationship group.
|
|
13
|
-
*/
|
|
14
|
-
constructor(name) {
|
|
15
|
-
const [, groupHash] = AddRelationshipGroup(name);
|
|
16
|
-
this.hash = groupHash;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Gets the hash of the relationship group.
|
|
20
|
-
*
|
|
21
|
-
* @returns The hash of this object.
|
|
22
|
-
*/
|
|
23
|
-
get Hash() {
|
|
24
|
-
return this.hash;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Get the relationship between two relationship groups.
|
|
28
|
-
*
|
|
29
|
-
* @param targetGroup The other relationship group.
|
|
30
|
-
* @returns The relationship
|
|
31
|
-
*/
|
|
32
|
-
getRelationshipBetweenGroups(targetGroup) {
|
|
33
|
-
return GetRelationshipBetweenGroups(this.Hash, targetGroup.Hash);
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Set the relationship group between this relationship group and another one.
|
|
37
|
-
*
|
|
38
|
-
* @param targetGroup The other relationship group.
|
|
39
|
-
* @param relationship The desired relationship.
|
|
40
|
-
* @param biDirectionally If target group should have same relationship towards this.
|
|
41
|
-
*/
|
|
42
|
-
setRelationshipBetweenGroups(targetGroup, relationship, biDirectionally = false) {
|
|
43
|
-
SetRelationshipBetweenGroups(Number(relationship), this.Hash, targetGroup.Hash);
|
|
44
|
-
if (biDirectionally) {
|
|
45
|
-
SetRelationshipBetweenGroups(Number(relationship), targetGroup.Hash, this.Hash);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Clear the relationship between this relationship group and another.
|
|
50
|
-
*
|
|
51
|
-
* @param targetGroup The other relationship group.
|
|
52
|
-
* @param relationship The desired relationship to clear.
|
|
53
|
-
* @param biDirectionally Whether the target group should also clear the relationship.
|
|
54
|
-
*/
|
|
55
|
-
clearRelationshipBetweenGroups(targetGroup, relationship, biDirectionally = false) {
|
|
56
|
-
ClearRelationshipBetweenGroups(Number(relationship), this.Hash, targetGroup.Hash);
|
|
57
|
-
if (biDirectionally) {
|
|
58
|
-
ClearRelationshipBetweenGroups(Number(relationship), targetGroup.Hash, this.Hash);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Remove this relationship group from the game. This will not delete this object.
|
|
63
|
-
*/
|
|
64
|
-
remove() {
|
|
65
|
-
RemoveRelationshipGroup(this.Hash);
|
|
66
|
-
}
|
|
67
|
-
}
|