@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/Raycast.js
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
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 { ShapeTestStatus } from "./enums/RaycastEnums";
|
|
5
|
+
import { Game } from "./Game";
|
|
6
|
+
import { Delay } from "./common/utils/Delay";
|
|
7
|
+
class RaycastResult {
|
|
8
|
+
static {
|
|
9
|
+
__name(this, "RaycastResult");
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Return the entity that was hit.
|
|
13
|
+
*/
|
|
14
|
+
get HitEntity() {
|
|
15
|
+
return this.entityHandleArg;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Get the position of the entity that was hit.
|
|
19
|
+
*/
|
|
20
|
+
get HitPosition() {
|
|
21
|
+
return this.hitPositionArg;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Return the vector perpendicular to the tangent plane.
|
|
25
|
+
*/
|
|
26
|
+
get SurfaceNormal() {
|
|
27
|
+
return this.surfaceNormalArg;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Whether we hit anything.
|
|
31
|
+
*/
|
|
32
|
+
get DidHit() {
|
|
33
|
+
return this.hitSomethingArg;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Whether the entity hit exists.
|
|
37
|
+
*/
|
|
38
|
+
get DidHitEntity() {
|
|
39
|
+
return this.entityHandleArg !== null && this.entityHandleArg.Handle !== 0;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Material type that was hit.
|
|
43
|
+
*/
|
|
44
|
+
get Material() {
|
|
45
|
+
return this.materialArg;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Raycast result's handle.
|
|
49
|
+
*/
|
|
50
|
+
get Result() {
|
|
51
|
+
return this.result;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* @returns if the shape test handle was already discarded
|
|
55
|
+
*/
|
|
56
|
+
get WasDiscarded() {
|
|
57
|
+
return this.result === ShapeTestStatus.Discarded;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* NOTE: These will not be updated unless polled by `resolve` or the shape
|
|
61
|
+
* test is synchronous
|
|
62
|
+
* @returns if the raycast has been marked as ready by the engine
|
|
63
|
+
*/
|
|
64
|
+
get HasResolved() {
|
|
65
|
+
return this.result === ShapeTestStatus.Ready;
|
|
66
|
+
}
|
|
67
|
+
applyShapeTestResults() {
|
|
68
|
+
const [result, hit, endCoords, surfaceNormal, materialHash, entityHit] = GetShapeTestResultIncludingMaterial(
|
|
69
|
+
this.handle
|
|
70
|
+
);
|
|
71
|
+
this.result = result;
|
|
72
|
+
if (!this.HasResolved || this.WasDiscarded) return;
|
|
73
|
+
this.hitSomethingArg = hit;
|
|
74
|
+
this.hitPositionArg = Vector3.fromArray(endCoords);
|
|
75
|
+
this.surfaceNormalArg = Vector3.fromArray(surfaceNormal);
|
|
76
|
+
this.materialArg = materialHash;
|
|
77
|
+
if (entityHit !== 0) {
|
|
78
|
+
this.entityHandleArg = Game.entityFromHandle(entityHit);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
handle;
|
|
82
|
+
hitPositionArg;
|
|
83
|
+
hitSomethingArg;
|
|
84
|
+
entityHandleArg;
|
|
85
|
+
surfaceNormalArg;
|
|
86
|
+
materialArg;
|
|
87
|
+
result;
|
|
88
|
+
/**
|
|
89
|
+
* Create a RaycastResult object that gets the results from a StartShapeTestRay()
|
|
90
|
+
*
|
|
91
|
+
* @param handle The handle returned from StartShapeTestRay()
|
|
92
|
+
*/
|
|
93
|
+
constructor(handle) {
|
|
94
|
+
this.handle = handle;
|
|
95
|
+
this.hitPositionArg = new Vector3(0, 0, 0);
|
|
96
|
+
this.hitSomethingArg = false;
|
|
97
|
+
this.entityHandleArg = null;
|
|
98
|
+
this.surfaceNormalArg = new Vector3(0, 0, 0);
|
|
99
|
+
this.materialArg = 0;
|
|
100
|
+
this.result = ShapeTestStatus.NotReady;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
class SynchronousRaycastResult extends RaycastResult {
|
|
104
|
+
static {
|
|
105
|
+
__name(this, "SynchronousRaycastResult");
|
|
106
|
+
}
|
|
107
|
+
constructor(handle) {
|
|
108
|
+
super(handle);
|
|
109
|
+
this.applyShapeTestResults();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
class AsynchronousRaycastResult extends RaycastResult {
|
|
113
|
+
static {
|
|
114
|
+
__name(this, "AsynchronousRaycastResult");
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* waits until the shape test handle is valid and then sets the expected
|
|
118
|
+
* values on the RaycastResult
|
|
119
|
+
*/
|
|
120
|
+
async resolve(timeoutInMs = 1e3) {
|
|
121
|
+
const timeout = GetGameTimer() + timeoutInMs;
|
|
122
|
+
while (!this.HasResolved && !this.WasDiscarded) {
|
|
123
|
+
this.applyShapeTestResults();
|
|
124
|
+
if (timeout < GetGameTimer()) break;
|
|
125
|
+
await Delay(0);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
export {
|
|
130
|
+
AsynchronousRaycastResult,
|
|
131
|
+
SynchronousRaycastResult
|
|
132
|
+
};
|
package/RelationshipGroup.d.ts
CHANGED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
class RelationshipGroup {
|
|
4
|
+
static {
|
|
5
|
+
__name(this, "RelationshipGroup");
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The hash of the relationship group
|
|
9
|
+
*/
|
|
10
|
+
hash;
|
|
11
|
+
/**
|
|
12
|
+
* Create a relationship group. Optionally pass a group hash.
|
|
13
|
+
*
|
|
14
|
+
* @param name Name of the relationship group.
|
|
15
|
+
*/
|
|
16
|
+
constructor(name) {
|
|
17
|
+
const [, groupHash] = AddRelationshipGroup(name);
|
|
18
|
+
this.hash = groupHash;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Gets the hash of the relationship group.
|
|
22
|
+
*
|
|
23
|
+
* @returns The hash of this object.
|
|
24
|
+
*/
|
|
25
|
+
get Hash() {
|
|
26
|
+
return this.hash;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Get the relationship between two relationship groups.
|
|
30
|
+
*
|
|
31
|
+
* @param targetGroup The other relationship group.
|
|
32
|
+
* @returns The relationship
|
|
33
|
+
*/
|
|
34
|
+
getRelationshipBetweenGroups(targetGroup) {
|
|
35
|
+
return GetRelationshipBetweenGroups(this.Hash, targetGroup.Hash);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Set the relationship group between this relationship group and another one.
|
|
39
|
+
*
|
|
40
|
+
* @param targetGroup The other relationship group.
|
|
41
|
+
* @param relationship The desired relationship.
|
|
42
|
+
* @param biDirectionally If target group should have same relationship towards this.
|
|
43
|
+
*/
|
|
44
|
+
setRelationshipBetweenGroups(targetGroup, relationship, biDirectionally = false) {
|
|
45
|
+
SetRelationshipBetweenGroups(Number(relationship), this.Hash, targetGroup.Hash);
|
|
46
|
+
if (biDirectionally) {
|
|
47
|
+
SetRelationshipBetweenGroups(Number(relationship), targetGroup.Hash, this.Hash);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Clear the relationship between this relationship group and another.
|
|
52
|
+
*
|
|
53
|
+
* @param targetGroup The other relationship group.
|
|
54
|
+
* @param relationship The desired relationship to clear.
|
|
55
|
+
* @param biDirectionally Whether the target group should also clear the relationship.
|
|
56
|
+
*/
|
|
57
|
+
clearRelationshipBetweenGroups(targetGroup, relationship, biDirectionally = false) {
|
|
58
|
+
ClearRelationshipBetweenGroups(Number(relationship), this.Hash, targetGroup.Hash);
|
|
59
|
+
if (biDirectionally) {
|
|
60
|
+
ClearRelationshipBetweenGroups(Number(relationship), targetGroup.Hash, this.Hash);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Remove this relationship group from the game. This will not delete this object.
|
|
65
|
+
*/
|
|
66
|
+
remove() {
|
|
67
|
+
RemoveRelationshipGroup(this.Hash);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export {
|
|
71
|
+
RelationshipGroup
|
|
72
|
+
};
|
package/Rope.d.ts
CHANGED
package/Rope.js
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
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 Rope {
|
|
5
|
+
static {
|
|
6
|
+
__name(this, "Rope");
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Id of rope entity.
|
|
10
|
+
*/
|
|
11
|
+
handle;
|
|
12
|
+
/**
|
|
13
|
+
* Create a rope object based on an existing rope in the world.
|
|
14
|
+
*
|
|
15
|
+
* @param handle entity Id of rope.
|
|
16
|
+
*/
|
|
17
|
+
constructor(handle) {
|
|
18
|
+
this.handle = handle;
|
|
19
|
+
}
|
|
20
|
+
get Handle() {
|
|
21
|
+
return this.handle;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get the length of the rope.
|
|
25
|
+
*
|
|
26
|
+
* @returns The rope length.
|
|
27
|
+
*/
|
|
28
|
+
get Length() {
|
|
29
|
+
return GetRopeLength(this.handle);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Sets the length of the rope.
|
|
33
|
+
*
|
|
34
|
+
* @param length Desired new length of rope.
|
|
35
|
+
*/
|
|
36
|
+
set Length(length) {
|
|
37
|
+
RopeForceLength(this.handle, length);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Get the number of vertices on the rope.
|
|
41
|
+
*
|
|
42
|
+
* @returns Returns the number of vertices.
|
|
43
|
+
*/
|
|
44
|
+
get VertexCount() {
|
|
45
|
+
return GetRopeVertexCount(this.handle);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Resets the length of the rope to it's length upon object creation or a length of 1.
|
|
49
|
+
*
|
|
50
|
+
* @param reset Whether to reset the length to it's original length or 1.
|
|
51
|
+
*/
|
|
52
|
+
resetLength(reset) {
|
|
53
|
+
RopeResetLength(this.handle, reset ? 1 : this.Length);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Activates world physics on the rope object.
|
|
57
|
+
*/
|
|
58
|
+
activatePhysics() {
|
|
59
|
+
ActivatePhysics(this.handle);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Attach the rope to an entity.
|
|
63
|
+
*
|
|
64
|
+
* @param entity Entity to attach the rope to.
|
|
65
|
+
* @param position Location where the rope is to be attached.
|
|
66
|
+
*/
|
|
67
|
+
attachEntity(entity, position) {
|
|
68
|
+
AttachRopeToEntity(this.handle, entity.Handle, position.x, position.y, position.z, false);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Attach the rope between two entities at given locations on the entities.
|
|
72
|
+
*
|
|
73
|
+
* @param entityOne The first entity to attach to.
|
|
74
|
+
* @param positionOne Where on the first entity to attach the rope to.
|
|
75
|
+
* @param entityTwo The second entity to attach to.
|
|
76
|
+
* @param positionTwo Where on the second entity to attach the rope to.
|
|
77
|
+
* @param length The desired length of the rope between the two entities.
|
|
78
|
+
*/
|
|
79
|
+
attachEntities(entityOne, positionOne, entityTwo, positionTwo, length) {
|
|
80
|
+
AttachEntitiesToRope(
|
|
81
|
+
this.handle,
|
|
82
|
+
entityOne.Handle,
|
|
83
|
+
entityTwo.Handle,
|
|
84
|
+
positionOne.x,
|
|
85
|
+
positionOne.y,
|
|
86
|
+
positionOne.z,
|
|
87
|
+
positionTwo.x,
|
|
88
|
+
positionTwo.y,
|
|
89
|
+
positionTwo.z,
|
|
90
|
+
length,
|
|
91
|
+
false,
|
|
92
|
+
false,
|
|
93
|
+
"",
|
|
94
|
+
""
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Detach the rope from an entity.
|
|
99
|
+
*
|
|
100
|
+
* @param entity Entity to detach the rope from.
|
|
101
|
+
*/
|
|
102
|
+
detachEntity(entity) {
|
|
103
|
+
DetachRopeFromEntity(this.handle, entity.Handle);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Pin a vertex of the rope to a certain location.
|
|
107
|
+
*
|
|
108
|
+
* @param vertex Vertex to pin.
|
|
109
|
+
* @param position Location to pin the vertex to.
|
|
110
|
+
*/
|
|
111
|
+
pinVertex(vertex, position) {
|
|
112
|
+
PinRopeVertex(this.handle, vertex, position.x, position.y, position.z);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Unpin a specified vertex from it's current pinned location (if any).
|
|
116
|
+
*
|
|
117
|
+
* @param vertex Vertex to unpin.
|
|
118
|
+
*/
|
|
119
|
+
unpinVertex(vertex) {
|
|
120
|
+
UnpinRopeVertex(this.handle, vertex);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Return the world location of a specified vertex on the rope.
|
|
124
|
+
*
|
|
125
|
+
* @param vertex Vertex to get location from.
|
|
126
|
+
* @returns The vector location of the vertex.
|
|
127
|
+
*/
|
|
128
|
+
getVertexCoord(vertex) {
|
|
129
|
+
return Vector3.fromArray(GetRopeVertexCoord(this.handle, vertex));
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Delete the rope from the world. This does not delete the rope object.
|
|
133
|
+
*/
|
|
134
|
+
delete() {
|
|
135
|
+
DeleteRope(this.handle);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Check if the rope still exists in the world based on it's handle.
|
|
139
|
+
*
|
|
140
|
+
* @returns Whether the rope exists or not.
|
|
141
|
+
*/
|
|
142
|
+
exists() {
|
|
143
|
+
const [exists] = DoesRopeExist(this.handle);
|
|
144
|
+
return exists;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
export {
|
|
148
|
+
Rope
|
|
149
|
+
};
|
package/TaskSequence.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { Tasks } from "./Tasks";
|
|
4
|
+
class TaskSequence {
|
|
5
|
+
static {
|
|
6
|
+
__name(this, "TaskSequence");
|
|
7
|
+
}
|
|
8
|
+
static nullTask;
|
|
9
|
+
handle = 0;
|
|
10
|
+
isClosed;
|
|
11
|
+
count;
|
|
12
|
+
constructor(handle) {
|
|
13
|
+
handle === void 0 ? this.create() : this.handle = handle;
|
|
14
|
+
if (!TaskSequence.nullTask) {
|
|
15
|
+
TaskSequence.nullTask = new Tasks(null);
|
|
16
|
+
}
|
|
17
|
+
this.isClosed = false;
|
|
18
|
+
this.count = 0;
|
|
19
|
+
}
|
|
20
|
+
create() {
|
|
21
|
+
this.handle = OpenSequenceTask();
|
|
22
|
+
}
|
|
23
|
+
dispose() {
|
|
24
|
+
ClearSequenceTask(this.handle);
|
|
25
|
+
this.handle = 0;
|
|
26
|
+
}
|
|
27
|
+
close(repeat = false) {
|
|
28
|
+
if (this.isClosed) return;
|
|
29
|
+
SetSequenceToRepeat(this.handle, repeat);
|
|
30
|
+
CloseSequenceTask(this.handle);
|
|
31
|
+
this.isClosed = true;
|
|
32
|
+
}
|
|
33
|
+
get Handle() {
|
|
34
|
+
return this.handle;
|
|
35
|
+
}
|
|
36
|
+
get AddTask() {
|
|
37
|
+
if (this.isClosed) {
|
|
38
|
+
throw new Error("You can't add tasks to a closed sequence!");
|
|
39
|
+
}
|
|
40
|
+
this.count += 1;
|
|
41
|
+
return TaskSequence.nullTask;
|
|
42
|
+
}
|
|
43
|
+
get IsClosed() {
|
|
44
|
+
return this.isClosed;
|
|
45
|
+
}
|
|
46
|
+
get Count() {
|
|
47
|
+
return this.count;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
TaskSequence
|
|
52
|
+
};
|
package/Tasks.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Vector3 } from "./common/utils/Vector";
|
|
2
|
+
import type { AnimationFlags } from "./enums/AnimationFlags";
|
|
3
|
+
import { DrivingStyle } from "./enums/Driving";
|
|
4
|
+
import { FiringPattern } from "./enums/FiringPattern";
|
|
5
|
+
import { VehicleSeat } from "./enums/Vehicle";
|
|
6
|
+
import type { LeaveVehicleFlags } from "./enums/LeaveVehicleFlags";
|
|
3
7
|
import { BaseEntity } from "./models/BaseEntity";
|
|
8
|
+
import { Ped } from "./models/Ped";
|
|
9
|
+
import type { Vehicle } from "./models/Vehicle";
|
|
4
10
|
import type { TaskSequence } from "./TaskSequence";
|
|
5
|
-
import { Vector3 } from "./utils";
|
|
6
11
|
export declare class Tasks {
|
|
7
12
|
private ped;
|
|
8
13
|
constructor(ped: Ped | null);
|