@nativewrappers/fivem 0.0.1
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/LICENSE +21 -0
- package/README.md +33 -0
- package/lib/client/Audio.d.ts +17 -0
- package/lib/client/Audio.js +92 -0
- package/lib/client/Blip.d.ts +39 -0
- package/lib/client/Blip.js +104 -0
- package/lib/client/Camera.d.ts +46 -0
- package/lib/client/Camera.js +161 -0
- package/lib/client/Checkpoint.d.ts +18 -0
- package/lib/client/Checkpoint.js +42 -0
- package/lib/client/Events.d.ts +11 -0
- package/lib/client/Events.js +73 -0
- package/lib/client/Game.d.ts +283 -0
- package/lib/client/Game.js +451 -0
- package/lib/client/GameplayCamera.d.ts +102 -0
- package/lib/client/GameplayCamera.js +141 -0
- package/lib/client/Model.d.ts +134 -0
- package/lib/client/Model.js +198 -0
- package/lib/client/NetworkedScene.d.ts +10 -0
- package/lib/client/NetworkedScene.js +17 -0
- package/lib/client/ParticleEffect.d.ts +80 -0
- package/lib/client/ParticleEffect.js +120 -0
- package/lib/client/ParticleEffectAsset.d.ts +54 -0
- package/lib/client/ParticleEffectAsset.js +104 -0
- package/lib/client/Pickup.d.ts +9 -0
- package/lib/client/Pickup.js +18 -0
- package/lib/client/Raycast.d.ts +49 -0
- package/lib/client/Raycast.js +70 -0
- package/lib/client/RelationshipGroup.d.ts +49 -0
- package/lib/client/RelationshipGroup.js +63 -0
- package/lib/client/Rope.d.ts +99 -0
- package/lib/client/Rope.js +125 -0
- package/lib/client/TaskSequence.d.ts +15 -0
- package/lib/client/TaskSequence.js +43 -0
- package/lib/client/Tasks.d.ts +66 -0
- package/lib/client/Tasks.js +236 -0
- package/lib/client/World.d.ts +402 -0
- package/lib/client/World.js +726 -0
- package/lib/client/cfx/StateBagChangeHandler.d.ts +3 -0
- package/lib/client/cfx/StateBagChangeHandler.js +1 -0
- package/lib/client/cfx/index.d.ts +7 -0
- package/lib/client/cfx/index.js +1 -0
- package/lib/client/enums/Alignment.d.ts +5 -0
- package/lib/client/enums/Alignment.js +6 -0
- package/lib/client/enums/AnimationFlags.d.ts +9 -0
- package/lib/client/enums/AnimationFlags.js +10 -0
- package/lib/client/enums/AudioFlag.d.ts +37 -0
- package/lib/client/enums/AudioFlag.js +38 -0
- package/lib/client/enums/BadgeStyle.d.ts +182 -0
- package/lib/client/enums/BadgeStyle.js +183 -0
- package/lib/client/enums/Blip.d.ts +223 -0
- package/lib/client/enums/Blip.js +225 -0
- package/lib/client/enums/Bone.d.ts +101 -0
- package/lib/client/enums/Bone.js +103 -0
- package/lib/client/enums/CameraShake.d.ts +13 -0
- package/lib/client/enums/CameraShake.js +14 -0
- package/lib/client/enums/CameraTypes.d.ts +7 -0
- package/lib/client/enums/CameraTypes.js +8 -0
- package/lib/client/enums/CheckboxStyle.d.ts +4 -0
- package/lib/client/enums/CheckboxStyle.js +5 -0
- package/lib/client/enums/Checkpoint.d.ts +62 -0
- package/lib/client/enums/Checkpoint.js +67 -0
- package/lib/client/enums/ClassTypes.d.ts +11 -0
- package/lib/client/enums/ClassTypes.js +12 -0
- package/lib/client/enums/CloudHat.d.ts +26 -0
- package/lib/client/enums/CloudHat.js +27 -0
- package/lib/client/enums/Control.d.ts +360 -0
- package/lib/client/enums/Control.js +361 -0
- package/lib/client/enums/CursorSprite.d.ts +14 -0
- package/lib/client/enums/CursorSprite.js +15 -0
- package/lib/client/enums/Driving.d.ts +32 -0
- package/lib/client/enums/Driving.js +34 -0
- package/lib/client/enums/ExplosionType.d.ts +44 -0
- package/lib/client/enums/ExplosionType.js +45 -0
- package/lib/client/enums/FiringPattern.d.ts +19 -0
- package/lib/client/enums/FiringPattern.js +20 -0
- package/lib/client/enums/Font.d.ts +7 -0
- package/lib/client/enums/Font.js +8 -0
- package/lib/client/enums/ForceType.d.ts +8 -0
- package/lib/client/enums/ForceType.js +9 -0
- package/lib/client/enums/Gender.d.ts +4 -0
- package/lib/client/enums/Gender.js +5 -0
- package/lib/client/enums/HelmetType.d.ts +5 -0
- package/lib/client/enums/HelmetType.js +6 -0
- package/lib/client/enums/HudColor.d.ts +183 -0
- package/lib/client/enums/HudColor.js +184 -0
- package/lib/client/enums/HudComponent.d.ts +53 -0
- package/lib/client/enums/HudComponent.js +54 -0
- package/lib/client/enums/InputMode.d.ts +4 -0
- package/lib/client/enums/InputMode.js +5 -0
- package/lib/client/enums/IntersectOptions.d.ts +15 -0
- package/lib/client/enums/IntersectOptions.js +16 -0
- package/lib/client/enums/InvertAxis.d.ts +9 -0
- package/lib/client/enums/InvertAxis.js +7 -0
- package/lib/client/enums/Language.d.ts +14 -0
- package/lib/client/enums/Language.js +15 -0
- package/lib/client/enums/LeaveVehicleFlags.d.ts +10 -0
- package/lib/client/enums/LeaveVehicleFlags.js +11 -0
- package/lib/client/enums/LoadingSpinnerType.d.ts +7 -0
- package/lib/client/enums/LoadingSpinnerType.js +8 -0
- package/lib/client/enums/MarkerType.d.ts +49 -0
- package/lib/client/enums/MarkerType.js +50 -0
- package/lib/client/enums/MenuAlignment.d.ts +4 -0
- package/lib/client/enums/MenuAlignment.js +5 -0
- package/lib/client/enums/NotificationType.d.ts +10 -0
- package/lib/client/enums/NotificationType.js +11 -0
- package/lib/client/enums/Parachute.d.ts +13 -0
- package/lib/client/enums/Parachute.js +15 -0
- package/lib/client/enums/PickupType.d.ts +73 -0
- package/lib/client/enums/PickupType.js +74 -0
- package/lib/client/enums/RadioStation.d.ts +24 -0
- package/lib/client/enums/RadioStation.js +25 -0
- package/lib/client/enums/RagdollType.d.ts +6 -0
- package/lib/client/enums/RagdollType.js +7 -0
- package/lib/client/enums/Relationship.d.ts +9 -0
- package/lib/client/enums/Relationship.js +10 -0
- package/lib/client/enums/RopeType.d.ts +5 -0
- package/lib/client/enums/RopeType.js +6 -0
- package/lib/client/enums/ScreenEffect.d.ts +83 -0
- package/lib/client/enums/ScreenEffect.js +84 -0
- package/lib/client/enums/SpeechModifier.d.ts +39 -0
- package/lib/client/enums/SpeechModifier.js +40 -0
- package/lib/client/enums/Vehicle.d.ts +358 -0
- package/lib/client/enums/Vehicle.js +376 -0
- package/lib/client/enums/Weather.d.ts +21 -0
- package/lib/client/enums/Weather.js +22 -0
- package/lib/client/enums/ZoneID.d.ts +94 -0
- package/lib/client/enums/ZoneID.js +95 -0
- package/lib/client/enums/index.d.ts +42 -0
- package/lib/client/enums/index.js +42 -0
- package/lib/client/hashes/MaterialHash.d.ts +216 -0
- package/lib/client/hashes/MaterialHash.js +217 -0
- package/lib/client/hashes/PedHash.d.ts +724 -0
- package/lib/client/hashes/PedHash.js +725 -0
- package/lib/client/hashes/VehicleHash.d.ts +522 -0
- package/lib/client/hashes/VehicleHash.js +523 -0
- package/lib/client/hashes/WeaponHash.d.ts +147 -0
- package/lib/client/hashes/WeaponHash.js +161 -0
- package/lib/client/hashes/WeatherTypeHash.d.ts +21 -0
- package/lib/client/hashes/WeatherTypeHash.js +22 -0
- package/lib/client/hashes/index.d.ts +5 -0
- package/lib/client/hashes/index.js +5 -0
- package/lib/client/index.d.ts +24 -0
- package/lib/client/index.js +25 -0
- package/lib/client/interfaces/Dimensions.d.ts +5 -0
- package/lib/client/interfaces/Dimensions.js +1 -0
- package/lib/client/models/BaseEntity.d.ts +169 -0
- package/lib/client/models/BaseEntity.js +459 -0
- package/lib/client/models/Entity.d.ts +9 -0
- package/lib/client/models/Entity.js +24 -0
- package/lib/client/models/EntityBone.d.ts +12 -0
- package/lib/client/models/EntityBone.js +24 -0
- package/lib/client/models/EntityBoneCollection.d.ts +11 -0
- package/lib/client/models/EntityBoneCollection.js +16 -0
- package/lib/client/models/Ped.d.ts +199 -0
- package/lib/client/models/Ped.js +685 -0
- package/lib/client/models/PedBone.d.ts +6 -0
- package/lib/client/models/PedBone.js +9 -0
- package/lib/client/models/PedBoneCollection.d.ts +8 -0
- package/lib/client/models/PedBoneCollection.js +19 -0
- package/lib/client/models/Player.d.ts +63 -0
- package/lib/client/models/Player.js +174 -0
- package/lib/client/models/Prop.d.ts +11 -0
- package/lib/client/models/Prop.js +26 -0
- package/lib/client/models/Vehicle.d.ts +171 -0
- package/lib/client/models/Vehicle.js +551 -0
- package/lib/client/models/VehicleDoor.d.ts +19 -0
- package/lib/client/models/VehicleDoor.js +42 -0
- package/lib/client/models/VehicleDoorCollection.d.ts +14 -0
- package/lib/client/models/VehicleDoorCollection.js +61 -0
- package/lib/client/models/VehicleMod.d.ts +16 -0
- package/lib/client/models/VehicleMod.js +33 -0
- package/lib/client/models/VehicleModCollection.d.ts +61 -0
- package/lib/client/models/VehicleModCollection.js +227 -0
- package/lib/client/models/VehicleToggleMod.d.ts +14 -0
- package/lib/client/models/VehicleToggleMod.js +27 -0
- package/lib/client/models/VehicleWheel.d.ts +11 -0
- package/lib/client/models/VehicleWheel.js +21 -0
- package/lib/client/models/VehicleWheelCollection.d.ts +13 -0
- package/lib/client/models/VehicleWheelCollection.js +56 -0
- package/lib/client/models/VehicleWindow.d.ts +16 -0
- package/lib/client/models/VehicleWindow.js +33 -0
- package/lib/client/models/VehicleWindowCollection.d.ts +14 -0
- package/lib/client/models/VehicleWindowCollection.js +55 -0
- package/lib/client/models/index.d.ts +18 -0
- package/lib/client/models/index.js +18 -0
- package/lib/client/types/EntityType.d.ts +2 -0
- package/lib/client/types/EntityType.js +1 -0
- package/lib/client/ui/Container.d.ts +11 -0
- package/lib/client/ui/Container.js +28 -0
- package/lib/client/ui/Effects.d.ts +8 -0
- package/lib/client/ui/Effects.js +106 -0
- package/lib/client/ui/Fading.d.ts +41 -0
- package/lib/client/ui/Fading.js +69 -0
- package/lib/client/ui/Hud.d.ts +16 -0
- package/lib/client/ui/Hud.js +39 -0
- package/lib/client/ui/InstructionalButtons.d.ts +33 -0
- package/lib/client/ui/InstructionalButtons.js +53 -0
- package/lib/client/ui/LoadingPrompt.d.ts +27 -0
- package/lib/client/ui/LoadingPrompt.js +45 -0
- package/lib/client/ui/Notification.d.ts +5 -0
- package/lib/client/ui/Notification.js +8 -0
- package/lib/client/ui/Rectangle.d.ts +10 -0
- package/lib/client/ui/Rectangle.js +37 -0
- package/lib/client/ui/Scaleform.d.ts +106 -0
- package/lib/client/ui/Scaleform.js +234 -0
- package/lib/client/ui/Screen.d.ts +16 -0
- package/lib/client/ui/Screen.js +72 -0
- package/lib/client/ui/Sprite.d.ts +17 -0
- package/lib/client/ui/Sprite.js +53 -0
- package/lib/client/ui/Text.d.ts +31 -0
- package/lib/client/ui/Text.js +102 -0
- package/lib/client/ui/Timerbar.d.ts +44 -0
- package/lib/client/ui/Timerbar.js +241 -0
- package/lib/client/ui/index.d.ts +15 -0
- package/lib/client/ui/index.js +15 -0
- package/lib/client/ui/interfaces/IButton.d.ts +5 -0
- package/lib/client/ui/interfaces/IButton.js +1 -0
- package/lib/client/ui/interfaces/IDrawable.d.ts +7 -0
- package/lib/client/ui/interfaces/IDrawable.js +1 -0
- package/lib/client/ui/interfaces/index.d.ts +2 -0
- package/lib/client/ui/interfaces/index.js +1 -0
- package/lib/client/ui/menu/Menu.d.ts +108 -0
- package/lib/client/ui/menu/Menu.js +802 -0
- package/lib/client/ui/menu/MenuControl.d.ts +6 -0
- package/lib/client/ui/menu/MenuControl.js +11 -0
- package/lib/client/ui/menu/MenuControls.d.ts +9 -0
- package/lib/client/ui/menu/MenuControls.js +11 -0
- package/lib/client/ui/menu/MenuSettings.d.ts +20 -0
- package/lib/client/ui/menu/MenuSettings.js +51 -0
- package/lib/client/ui/menu/index.d.ts +6 -0
- package/lib/client/ui/menu/index.js +6 -0
- package/lib/client/ui/menu/items/UIMenuCheckboxItem.d.ts +20 -0
- package/lib/client/ui/menu/items/UIMenuCheckboxItem.js +57 -0
- package/lib/client/ui/menu/items/UIMenuItem.d.ts +78 -0
- package/lib/client/ui/menu/items/UIMenuItem.js +1090 -0
- package/lib/client/ui/menu/items/UIMenuListItem.d.ts +31 -0
- package/lib/client/ui/menu/items/UIMenuListItem.js +110 -0
- package/lib/client/ui/menu/items/UIMenuSeparatorItem.d.ts +11 -0
- package/lib/client/ui/menu/items/UIMenuSeparatorItem.js +29 -0
- package/lib/client/ui/menu/items/UIMenuSliderItem.d.ts +47 -0
- package/lib/client/ui/menu/items/UIMenuSliderItem.js +173 -0
- package/lib/client/ui/menu/items/index.d.ts +6 -0
- package/lib/client/ui/menu/items/index.js +6 -0
- package/lib/client/ui/menu/items/panels/AbstractUIMenuPanel.d.ts +17 -0
- package/lib/client/ui/menu/items/panels/AbstractUIMenuPanel.js +43 -0
- package/lib/client/ui/menu/items/panels/UIMenuColorPanel.d.ts +36 -0
- package/lib/client/ui/menu/items/panels/UIMenuColorPanel.js +211 -0
- package/lib/client/ui/menu/items/panels/UIMenuGridPanel.d.ts +40 -0
- package/lib/client/ui/menu/items/panels/UIMenuGridPanel.js +215 -0
- package/lib/client/ui/menu/items/panels/UIMenuPercentagePanel.d.ts +26 -0
- package/lib/client/ui/menu/items/panels/UIMenuPercentagePanel.js +115 -0
- package/lib/client/ui/menu/items/panels/UIMenuStatisticsPanel.d.ts +16 -0
- package/lib/client/ui/menu/items/panels/UIMenuStatisticsPanel.js +77 -0
- package/lib/client/ui/menu/items/panels/UIMenuStatisticsPanelItem.d.ts +13 -0
- package/lib/client/ui/menu/items/panels/UIMenuStatisticsPanelItem.js +32 -0
- package/lib/client/ui/menu/items/panels/index.d.ts +6 -0
- package/lib/client/ui/menu/items/panels/index.js +6 -0
- package/lib/client/ui/menu/modules/ListItem.d.ts +6 -0
- package/lib/client/ui/menu/modules/ListItem.js +8 -0
- package/lib/client/ui/menu/modules/index.d.ts +1 -0
- package/lib/client/ui/menu/modules/index.js +1 -0
- package/lib/client/utils/Animations.d.ts +19 -0
- package/lib/client/utils/Animations.js +55 -0
- package/lib/client/utils/Color.d.ts +15 -0
- package/lib/client/utils/Color.js +22 -0
- package/lib/client/utils/Crypto.d.ts +3 -0
- package/lib/client/utils/Crypto.js +25 -0
- package/lib/client/utils/LiteEvent.d.ts +13 -0
- package/lib/client/utils/LiteEvent.js +21 -0
- package/lib/client/utils/Maths.d.ts +4 -0
- package/lib/client/utils/Maths.js +10 -0
- package/lib/client/utils/Point.d.ts +9 -0
- package/lib/client/utils/Point.js +28 -0
- package/lib/client/utils/PointF.d.ts +12 -0
- package/lib/client/utils/PointF.js +11 -0
- package/lib/client/utils/Quaternion.d.ts +10 -0
- package/lib/client/utils/Quaternion.js +23 -0
- package/lib/client/utils/Size.d.ts +5 -0
- package/lib/client/utils/Size.js +6 -0
- package/lib/client/utils/String.d.ts +6 -0
- package/lib/client/utils/String.js +25 -0
- package/lib/client/utils/Vector2.d.ts +54 -0
- package/lib/client/utils/Vector2.js +106 -0
- package/lib/client/utils/Vector3.d.ts +69 -0
- package/lib/client/utils/Vector3.js +140 -0
- package/lib/client/utils/Vector4.d.ts +62 -0
- package/lib/client/utils/Vector4.js +124 -0
- package/lib/client/utils/enumValues.d.ts +12 -0
- package/lib/client/utils/enumValues.js +14 -0
- package/lib/client/utils/getStringFromUInt8Array.d.ts +8 -0
- package/lib/client/utils/getStringFromUInt8Array.js +10 -0
- package/lib/client/utils/getUInt32FromUint8Array.d.ts +8 -0
- package/lib/client/utils/getUInt32FromUint8Array.js +8 -0
- package/lib/client/utils/index.d.ts +10 -0
- package/lib/client/utils/index.js +10 -0
- package/lib/client/weapon/DlcWeaponData.d.ts +43 -0
- package/lib/client/weapon/DlcWeaponData.js +44 -0
- package/lib/client/weapon/Mk2WeaponHash.d.ts +18 -0
- package/lib/client/weapon/Mk2WeaponHash.js +25 -0
- package/lib/client/weapon/Weapon.d.ts +169 -0
- package/lib/client/weapon/Weapon.js +267 -0
- package/lib/client/weapon/WeaponAsset.d.ts +55 -0
- package/lib/client/weapon/WeaponAsset.js +83 -0
- package/lib/client/weapon/WeaponCollection.d.ts +90 -0
- package/lib/client/weapon/WeaponCollection.js +186 -0
- package/lib/client/weapon/WeaponDisplayNameByHash.d.ts +6 -0
- package/lib/client/weapon/WeaponDisplayNameByHash.js +75 -0
- package/lib/client/weapon/WeaponGroup.d.ts +18 -0
- package/lib/client/weapon/WeaponGroup.js +19 -0
- package/lib/client/weapon/WeaponHudStats.d.ts +27 -0
- package/lib/client/weapon/WeaponHudStats.js +38 -0
- package/lib/client/weapon/WeaponLivery.d.ts +13 -0
- package/lib/client/weapon/WeaponLivery.js +14 -0
- package/lib/client/weapon/WeaponLiveryColor.d.ts +34 -0
- package/lib/client/weapon/WeaponLiveryColor.js +35 -0
- package/lib/client/weapon/WeaponTint.d.ts +42 -0
- package/lib/client/weapon/WeaponTint.js +43 -0
- package/lib/client/weapon/index.d.ts +8 -0
- package/lib/client/weapon/index.js +8 -0
- package/lib/client/weaponComponent/ComponentAttachmentPoint.d.ts +18 -0
- package/lib/client/weaponComponent/ComponentAttachmentPoint.js +19 -0
- package/lib/client/weaponComponent/ComponentAttachmentPointByHash.d.ts +7 -0
- package/lib/client/weaponComponent/ComponentAttachmentPointByHash.js +309 -0
- package/lib/client/weaponComponent/ComponentDisplayNameByHash.d.ts +6 -0
- package/lib/client/weaponComponent/ComponentDisplayNameByHash.js +280 -0
- package/lib/client/weaponComponent/DlcWeaponComponentData.d.ts +40 -0
- package/lib/client/weaponComponent/DlcWeaponComponentData.js +44 -0
- package/lib/client/weaponComponent/InvalidWeaponComponent.d.ts +12 -0
- package/lib/client/weaponComponent/InvalidWeaponComponent.js +28 -0
- package/lib/client/weaponComponent/WeaponComponent.d.ts +81 -0
- package/lib/client/weaponComponent/WeaponComponent.js +119 -0
- package/lib/client/weaponComponent/WeaponComponentCollection.d.ts +108 -0
- package/lib/client/weaponComponent/WeaponComponentCollection.js +172 -0
- package/lib/client/weaponComponent/WeaponComponentHash.d.ts +671 -0
- package/lib/client/weaponComponent/WeaponComponentHash.js +887 -0
- package/lib/client/weaponComponent/WeaponComponentHashesByWeaponHash.d.ts +8 -0
- package/lib/client/weaponComponent/WeaponComponentHashesByWeaponHash.js +823 -0
- package/lib/client/weaponComponent/WeaponComponentHudStats.d.ts +27 -0
- package/lib/client/weaponComponent/WeaponComponentHudStats.js +34 -0
- package/lib/client/weaponComponent/index.d.ts +5 -0
- package/lib/client/weaponComponent/index.js +5 -0
- package/lib/common/Convar.d.ts +8 -0
- package/lib/common/Convar.js +20 -0
- package/lib/common/Kvp.d.ts +91 -0
- package/lib/common/Kvp.js +161 -0
- package/lib/common/Resource.d.ts +14 -0
- package/lib/common/Resource.js +35 -0
- package/lib/common/index.d.ts +5 -0
- package/lib/common/index.js +5 -0
- package/lib/common/types.d.ts +6 -0
- package/lib/common/types.js +1 -0
- package/lib/common/utils/Color.d.ts +10 -0
- package/lib/common/utils/Color.js +17 -0
- package/lib/common/utils/Maths.d.ts +4 -0
- package/lib/common/utils/Maths.js +10 -0
- package/lib/common/utils/PointF.d.ts +12 -0
- package/lib/common/utils/PointF.js +11 -0
- package/lib/common/utils/Quaternion.d.ts +10 -0
- package/lib/common/utils/Quaternion.js +23 -0
- package/lib/common/utils/Vector2.d.ts +58 -0
- package/lib/common/utils/Vector2.js +113 -0
- package/lib/common/utils/Vector3.d.ts +73 -0
- package/lib/common/utils/Vector3.js +147 -0
- package/lib/common/utils/Vector4.d.ts +66 -0
- package/lib/common/utils/Vector4.js +131 -0
- package/lib/common/utils/cleanPlayerName.d.ts +6 -0
- package/lib/common/utils/cleanPlayerName.js +27 -0
- package/lib/common/utils/enumValues.d.ts +12 -0
- package/lib/common/utils/enumValues.js +14 -0
- package/lib/common/utils/getStringFromUInt8Array.d.ts +8 -0
- package/lib/common/utils/getStringFromUInt8Array.js +10 -0
- package/lib/common/utils/getUInt32FromUint8Array.d.ts +8 -0
- package/lib/common/utils/getUInt32FromUint8Array.js +8 -0
- package/lib/common/utils/index.d.ts +12 -0
- package/lib/common/utils/index.js +12 -0
- package/lib/server/Anticheat.d.ts +0 -0
- package/lib/server/Anticheat.js +25 -0
- package/lib/server/Events.d.ts +35 -0
- package/lib/server/Events.js +102 -0
- package/lib/server/Game.d.ts +56 -0
- package/lib/server/Game.js +86 -0
- package/lib/server/cfx/StateBagChangeHandler.d.ts +9 -0
- package/lib/server/cfx/StateBagChangeHandler.js +4 -0
- package/lib/server/cfx/index.d.ts +7 -0
- package/lib/server/cfx/index.js +1 -0
- package/lib/server/entities/BaseEntity.d.ts +115 -0
- package/lib/server/entities/BaseEntity.js +161 -0
- package/lib/server/entities/Entity.d.ts +18 -0
- package/lib/server/entities/Entity.js +22 -0
- package/lib/server/entities/Ped.d.ts +87 -0
- package/lib/server/entities/Ped.js +122 -0
- package/lib/server/entities/Player.d.ts +163 -0
- package/lib/server/entities/Player.js +235 -0
- package/lib/server/entities/Prop.d.ts +32 -0
- package/lib/server/entities/Prop.js +42 -0
- package/lib/server/entities/Vehicle.d.ts +230 -0
- package/lib/server/entities/Vehicle.js +331 -0
- package/lib/server/entities/index.d.ts +5 -0
- package/lib/server/entities/index.js +5 -0
- package/lib/server/enum/ClassTypes.d.ts +11 -0
- package/lib/server/enum/ClassTypes.js +12 -0
- package/lib/server/enum/PopulationType.d.ts +13 -0
- package/lib/server/enum/PopulationType.js +14 -0
- package/lib/server/enum/VehicleLockStatus.d.ts +9 -0
- package/lib/server/enum/VehicleLockStatus.js +10 -0
- package/lib/server/enum/VehicleType.d.ts +10 -0
- package/lib/server/enum/VehicleType.js +11 -0
- package/lib/server/enum/eEntityType.d.ts +5 -0
- package/lib/server/enum/eEntityType.js +6 -0
- package/lib/server/enum/index.d.ts +5 -0
- package/lib/server/enum/index.js +5 -0
- package/lib/server/index.d.ts +7 -0
- package/lib/server/index.js +7 -0
- package/lib/server/type/Anticheat.d.ts +471 -0
- package/lib/server/type/Anticheat.js +160 -0
- package/lib/server/type/Hash.d.ts +3 -0
- package/lib/server/type/Hash.js +2 -0
- package/lib/server/utils/index.d.ts +1 -0
- package/lib/server/utils/index.js +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,459 @@
|
|
|
1
|
+
import { Blip } from '../Blip';
|
|
2
|
+
import { ForceType } from '../enums';
|
|
3
|
+
import { Game } from '../Game';
|
|
4
|
+
import { Model } from '../Model';
|
|
5
|
+
import { Quaternion, Vector3 } from '../utils';
|
|
6
|
+
import { EntityBoneCollection, Ped, Prop, Vehicle } from './';
|
|
7
|
+
import cfx from '../cfx';
|
|
8
|
+
import { Entity } from '..';
|
|
9
|
+
import { ClassTypes } from '../enums/ClassTypes';
|
|
10
|
+
export class BaseEntity {
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated you should use class specific fromHandle instead of this wrapper
|
|
13
|
+
*/
|
|
14
|
+
static fromHandle(handle) {
|
|
15
|
+
switch (GetEntityType(handle)) {
|
|
16
|
+
case 1:
|
|
17
|
+
return new Ped(handle);
|
|
18
|
+
case 2:
|
|
19
|
+
return new Vehicle(handle);
|
|
20
|
+
case 3:
|
|
21
|
+
return new Prop(handle);
|
|
22
|
+
default:
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
static fromNetworkId(networkId) {
|
|
27
|
+
return new BaseEntity(NetworkGetEntityFromNetworkId(networkId));
|
|
28
|
+
}
|
|
29
|
+
constructor(handle) {
|
|
30
|
+
this.stateBagCookies = [];
|
|
31
|
+
this.netId = null;
|
|
32
|
+
this.type = ClassTypes.Entity;
|
|
33
|
+
this.handle = handle;
|
|
34
|
+
if (this.IsNetworked) {
|
|
35
|
+
this.netId = this.NetworkId;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
get Handle() {
|
|
39
|
+
return this.handle;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @returns if the entity is a networked entity or local entity
|
|
43
|
+
*/
|
|
44
|
+
get IsNetworked() {
|
|
45
|
+
return NetworkGetEntityIsNetworked(this.handle);
|
|
46
|
+
}
|
|
47
|
+
set IsNetworked(networked) {
|
|
48
|
+
if (networked) {
|
|
49
|
+
NetworkRegisterEntityAsNetworked(this.handle);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
NetworkUnregisterNetworkedEntity(this.handle);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
get NetworkId() {
|
|
56
|
+
if (this.netId) {
|
|
57
|
+
return this.netId;
|
|
58
|
+
}
|
|
59
|
+
return NetworkGetNetworkIdFromEntity(this.handle);
|
|
60
|
+
}
|
|
61
|
+
get IsNetworkConcealed() {
|
|
62
|
+
return NetworkIsEntityConcealed(this.handle);
|
|
63
|
+
}
|
|
64
|
+
set IsNetworkConcealed(concealed) {
|
|
65
|
+
NetworkConcealEntity(this.handle, concealed);
|
|
66
|
+
}
|
|
67
|
+
get State() {
|
|
68
|
+
return cfx.Entity(this.handle).state;
|
|
69
|
+
}
|
|
70
|
+
AddStateBagChangeHandler(keyFilter, handler) {
|
|
71
|
+
const stateBagName = this.IsNetworked
|
|
72
|
+
? `entity:${this.NetworkId}`
|
|
73
|
+
: `localEntity:${this.handle}`;
|
|
74
|
+
// keyFilter is casted to any because it can take a null value.
|
|
75
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
76
|
+
const cookie = AddStateBagChangeHandler(keyFilter, stateBagName, handler);
|
|
77
|
+
this.stateBagCookies.push(cookie);
|
|
78
|
+
return cookie;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* A short hand function for AddStateBagChangeHandler, this gets automatically cleaned up on entity deletion.
|
|
82
|
+
* @param keyFilter the key to filter for or null
|
|
83
|
+
* @param handler the function to handle the change
|
|
84
|
+
* @returns a cookie to be used in RemoveStateBagChangeHandler
|
|
85
|
+
*/
|
|
86
|
+
listenForStateChange(keyFilter, handler) {
|
|
87
|
+
return this.AddStateBagChangeHandler(keyFilter, handler);
|
|
88
|
+
}
|
|
89
|
+
removeStateListener(tgtCookie) {
|
|
90
|
+
this.stateBagCookies = this.stateBagCookies.filter(cookie => {
|
|
91
|
+
const isCookie = cookie == tgtCookie;
|
|
92
|
+
if (isCookie)
|
|
93
|
+
RemoveStateBagChangeHandler(cookie);
|
|
94
|
+
return isCookie;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
get Owner() {
|
|
98
|
+
return NetworkGetEntityOwner(this.handle);
|
|
99
|
+
}
|
|
100
|
+
isPlayerOwner(player) {
|
|
101
|
+
return this.Owner === player.Handle;
|
|
102
|
+
}
|
|
103
|
+
get Speed() {
|
|
104
|
+
return GetEntitySpeed(this.handle);
|
|
105
|
+
}
|
|
106
|
+
getSpeedVector(isRelative = false) {
|
|
107
|
+
return Vector3.fromArray(GetEntitySpeedVector(this.handle, isRelative));
|
|
108
|
+
}
|
|
109
|
+
get ForwardVector() {
|
|
110
|
+
return Vector3.fromArray(GetEntityForwardVector(this.handle));
|
|
111
|
+
}
|
|
112
|
+
get Matrix() {
|
|
113
|
+
return Vector3.fromArrays(GetEntityMatrix(this.handle));
|
|
114
|
+
}
|
|
115
|
+
set Matrix(vectors) {
|
|
116
|
+
if (vectors.length !== 4)
|
|
117
|
+
throw Error(`Expected 4 Vectors, got ${vectors.length}`);
|
|
118
|
+
const [forward, right, up, pos] = vectors;
|
|
119
|
+
SetEntityMatrix(this.handle, forward.x, forward.y, forward.z, right.x, right.y, right.z, up.x, up.y, up.z, pos.x, pos.y, pos.z);
|
|
120
|
+
}
|
|
121
|
+
get Health() {
|
|
122
|
+
return GetEntityHealth(this.handle);
|
|
123
|
+
}
|
|
124
|
+
set Health(amount) {
|
|
125
|
+
SetEntityHealth(this.handle, amount);
|
|
126
|
+
}
|
|
127
|
+
get MaxHealth() {
|
|
128
|
+
return GetEntityMaxHealth(this.handle);
|
|
129
|
+
}
|
|
130
|
+
set MaxHealth(amount) {
|
|
131
|
+
SetEntityMaxHealth(this.handle, amount);
|
|
132
|
+
}
|
|
133
|
+
set IsDead(value) {
|
|
134
|
+
if (value) {
|
|
135
|
+
SetEntityHealth(this.handle, 0);
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
SetEntityHealth(this.handle, 200);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
get IsDead() {
|
|
142
|
+
return IsEntityDead(this.handle);
|
|
143
|
+
}
|
|
144
|
+
get IsAlive() {
|
|
145
|
+
return !IsEntityDead(this.handle);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* @deprecated use [[IsDead]] instead
|
|
149
|
+
*/
|
|
150
|
+
isDead() {
|
|
151
|
+
return IsEntityDead(this.handle);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* @deprecated use [[IsAlive]] instead
|
|
155
|
+
*/
|
|
156
|
+
isAlive() {
|
|
157
|
+
return !this.isDead();
|
|
158
|
+
}
|
|
159
|
+
get Model() {
|
|
160
|
+
return new Model(GetEntityModel(this.handle));
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Returns if the entity is set as a mission entity and will not be cleaned up by the engine
|
|
164
|
+
*/
|
|
165
|
+
get IsMissionEntity() {
|
|
166
|
+
return IsEntityAMissionEntity(this.handle);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Sets if the entity is a mission entity and will not be cleaned up by the engine
|
|
170
|
+
*/
|
|
171
|
+
set IsMissionEntity(value) {
|
|
172
|
+
if (value) {
|
|
173
|
+
SetEntityAsMissionEntity(this.handle, false, false);
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
SetEntityAsNoLongerNeeded(this.handle);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
get Position() {
|
|
180
|
+
return Vector3.fromArray(GetEntityCoords(this.handle, false));
|
|
181
|
+
}
|
|
182
|
+
set Position(position) {
|
|
183
|
+
SetEntityCoords(this.handle, position.x, position.y, position.z, false, false, false, true);
|
|
184
|
+
}
|
|
185
|
+
set PositionNoOffset(position) {
|
|
186
|
+
SetEntityCoordsNoOffset(this.handle, position.x, position.y, position.z, true, true, true);
|
|
187
|
+
}
|
|
188
|
+
get Rotation() {
|
|
189
|
+
return Vector3.fromArray(GetEntityRotation(this.handle, 2));
|
|
190
|
+
}
|
|
191
|
+
set Rotation(rotation) {
|
|
192
|
+
SetEntityRotation(this.handle, rotation.x, rotation.y, rotation.z, 2, true);
|
|
193
|
+
}
|
|
194
|
+
get Quaternion() {
|
|
195
|
+
const quaternion = GetEntityQuaternion(this.handle);
|
|
196
|
+
return new Quaternion(quaternion[0], quaternion[1], quaternion[2], quaternion[3]);
|
|
197
|
+
}
|
|
198
|
+
set Quaternion(quaternion) {
|
|
199
|
+
SetEntityQuaternion(this.handle, quaternion.x, quaternion.y, quaternion.z, quaternion.w);
|
|
200
|
+
}
|
|
201
|
+
get Heading() {
|
|
202
|
+
return GetEntityHeading(this.handle);
|
|
203
|
+
}
|
|
204
|
+
set Heading(heading) {
|
|
205
|
+
SetEntityHeading(this.handle, heading);
|
|
206
|
+
}
|
|
207
|
+
get IsPositionFrozen() {
|
|
208
|
+
return IsEntityPositionFrozen(this.handle);
|
|
209
|
+
}
|
|
210
|
+
set IsPositionFrozen(value) {
|
|
211
|
+
FreezeEntityPosition(this.handle, value);
|
|
212
|
+
}
|
|
213
|
+
get Velocity() {
|
|
214
|
+
return Vector3.fromArray(GetEntityVelocity(this.handle));
|
|
215
|
+
}
|
|
216
|
+
set Velocity(velocity) {
|
|
217
|
+
SetEntityVelocity(this.handle, velocity.x, velocity.y, velocity.z);
|
|
218
|
+
}
|
|
219
|
+
get RotationVelocity() {
|
|
220
|
+
return Vector3.fromArray(GetEntityRotationVelocity(this.handle));
|
|
221
|
+
}
|
|
222
|
+
set MaxSpeed(value) {
|
|
223
|
+
SetEntityMaxSpeed(this.handle, value);
|
|
224
|
+
}
|
|
225
|
+
set HasGravity(value) {
|
|
226
|
+
SetEntityHasGravity(this.handle, value);
|
|
227
|
+
}
|
|
228
|
+
get HeightAboveGround() {
|
|
229
|
+
return GetEntityHeightAboveGround(this.handle);
|
|
230
|
+
}
|
|
231
|
+
get SubmersionLevel() {
|
|
232
|
+
return GetEntitySubmergedLevel(this.handle);
|
|
233
|
+
}
|
|
234
|
+
get LodDistance() {
|
|
235
|
+
return GetEntityLodDist(this.handle);
|
|
236
|
+
}
|
|
237
|
+
set LodDistance(value) {
|
|
238
|
+
SetEntityLodDist(this.handle, value);
|
|
239
|
+
}
|
|
240
|
+
get IsVisible() {
|
|
241
|
+
return IsEntityVisible(this.handle);
|
|
242
|
+
}
|
|
243
|
+
set IsVisible(value) {
|
|
244
|
+
SetEntityVisible(this.handle, value, false);
|
|
245
|
+
}
|
|
246
|
+
get IsOccluded() {
|
|
247
|
+
return IsEntityOccluded(this.handle);
|
|
248
|
+
}
|
|
249
|
+
get IsOnScreen() {
|
|
250
|
+
return IsEntityOnScreen(this.handle);
|
|
251
|
+
}
|
|
252
|
+
get IsUpright() {
|
|
253
|
+
return IsEntityUpright(this.handle, 0);
|
|
254
|
+
}
|
|
255
|
+
get IsUpsideDown() {
|
|
256
|
+
return IsEntityUpsidedown(this.handle);
|
|
257
|
+
}
|
|
258
|
+
get IsInAir() {
|
|
259
|
+
return IsEntityInAir(this.handle);
|
|
260
|
+
}
|
|
261
|
+
get IsInWater() {
|
|
262
|
+
return IsEntityInWater(this.handle);
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* @deprecated use [[IsMissionEntity]] instead as its more obvious as what it does
|
|
266
|
+
*/
|
|
267
|
+
get IsPersistent() {
|
|
268
|
+
return IsEntityAMissionEntity(this.handle);
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* @deprecated use [[IsMissionEntity]] instead as its more obvious as what it does
|
|
272
|
+
*/
|
|
273
|
+
set IsPersistent(value) {
|
|
274
|
+
if (value) {
|
|
275
|
+
SetEntityAsMissionEntity(this.handle, true, false);
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
SetEntityAsNoLongerNeeded(this.handle);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
get IsOnFire() {
|
|
282
|
+
return IsEntityOnFire(this.handle);
|
|
283
|
+
}
|
|
284
|
+
set IsInvincible(value) {
|
|
285
|
+
SetEntityInvincible(this.handle, value);
|
|
286
|
+
}
|
|
287
|
+
set IsOnlyDamagedByPlayer(value) {
|
|
288
|
+
SetEntityOnlyDamagedByPlayer(this.handle, value);
|
|
289
|
+
}
|
|
290
|
+
get Opacity() {
|
|
291
|
+
return GetEntityAlpha(this.handle);
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Sets how transparent an entity is, if you want to reset the alpha level use [[resetOpacity]] instead;
|
|
295
|
+
*/
|
|
296
|
+
set Opacity(value) {
|
|
297
|
+
SetEntityAlpha(this.handle, value, false);
|
|
298
|
+
}
|
|
299
|
+
resetOpacity() {
|
|
300
|
+
ResetEntityAlpha(this.handle);
|
|
301
|
+
}
|
|
302
|
+
get HasCollided() {
|
|
303
|
+
return HasEntityCollidedWithAnything(this.handle);
|
|
304
|
+
}
|
|
305
|
+
get MaterialCollidingWith() {
|
|
306
|
+
return GetLastMaterialHitByEntity(this.handle);
|
|
307
|
+
}
|
|
308
|
+
get IsCollisionEnabled() {
|
|
309
|
+
return !GetEntityCollisonDisabled(this.handle);
|
|
310
|
+
}
|
|
311
|
+
set IsCollisionEnabled(value) {
|
|
312
|
+
SetEntityCollision(this.handle, value, false);
|
|
313
|
+
}
|
|
314
|
+
set IsRecordingCollisions(value) {
|
|
315
|
+
SetEntityRecordsCollisions(this.handle, value);
|
|
316
|
+
}
|
|
317
|
+
get Bones() {
|
|
318
|
+
if (!this.bones) {
|
|
319
|
+
this.bones = new EntityBoneCollection(this);
|
|
320
|
+
}
|
|
321
|
+
return this.bones;
|
|
322
|
+
}
|
|
323
|
+
get AttachedBlip() {
|
|
324
|
+
const handle = GetBlipFromEntity(this.handle);
|
|
325
|
+
if (DoesBlipExist(handle)) {
|
|
326
|
+
return new Blip(handle);
|
|
327
|
+
}
|
|
328
|
+
return null;
|
|
329
|
+
}
|
|
330
|
+
attachBlip() {
|
|
331
|
+
return new Blip(AddBlipForEntity(this.handle));
|
|
332
|
+
}
|
|
333
|
+
setNoCollision(entity, toggle) {
|
|
334
|
+
SetEntityNoCollisionEntity(this.handle, entity.Handle, toggle);
|
|
335
|
+
}
|
|
336
|
+
hasClearLosToEntity(entity, traceType = 17) {
|
|
337
|
+
return HasEntityClearLosToEntity(this.handle, entity.Handle, traceType);
|
|
338
|
+
}
|
|
339
|
+
hasClearLosToEntityInFront(entity) {
|
|
340
|
+
return HasEntityClearLosToEntityInFront(this.handle, entity.Handle);
|
|
341
|
+
}
|
|
342
|
+
hasBeenDamagedBy(entity) {
|
|
343
|
+
return HasEntityBeenDamagedByEntity(this.handle, entity.Handle, true);
|
|
344
|
+
}
|
|
345
|
+
hasBeenDamagedByWeapon(weapon) {
|
|
346
|
+
return HasEntityBeenDamagedByWeapon(this.handle, Number(weapon), 0);
|
|
347
|
+
}
|
|
348
|
+
hasBeenDamagedByAnyWeapon() {
|
|
349
|
+
return HasEntityBeenDamagedByWeapon(this.handle, 0, 2);
|
|
350
|
+
}
|
|
351
|
+
hasBeenDamagedByAnyMeleeWeapon() {
|
|
352
|
+
return HasEntityBeenDamagedByWeapon(this.handle, 0, 1);
|
|
353
|
+
}
|
|
354
|
+
clearLastWeaponDamage() {
|
|
355
|
+
ClearEntityLastWeaponDamage(this.handle);
|
|
356
|
+
}
|
|
357
|
+
isInArea(minBounds, maxBounds) {
|
|
358
|
+
return IsEntityInArea(this.handle, minBounds.x, minBounds.y, minBounds.z, maxBounds.x, maxBounds.y, maxBounds.z, false, false, 0);
|
|
359
|
+
}
|
|
360
|
+
isInAngledArea(origin, edge, angle) {
|
|
361
|
+
return IsEntityInAngledArea(this.handle, origin.x, origin.y, origin.z, edge.x, edge.y, edge.z, angle, false, true, 0);
|
|
362
|
+
}
|
|
363
|
+
isInRangeOf(position, range) {
|
|
364
|
+
const v = Vector3.subtract(this.Position, position);
|
|
365
|
+
return v.dotProduct(v) < range * range;
|
|
366
|
+
}
|
|
367
|
+
isNearEntity(entity, bounds) {
|
|
368
|
+
return IsEntityAtEntity(this.handle, entity.Handle, bounds.x, bounds.y, bounds.z, false, true, 0);
|
|
369
|
+
}
|
|
370
|
+
isTouching(entity) {
|
|
371
|
+
return IsEntityTouchingEntity(this.handle, entity.Handle);
|
|
372
|
+
}
|
|
373
|
+
isTouchingModel(model) {
|
|
374
|
+
return IsEntityTouchingModel(this.handle, model.Hash);
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* @param offset: the amount to offset from the entity
|
|
378
|
+
* @returns the offset position from the entity in world coords
|
|
379
|
+
*/
|
|
380
|
+
getOffsetPosition(offset) {
|
|
381
|
+
return Vector3.fromArray(GetOffsetFromEntityInWorldCoords(this.handle, offset.x, offset.y, offset.z));
|
|
382
|
+
}
|
|
383
|
+
getPositionOffset(worldCoords) {
|
|
384
|
+
return Vector3.fromArray(GetOffsetFromEntityGivenWorldCoords(this.handle, worldCoords.x, worldCoords.y, worldCoords.z));
|
|
385
|
+
}
|
|
386
|
+
attachTo(entity, position, rotation, collisions = false, unk9 = true, useSoftPinning = true, rotationOrder = 1) {
|
|
387
|
+
if (this.handle == entity.Handle) {
|
|
388
|
+
throw new Error('You cannot attach an entity to the same entity this will result in a crash!');
|
|
389
|
+
}
|
|
390
|
+
AttachEntityToEntity(this.handle, entity.Handle, -1, position.x, position.y, position.z, rotation.x, rotation.y, rotation.z, unk9, useSoftPinning, collisions, IsEntityAPed(entity.Handle), rotationOrder, true);
|
|
391
|
+
}
|
|
392
|
+
/*
|
|
393
|
+
* Attaches an entity to another entity via a bone
|
|
394
|
+
* @example
|
|
395
|
+
* ```typescript
|
|
396
|
+
* const ply = Game.PlayerPed;
|
|
397
|
+
* const bag = await World.createProp(new Model('ba_prop_battle_bag_01b'), ply.Position, true, true, true);
|
|
398
|
+
* bag.attachToBone(
|
|
399
|
+
* ply.Bones.getBone(64113),
|
|
400
|
+
* new Vector3(0.12, -0.25, 0.0),
|
|
401
|
+
* new Vector3(105.0, 50.0, 190.0)
|
|
402
|
+
* )
|
|
403
|
+
* ```
|
|
404
|
+
*/
|
|
405
|
+
attachToBone(entityBone, position, rotation, collisions = false, unk9 = true, useSoftPinning = true, rotationOrder = 1) {
|
|
406
|
+
if (this.handle == entityBone.Owner.Handle) {
|
|
407
|
+
throw new Error('You cannot attach an entity to the same entity this will result in a crash!');
|
|
408
|
+
}
|
|
409
|
+
AttachEntityToEntity(this.handle, entityBone.Owner.Handle, entityBone.Index, position.x, position.y, position.z, rotation.x, rotation.y, rotation.z, unk9, useSoftPinning, collisions, IsEntityAPed(entityBone.Owner.Handle), rotationOrder, true);
|
|
410
|
+
}
|
|
411
|
+
detach() {
|
|
412
|
+
DetachEntity(this.handle, true, true);
|
|
413
|
+
}
|
|
414
|
+
isAttached() {
|
|
415
|
+
return IsEntityAttached(this.handle);
|
|
416
|
+
}
|
|
417
|
+
isAttachedTo(entity) {
|
|
418
|
+
return IsEntityAttachedToEntity(this.handle, entity.Handle);
|
|
419
|
+
}
|
|
420
|
+
getEntityAttachedTo() {
|
|
421
|
+
return Entity.fromHandle(GetEntityAttachedTo(this.handle));
|
|
422
|
+
}
|
|
423
|
+
applyForce(direction, rotation, forceType = ForceType.MaxForceRot2) {
|
|
424
|
+
ApplyForceToEntity(this.handle, Number(forceType), direction.x, direction.y, direction.z, rotation.x, rotation.y, rotation.z, 0, false, true, true, false, true);
|
|
425
|
+
}
|
|
426
|
+
applyForceRelative(direction, rotation, forceType = ForceType.MaxForceRot2) {
|
|
427
|
+
ApplyForceToEntity(this.handle, Number(forceType), direction.x, direction.y, direction.z, rotation.x, rotation.y, rotation.z, 0, true, true, true, false, true);
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Removes all particle effects from the entity
|
|
431
|
+
*/
|
|
432
|
+
removePtfxEffects() {
|
|
433
|
+
RemoveParticleFxFromEntity(this.handle);
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* @deprecated use [[removePtfxEffects]]
|
|
437
|
+
*/
|
|
438
|
+
removeAllParticleEffects() {
|
|
439
|
+
this.removePtfxEffects();
|
|
440
|
+
}
|
|
441
|
+
exists() {
|
|
442
|
+
return DoesEntityExist(this.handle);
|
|
443
|
+
}
|
|
444
|
+
delete() {
|
|
445
|
+
if (this.handle !== Game.PlayerPed.Handle) {
|
|
446
|
+
this.IsMissionEntity = true;
|
|
447
|
+
DeleteEntity(this.handle);
|
|
448
|
+
for (const cookie of this.stateBagCookies) {
|
|
449
|
+
RemoveStateBagChangeHandler(cookie);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* @deprecated use [[IsMissionEntity]] setter as false instead.
|
|
455
|
+
*/
|
|
456
|
+
markAsNoLongerNeeded() {
|
|
457
|
+
SetEntityAsNoLongerNeeded(this.Handle);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Ped, Prop, Vehicle } from './';
|
|
2
|
+
import { ClassTypes } from '../enums/ClassTypes';
|
|
3
|
+
import { BaseEntity } from './BaseEntity';
|
|
4
|
+
export declare class Entity extends BaseEntity {
|
|
5
|
+
static fromHandle(handle: number): Ped | Vehicle | Prop | null;
|
|
6
|
+
static fromNetworkId(networkId: number): Ped | Vehicle | Prop | null;
|
|
7
|
+
protected type: ClassTypes;
|
|
8
|
+
constructor(handle: number);
|
|
9
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Ped, Prop, Vehicle } from './';
|
|
2
|
+
import { ClassTypes } from '../enums/ClassTypes';
|
|
3
|
+
import { BaseEntity } from './BaseEntity';
|
|
4
|
+
export class Entity extends BaseEntity {
|
|
5
|
+
static fromHandle(handle) {
|
|
6
|
+
switch (GetEntityType(handle)) {
|
|
7
|
+
case 1:
|
|
8
|
+
return new Ped(handle);
|
|
9
|
+
case 2:
|
|
10
|
+
return new Vehicle(handle);
|
|
11
|
+
case 3:
|
|
12
|
+
return new Prop(handle);
|
|
13
|
+
default:
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
static fromNetworkId(networkId) {
|
|
18
|
+
return this.fromHandle(NetworkGetEntityFromNetworkId(networkId));
|
|
19
|
+
}
|
|
20
|
+
constructor(handle) {
|
|
21
|
+
super(handle);
|
|
22
|
+
this.type = ClassTypes.Entity;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Vector3 } from '../utils';
|
|
2
|
+
import type { BaseEntity } from './BaseEntity';
|
|
3
|
+
export declare class EntityBone {
|
|
4
|
+
get Index(): number;
|
|
5
|
+
get Owner(): BaseEntity;
|
|
6
|
+
get Position(): Vector3;
|
|
7
|
+
get Rotation(): Vector3;
|
|
8
|
+
get IsValid(): boolean;
|
|
9
|
+
protected readonly owner: BaseEntity;
|
|
10
|
+
protected readonly index: number;
|
|
11
|
+
constructor(owner: BaseEntity, boneIndex?: number, boneName?: string);
|
|
12
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Vector3 } from '../utils';
|
|
2
|
+
export class EntityBone {
|
|
3
|
+
get Index() {
|
|
4
|
+
return this.index;
|
|
5
|
+
}
|
|
6
|
+
get Owner() {
|
|
7
|
+
return this.owner;
|
|
8
|
+
}
|
|
9
|
+
get Position() {
|
|
10
|
+
return Vector3.fromArray(GetWorldPositionOfEntityBone(this.owner.Handle, this.index));
|
|
11
|
+
}
|
|
12
|
+
get Rotation() {
|
|
13
|
+
return Vector3.fromArray(GetEntityBoneRotation(this.owner.Handle, this.index));
|
|
14
|
+
}
|
|
15
|
+
get IsValid() {
|
|
16
|
+
return this.owner.exists() && this.index !== -1;
|
|
17
|
+
}
|
|
18
|
+
constructor(owner, boneIndex, boneName) {
|
|
19
|
+
this.owner = owner;
|
|
20
|
+
this.index = boneIndex
|
|
21
|
+
? boneIndex
|
|
22
|
+
: GetEntityBoneIndexByName(this.owner.Handle, boneName ?? '');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EntityBone } from './';
|
|
2
|
+
import type { BaseEntity } from './BaseEntity';
|
|
3
|
+
export declare class EntityBoneCollection {
|
|
4
|
+
protected readonly owner: BaseEntity;
|
|
5
|
+
private readonly _collection;
|
|
6
|
+
private _currentIndex;
|
|
7
|
+
constructor(owner: BaseEntity);
|
|
8
|
+
hasBone(name: string): boolean;
|
|
9
|
+
getBone(boneIndex?: number, boneName?: string): EntityBone;
|
|
10
|
+
get Core(): EntityBone;
|
|
11
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EntityBone } from './';
|
|
2
|
+
export class EntityBoneCollection {
|
|
3
|
+
constructor(owner) {
|
|
4
|
+
this._currentIndex = -1;
|
|
5
|
+
this.owner = owner;
|
|
6
|
+
}
|
|
7
|
+
hasBone(name) {
|
|
8
|
+
return GetEntityBoneIndexByName(this.owner.Handle, name) !== -1;
|
|
9
|
+
}
|
|
10
|
+
getBone(boneIndex, boneName) {
|
|
11
|
+
return new EntityBone(this.owner, boneIndex ? boneIndex : GetEntityBoneIndexByName(this.owner.Handle, boneName ?? ''));
|
|
12
|
+
}
|
|
13
|
+
get Core() {
|
|
14
|
+
return new EntityBone(this.owner, -1);
|
|
15
|
+
}
|
|
16
|
+
}
|