import type { eCarryingFlags } from '../enums/eCarryingFlags'; import type { eWeaponHash } from '../enums/eWeaponHash'; import type { Ped } from '../classes/Ped'; import type { Player } from '../classes/Player'; import type { Prop } from '../classes/Prop'; import type { Vehicle } from '../classes/Vehicle'; import { Vector2 } from '../types/Vector2'; import { Vector3 } from '../types/Vector3'; import { Vector4 } from '../types/Vector4'; import { Color } from '../types/Color'; import { IHandle } from '../types/IHandle'; import { registerHandle, createFromHandle } from '../types/HandleRegistry'; import { inv, rai, raf, ras, rav, pvi, pvf, pvv, pvii, pvfi, _h, f, int, uint, float, Hash, u8, u16, u32, u64, i8, i16, i32, i64 } from '../types/NativeAliases'; export class Entity implements IHandle { constructor(public handle: number) {} static fromHandle(handle: number): Entity | null { return handle === 0 ? null : new Entity(handle); } static fromNetworkId(netId: number): Entity | null { if (!inv('0x18A47D074708FD68', netId, rai())) return null; return Entity.fromHandle(inv('0xCE4E5D9B0A4FF560', netId, rai())); } /** * @param targetEntity * @returns */ isTouchingEntity(targetEntity: Entity): boolean { return !!inv('0x9A2304A64C3C8423', this.handle, targetEntity.handle, rai()); } deleteCarriable(): void { inv('0x0D0DB2B6AF19A987', this.handle); } /** * Returns a normalized value between 0.0f and 1.0f. You can get the actual anim time by multiplying this by GET_ANIM_DURATION * * @param animDict * @param animName * @returns */ getAnimCurrentTime(animDict: string, animName: string): float { return inv('0x627520389E288A73', this.handle, animDict, animName, raf()); } /** * @param entity2 * @param thisFrameOnly * @returns The instance for method chaining */ setNoCollisionEntity(entity2: Entity, thisFrameOnly: boolean): this { inv('0xE037BF068223C38D', this.handle, entity2.handle, thisFrameOnly); return this; } /** * Result is in meters per second (m/s) * * @returns */ get Speed(): float { return inv('0xFB6BA510A533DF81', this.handle, raf()); } /** * @param bOnlyDamagedWhenRunningScript */ set CanOnlyBeDamagedByScriptParticipants(bOnlyDamagedWhenRunningScript: boolean) { inv('0xFF83AF534156B399', this.handle, bOnlyDamagedWhenRunningScript); } /** * @param bOnlyDamagedWhenRunningScript * @returns The instance for method chaining */ setCanOnlyBeDamagedByScriptParticipants(bOnlyDamagedWhenRunningScript: boolean): this { inv('0xFF83AF534156B399', this.handle, bOnlyDamagedWhenRunningScript); return this; } /** * @returns */ get IsTrackedVisible(): boolean { return !!inv('0xC8CCDB712FBCBA92', this.handle, rai()); } /** * @param p1 The entity to detach * @param collision Unknown, seems to set some flags */ detachEntity(p1: boolean, collision: boolean): void { inv('0x64CDE9D6BF8ECAD3', this.handle, p1, collision); } /** * @returns */ get IsVisibleToScript(): boolean { return !!inv('0xF213C724E77F321A', this.handle, rai()); } /** * @param entity2 * @param traceType * @returns */ hasClearLosToEntity(entity2: Entity, traceType: int): boolean { return !!inv('0xFCDFF7B72D23A1AC', this.handle, entity2.handle, traceType, rai()); } /** * Used in Script Function GENERIC_ITEM_HAS_ANIM_COMPLETED * *GET_ENTITY** * * @param animDict * @param animClip * @returns */ N_0x8E46E18AA828334F(animDict: string, animClip: string): float { return inv('0x8E46E18AA828334F', this.handle, animDict, animClip, raf()); } /** * @param playerPedToIgnore * @param flags * @returns */ getNearestPlayerToEntity(playerPedToIgnore: Ped, flags: int): Player | null { return createFromHandle('Player', inv('0x990E294FC387FB88', this.handle, playerPedToIgnore.handle, flags, rai())); } /** * Gets the Y-component of the entity's forward vector. * * @returns */ get ForwardY(): float { return inv('0x9A5C073ECBDA7EE7', this.handle, raf()); } /** * @param pitch * @param roll * @param yaw * @param rotationOrder * @param p5 * @returns The instance for method chaining */ setRotation(pitch: float, roll: float, yaw: float, rotationOrder: int, p5: boolean): this { inv('0x9CC8314DFEDE441E', this.handle, f(pitch), f(roll), f(yaw), rotationOrder, p5); return this; } /** * @param p1 * @param relationshipGroup * @returns The instance for method chaining */ setOnlyDamagedByRelationshipGroup(p1: boolean, relationshipGroup: string | number): this { inv('0x6C1F6AA2F0ADD104', this.handle, p1, _h(relationshipGroup)); return this; } /** * https://github.com/femga/rdr3_discoveries/tree/master/AI/ENTITY_PROOFS * BOOL p2: handles an additional special proofs flag, so it simply indicates whether it should be enabled or disabled, not sure what exactly it proofs the entity from though * * @param proofsBitset * @param specialFlag * @returns The instance for method chaining */ setProofs(proofsBitset: int, specialFlag: boolean): this { inv('0xFAEE099C6F890BB8', this.handle, proofsBitset, specialFlag); return this; } /** * @returns */ hasCollisionLoadedAroundEntity(): boolean { return !!inv('0xBEB1600952B9CF5C', this.handle, rai()); } /** * @returns */ get IsCarriablePelt(): any { return inv('0x255B6DB4E3AD3C3E', this.handle); } /** * @param p1 * @returns */ getVelocity(p1: int): Vector3 { return Vector3.fromArray(inv('0x4805D2B1D8CF94A9', this.handle, p1, rav())); } /** * @param toggle */ set CanAutoVaultOnEntity(toggle: boolean) { inv('0x80646744FA88F9D7', this.handle, toggle); } /** * @param toggle * @returns The instance for method chaining */ setCanAutoVaultOnEntity(toggle: boolean): this { inv('0x80646744FA88F9D7', this.handle, toggle); return this; } /** * Sets the loot table an entity will carry. Returns true if loot table has been successfully set. Returns false if entity is not a ped or object. * https://github.com/femga/rdr3_discoveries/blob/master/AI/EVENTS/loot_rewards.lua * * @param lootTable * @returns */ scriptOverrideLootTablePermanent(lootTable: string | number): any { return inv('0x8C03CD6B5E0E85E8', this.handle, _h(lootTable)); } /** * @returns argStruct */ get Script(): [number, number] { const result = inv<[number, number]>('0x2A08A32B6D49906F', this.handle, pvi(), rai()); return [result[0] & 0xFFFFFFFF, result[1]]; } /** * @param actionHash * @returns */ hasAnimEventFired(actionHash: string | number): boolean { return !!inv('0x5851CC48405F4A07', this.handle, _h(actionHash), rai()); } /** * @param p1 */ N_0xEF259AA1E097E0AD(p1: any): void { inv('0xEF259AA1E097E0AD', this.handle, p1); } /** * Getter for FREEZE_ENTITY_POSITION * * @returns */ get IsFrozen(): boolean { return !!inv('0x083D497D57B7400F', this.handle, rai()); } /** * Returns the entity that is looting a ped but only while the looting is active * * @returns */ get LootingPed(): Ped | null { return createFromHandle('Ped', inv('0xEF2D9ED7CE684F08', this.handle, rai())); } /** * @returns */ get IsWaitingForWorldCollision(): boolean { return !!inv('0x5E1CC2E8DC3111DD', this.handle, rai()); } /** * Gets the X-component of the entity's forward vector. * * @returns */ get ForwardX(): float { return inv('0xDB0954E9960F6457', this.handle, raf()); } /** * @returns Returns `true` if the `entity` is a ped */ get IsAPed(): boolean { return !!inv('0xCF8176912DDA4EA5', this.handle, rai()); } /** * @returns */ get Pitch(): float { return inv('0xEF355ABEFF7F5005', this.handle, raf()); } /** * @returns */ get IsStatic(): boolean { return !!inv('0x86468ADFA0F6B861', this.handle, rai()); } /** * @returns Returns the model hash of the entity */ get Model(): number { return (inv('0xDA76A9F39210D365', this.handle, rai())) & 0xFFFFFFFF; } /** * Deletes the specified entity, then sets the handle pointed to by the pointer to NULL. */ deleteEntity(): void { inv('0x4CD38C78BD19A497', this.handle); } /** * @param team * @param playerPedToIgnore * @param flags * @returns */ getNearestPlayerToOnTeam(team: int, playerPedToIgnore: Ped, flags: int): Player | null { return createFromHandle('Player', inv('0xB2C30C3B4AFF718C', this.handle, team, playerPedToIgnore.handle, flags, rai())); } /** * @param p1 */ N_0x80FDEB3A9E9AA578(p1: boolean): void { inv('0x80FDEB3A9E9AA578', this.handle, p1); } /** * Makes the specified entity (ped, vehicle or object) persistent. Persistent entities will not automatically be removed by the engine. * * @param p1 * @param p2 * @returns The instance for method chaining */ setAsMissionEntity(p1: boolean, p2: boolean): this { inv('0xDC19C288082E586E', this.handle, p1, p2); return this; } /** * Gets the entity's forward vector in XY(Z) eulers. * * @returns */ get ForwardVector(): Vector3 { return Vector3.fromArray(inv('0x2412D9C05BB09B97', this.handle, rav())); } /** * @param modelHash * @returns */ isTouchingModel(modelHash: string | number): boolean { return !!inv('0x2AE3EBC8DEB9768B', this.handle, _h(modelHash), rai()); } /** * * @remarks Peds cannot have their health set higher than their core attribute allow. * * * @remarks If `entityKilledBy` is a vehicle, internally it will automatically attribute the kill to the driver * Sets the entity's health to the specified `healthAmount`, setting this to `0` will kill the entity (if it's killable). * * @param healthAmount The entity to set the health of * @param entityKilledBy The amount of health the entity should have * @returns The instance for method chaining */ setHealth(healthAmount: u16, entityKilledBy: Entity | null = null): this { inv('0xAC2767ED8BDFAB15', this.handle, healthAmount, entityKilledBy?.handle ?? 0); return this; } set Health(healthAmount: u16) { this.setHealth(healthAmount); } /** * @param toggle */ set RenderScorched(toggle: boolean) { inv('0x85B8A7534E44BC23', this.handle, toggle); } /** * @param toggle * @returns The instance for method chaining */ setRenderScorched(toggle: boolean): this { inv('0x85B8A7534E44BC23', this.handle, toggle); return this; } /** * @param heading */ set Heading(heading: float) { inv('0xCF2B9C0645C4651B', this.handle, f(heading)); } /** * @param heading * @returns The instance for method chaining */ setHeading(heading: float): this { inv('0xCF2B9C0645C4651B', this.handle, f(heading)); return this; } /** * @returns */ get CollisionDisabled(): boolean { return !!inv('0xAA2FADD30F45A9DA', this.handle, rai()); } /** * Displays the current ROLL axis of the entity [-180.0000/180.0000+] * (Sideways Roll) such as a vehicle tipped on its side * * @returns */ get Roll(): float { return inv('0xBF966536FA8B6879', this.handle, raf()); } /** * @returns */ get NearestParticipantToEntity(): Player | null { return createFromHandle('Player', inv('0x6888A43C35A5F630', this.handle, rai())); } /** * Returns entityType: https://github.com/Halen84/RDR3-Native-Flags-And-Enums/tree/main/eEntityType * * @returns */ get Type(): int { return inv('0x97F696ACA466B4E0', this.handle, rai()); } /** * @returns */ get IsOwnedByPersistenceSystem(): boolean { return !!inv('0xA7E51B53309EAC97', this.handle, rai()); } /** * @param animDict * @param animName * @param animType * @returns */ isPlayingAnim(animDict: string, animName: string, animType: int): boolean { return !!inv('0xDEE49D5CA6C49148', this.handle, animDict, animName, animType, rai()); } /** * Marks the specified entity (ped, vehicle or object) as no longer needed, allowing the game engine to delete it whenever it sees fit. * * @returns The instance for method chaining */ setAsNoLongerNeeded(): this { inv('0x4971D2F8162B9674', this.handle); return this; } /** * @returns */ hasBeenDamagedByAnyVehicle(): boolean { return !!inv('0x695D7C26DE65C423', this.handle, rai()); } /** * @param animDict * @param animName * @param speedMultiplier * @returns The instance for method chaining */ setAnimSpeed(animDict: string, animName: string, speedMultiplier: float): this { inv('0xEAA885BA3CEA4E4A', this.handle, animDict, animName, f(speedMultiplier)); return this; } unpinMapEntity(): void { inv('0xD2B9C78537ED5759', this.handle); } /** * Get how much of the entity is submerged. 1.0f is whole entity. * * @returns */ get SubmergedLevel(): float { return inv('0x4A77C3F73FD9E831', this.handle, raf()); } /** * @returns */ get IsAttached(): boolean { return !!inv('0xEE6AD63ABF59C0B7', this.handle, rai()); } /** * SET_ENTITY_A* * * @param p1 */ N_0xC0EDEF16D90661EE(p1: float): void { inv('0xC0EDEF16D90661EE', this.handle, f(p1)); } /** * @param looted */ set FullyLooted(looted: boolean) { inv('0x6BCF5F3D8FFE988D', this.handle, looted); } /** * @param looted * @returns The instance for method chaining */ setFullyLooted(looted: boolean): this { inv('0x6BCF5F3D8FFE988D', this.handle, looted); return this; } /** * @returns */ get IsAttachedToAnyVehicle(): boolean { return !!inv('0x12DF6E0D2E736749', this.handle, rai()); } /** * @param p1 */ N_0xA48E4801DEBDF7E4(p1: boolean): void { inv('0xA48E4801DEBDF7E4', this.handle, p1); } /** * @param toggle * @param keepPhysics * @returns The instance for method chaining */ setCompletelyDisableCollision(toggle: boolean, keepPhysics: boolean): this { inv('0xE0580EC84813875A', this.handle, toggle, keepPhysics); return this; } /** * @param p1 */ N_0xCDB682BB47C02F0A(p1: string | number): void { inv('0xCDB682BB47C02F0A', this.handle, _h(p1)); } /** * @param volume * @param p2 * @param p3 * @returns */ isInVolume(volume: number, p2: boolean, p3: int): boolean { return !!inv('0x5A5526BC09C06623', this.handle, volume, p2, p3, rai()); } /** * @returns rightVector; forwardVector; upVector; position */ get Matrix(): [Vector3, Vector3, Vector3, Vector3] { const result = inv<[number[], number[], number[], number[]]>('0x3A9B1120AF13FBF2', this.handle, pvv(), pvv(), pvv(), pvv()); return [Vector3.fromArray(result[0]), Vector3.fromArray(result[1]), Vector3.fromArray(result[2]), Vector3.fromArray(result[3])]; } /** * Called if entity is in water and submerged level is larger than 1f. If CARRYING_FLAG_FORCE_ALLOW_WARP_TO_SAFE_GROUND_LOCATION is true, it gets disabled as well. */ N_0x371D179701D9C082(): void { inv('0x371D179701D9C082', this.handle); } /** * @param p1 * @returns */ getMaxHealth(p1: boolean = false): int { return inv('0x15D757606D170C3C', this.handle, p1, rai()); } get MaxHealth(): int { return this.getMaxHealth(); } /** * @param animDict * @param animName * @param time * @returns The instance for method chaining */ setAnimCurrentTime(animDict: string, animName: string, time: float): this { inv('0x11CDABDC7783B2BC', this.handle, animDict, animName, f(time)); return this; } /** * @param alive The entity to get the coords of * @param realCoords Unused, likely a leftover debug flag. * @returns The `entity`'s position, or `vector3(0, 0, 0)` if the `entity` was invalid. */ getCoords(alive: boolean = false, realCoords: boolean = false): Vector3 { return Vector3.fromArray(inv('0xA86D5F069399F44D', this.handle, alive, realCoords, rav())); } get Coords(): Vector3 { return this.getCoords(); } /** * @returns */ get IsAnObject(): boolean { return !!inv('0x0A27A546A375FDEF', this.handle, rai()); } /** * @returns */ get IsUpsidedown(): boolean { return !!inv('0x109DE3DA41AAD94A', this.handle, rai()); } /** * @param p1 * @returns */ doesBelongToThisScript(p1: boolean): boolean { return !!inv('0x622B1980CBE13332', this.handle, p1, rai()); } /** * Returns a hash of an entity's name. (Alternative Name: _GET_ENTITY_PROMPT_NAME_HASH) * * @returns */ get CarriableFromEntity(): number { return (inv('0x31FEF6A20F00B963', this.handle, rai())) & 0xFFFFFFFF; } /** * @param toggle * @param keepPhysics * @returns The instance for method chaining */ setCollision(toggle: boolean, keepPhysics: boolean): this { inv('0xF66F820909453B8C', this.handle, toggle, keepPhysics); return this; } /** * @param p1 * @returns */ placeOnGroundProperly(p1: boolean): any { return inv('0x9587913B9E772D29', this.handle, p1); } /** * @returns */ get IsInWater(): boolean { return !!inv('0xDDE5C125AC446723', this.handle, rai()); } /** * @returns Returns `true` if the entity exists * @example * ```lua * local ped = PlayerPedId() * local mount = GetMount(ped) * * if DoesEntityExist(mount) then * RemovePedFromMount(ped, true, false) * TaskAnimalFlee(mount, ped, -1) * end * ``` */ doesExist(): boolean { return !!inv('0xD42BD6EB2E0F1677', this.handle, rai()); } /** * @returns */ get Alpha(): u8 { return inv('0x1BB501624FAF2BEA', this.handle, rai()); } /** * This native only works on `Ped` and `Object` entity types * * @param flagId * @returns */ getCarryingFlag(flagId: eCarryingFlags): i8 { return inv('0x808077647856DE62', this.handle, flagId, rai()); } /** * @param p1 */ forceAiAndAnimationUpdate(p1: boolean): void { inv('0x4C9E96473D4F1A88', this.handle, p1); } /** * Axis - Invert Axis Flags * * @param pos * @param xAxis * @param yAxis * @param zAxis * @returns The instance for method chaining */ setCoordsNoOffset(pos: Vector3, xAxis: boolean, yAxis: boolean, zAxis: boolean): this { inv('0x239A3351AC1DA385', this.handle, f(pos.x), f(pos.y), f(pos.z), xAxis, yAxis, zAxis); return this; } /** * Returns (CUR_HEALTH / MAX_HEALTH) * * @returns */ get HealthFloat(): float { return inv('0x96C638784DB4C815', this.handle, raf()); } /** * @param entity2 * @param p2 * @param boneIndex * @param offset * @param p7 * @param p8 * @param p9 * @param p10 * @param p11 * @param p12 * @param p13 * @param p14 * @param p15 * @param p16 * @param p17 * @param p18 * @param p19 * @param p20 * @param p21 */ attachToEntityPhysically(entity2: Entity, p2: int, boneIndex: int, offset: Vector3, p7: float, p8: float, p9: float, p10: float, p11: float, p12: float, p13: float, p14: boolean, p15: boolean, p16: boolean, p17: boolean, p18: int, p19: boolean, p20: float, p21: float): void { inv('0xB629A43CA1643481', this.handle, entity2.handle, p2, boneIndex, f(offset.x), f(offset.y), f(offset.z), f(p7), f(p8), f(p9), f(p10), f(p11), f(p12), f(p13), p14, p15, p16, p17, p18, p19, f(p20), f(p21)); } /** * @returns */ get HeightAboveGround(): float { return inv('0x0D3B5BAEA08F63E9', this.handle, raf()); } /** * @param pos * @param heading * @param p5 * @param p6 * @returns The instance for method chaining */ setCoordsAndHeadingNoOffset(pos: Vector3, heading: float, p5: boolean, p6: boolean): this { inv('0x0918E3565C20F03C', this.handle, f(pos.x), f(pos.y), f(pos.z), f(heading), p5, p6); return this; } /** * Creates a spherical cone at origin that extends to surface with the angle specified. Then returns true if the entity is inside the spherical cone Angle is measured in degrees. * * @param originX * @param originY * @param originZ * @param edgeX * @param edgeY * @param edgeZ * @param angle * @param p8 * @param p9 * @param p10 * @returns */ isInAngledArea(originX: float, originY: float, originZ: float, edgeX: float, edgeY: float, edgeZ: float, angle: float, p8: boolean, p9: boolean, p10: any): boolean { return !!inv('0xD3151E53134595E5', this.handle, f(originX), f(originY), f(originZ), f(edgeX), f(edgeY), f(edgeZ), f(angle), p8, p9, p10, rai()); } clearLastDamageEntity(): void { inv('0xBB19AC7D4DCEFD0F', this.handle); } /** * @param toggle */ set AlwaysPrerender(toggle: boolean) { inv('0xACAD101E1FB66689', this.handle, toggle); } /** * @param toggle * @returns The instance for method chaining */ setAlwaysPrerender(toggle: boolean): this { inv('0xACAD101E1FB66689', this.handle, toggle); return this; } /** * Note that the third parameter(denoted as z) is "up and down" with positive numbers encouraging upwards movement. * * @param pos */ set Velocity(pos: Vector3) { inv('0x1C99BB7B6E96D16F', this.handle, f(pos.x), f(pos.y), f(pos.z)); } /** * Note that the third parameter(denoted as z) is "up and down" with positive numbers encouraging upwards movement. * * @param pos * @returns The instance for method chaining */ setVelocity(pos: Vector3): this { inv('0x1C99BB7B6E96D16F', this.handle, f(pos.x), f(pos.y), f(pos.z)); return this; } /** * SET_ENTITY_LO* * * @param p1 * @param p2 * @param p3 */ N_0xAF7F3099B9FEB535(p1: float, p2: float, p3: float): void { inv('0xAF7F3099B9FEB535', this.handle, f(p1), f(p2), f(p3)); } /** * @returns */ N_0xAF72EC7E1B54539B(): Entity | null { return createFromHandle('Entity', inv('0xAF72EC7E1B54539B', this.handle, rai())); } /** * Simply returns whatever is passed to it (Regardless of whether the handle is valid or not). * * @returns */ get ObjectIndexFromIndex(): Prop | null { return createFromHandle('Prop', inv('0x280BBE5601EAA983', this.handle, rai())); } /** * Has the entity1 got a clear line of sight to the other entity2 from the direction entity1 is facing. * * @param entity2 * @param traceType * @returns */ hasClearLosToEntityInFront(entity2: Entity, traceType: int): boolean { return !!inv('0xE88F19660651D566', this.handle, entity2.handle, traceType, rai()); } /** * @returns */ get IsOnTrainTrack(): boolean { return !!inv('0x857ACB0AB4BD0D55', this.handle, rai()); } /** * @param angle * @returns */ isUpright(angle: float): boolean { return !!inv('0xF6F6AFD8D4FB2658', this.handle, f(angle), rai()); } /** * @returns */ get IsBird(): any { return inv('0xC346A546612C49A9', this.handle); } /** * Gets the entity's forward vector in YX(Z) eulers. Similar to GET_ENTITY_FORWARD_VECTOR * * @returns */ get ForwardVectorYx(): Vector3 { return Vector3.fromArray(inv('0x935A30AA88FB1014', this.handle, rav())); } /** * @param pos * @param xAxis * @param yAxis * @param zAxis * @param clearArea * @returns The instance for method chaining */ setCoords(pos: Vector3, xAxis: boolean, yAxis: boolean, zAxis: boolean, clearArea: boolean): this { inv('0x06843DA7060A026B', this.handle, f(pos.x), f(pos.y), f(pos.z), xAxis, yAxis, zAxis, clearArea); return this; } /** * @param boneName * @returns */ getBoneIndexByName(boneName: string): int { return inv('0xBACA8FE9C76C124E', this.handle, boneName, rai()); } /** * @param pause */ pauseTracking(pause: boolean): void { inv('0x36EB4D34D4A092C5', this.handle, pause); } /** * @param toggle */ set LoadCollisionFlag(toggle: boolean) { inv('0x9B9EE31AED48072E', this.handle, toggle); } /** * @param toggle * @returns The instance for method chaining */ setLoadCollisionFlag(toggle: boolean): this { inv('0x9B9EE31AED48072E', this.handle, toggle); return this; } /** * Changes type and quality of skins * type hashes: https://pastebin.com/C1WvQjCy * * @param type */ set CarcassType(type: string | number) { inv('0x399657ED871B3A6C', this.handle, _h(type)); } /** * Changes type and quality of skins * type hashes: https://pastebin.com/C1WvQjCy * * @param type * @returns The instance for method chaining */ setCarcassType(type: string | number): this { inv('0x399657ED871B3A6C', this.handle, _h(type)); return this; } /** * @param toggle */ set HasGravity(toggle: boolean) { inv('0x0CEDB728A1083FA7', this.handle, toggle); } /** * @param toggle * @returns The instance for method chaining */ setHasGravity(toggle: boolean): this { inv('0x0CEDB728A1083FA7', this.handle, toggle); return this; } /** * @param relative * @returns */ getSpeedVector(relative: boolean): Vector3 { return Vector3.fromArray(inv('0xF2DB09816A419DC5', this.handle, relative, rav())); } /** * @param entity2 * @param p2 * @param p3 * @returns */ hasBeenDamagedByEntity(entity2: Entity, p2: boolean, p3: boolean): boolean { return !!inv('0x7B6E7BEC1143AC86', this.handle, entity2.handle, p2, p3, rai()); } /** * @returns */ get IsFullyLooted(): boolean { return !!inv('0x8DE41E9902E85756', this.handle, rai()); } /** * @returns */ get IsOccluded(): boolean { return !!inv('0x140188E884645624', this.handle, rai()); } /** * @param toggle */ set CanBeDamaged(toggle: boolean) { inv('0x0D06D522B90E861F', this.handle, toggle); } /** * @param toggle * @returns The instance for method chaining */ setCanBeDamaged(toggle: boolean): this { inv('0x0D06D522B90E861F', this.handle, toggle); return this; } /** * @param forceFlags * @param pos * @param offset * @param boneIndex * @param isDirectionRel * @param ignoreUpVec * @param isForceRel * @param p12 * @param p13 */ applyForceToEntity(forceFlags: int, pos: Vector3, offset: Vector3, boneIndex: int, isDirectionRel: boolean, ignoreUpVec: boolean, isForceRel: boolean, p12: boolean, p13: boolean): void { inv('0xF15E8F5D333F09C4', this.handle, forceFlags, f(pos.x), f(pos.y), f(pos.z), f(offset.x), f(offset.y), f(offset.z), boneIndex, isDirectionRel, ignoreUpVec, isForceRel, p12, p13); } /** * @returns */ get IsDead(): boolean { return !!inv('0x7D5B1F88E7504BBA', this.handle, rai()); } /** * * @remarks **Warning:** You should *probably* use your own AABB testing as it might be faster * * * @param boundsMin * @param boundsMax * @param addDebugMarker * @param checkZPos Looks to be leftover debug code, this will still run and do extra `z` tests in order to draw debug markers, but the marker type is hard coded to `0`, you should leave this to `false` to avoid un-neede overhead * @param mountFlag When set to `true` this will also check the `z` position of the entity, otherwise this will just check the `x` and `y` of the bounds. * @returns Returns `true` if the `entity` is in the `boundsMin` and `boundsMax`. */ isInArea(boundsMin: Vector3, boundsMax: Vector3, addDebugMarker: boolean = false, checkZPos: boolean = false, mountFlag: int = 0): boolean { return !!inv('0x0C2634C40A16193E', this.handle, f(boundsMin.x), f(boundsMin.y), f(boundsMin.z), f(boundsMax.x), f(boundsMax.y), f(boundsMax.z), addDebugMarker, checkZPos, mountFlag, rai()); } /** * Returns the coordinates of an entity-bone. * https://github.com/femga/rdr3_discoveries/tree/master/boneNames * * @param boneIndex * @returns */ getWorldPositionOfBone(boneIndex: int): Vector3 { return Vector3.fromArray(inv('0x82CFA50E34681CA5', this.handle, boneIndex, rav())); } /** * https://github.com/femga/rdr3_discoveries/tree/master/animations * * @param animName * @param animDict * @param p3 * @param loop * @param stayInAnim * @param p6 * @param delta * @param bitset * @returns */ playAnim(animName: string, animDict: string, p3: float, loop: boolean, stayInAnim: boolean, p6: boolean, delta: float, bitset: any): boolean { return !!inv('0xDC6D22FAB76D4874', this.handle, animName, animDict, f(p3), loop, stayInAnim, p6, f(delta), bitset, rai()); } /** * Returns false if entity is not a ped or object. * * @returns lootTable */ get ScriptOverrideLootTablePermanent(): [any, number] { const result = inv<[number, number]>('0x1E804EA9B12030A4', this.handle, pvi()); return [result[0], result[1]]; } /** * @param animDict * @param animName * @param p3 * @returns */ hasAnimFinished(animDict: string, animName: string, p3: int): boolean { return !!inv('0xAEB40615337EF1E3', this.handle, animDict, animName, p3, rai()); } /** * @param bCanBeDamaged * @param relGroup * @returns The instance for method chaining */ setCanBeDamagedByRelationshipGroup(bCanBeDamaged: boolean, relGroup: string | number): this { inv('0x0EF1AFB18649E015', this.handle, bCanBeDamaged, _h(relGroup)); return this; } /** * @returns */ get UprightValue(): float { return inv('0x56398BE65160C3BE', this.handle, raf()); } /** * @param pos * @param heading * @param xAxis * @param yAxis * @param zAxis * @returns The instance for method chaining */ setCoordsAndHeading(pos: Vector3, heading: float, xAxis: boolean, yAxis: boolean, zAxis: boolean): this { inv('0x203BEFFDBE12E96A', this.handle, f(pos.x), f(pos.y), f(pos.z), f(heading), xAxis, yAxis, zAxis); return this; } /** * Returns zero if the entity is not a carriable * * @returns */ get CarryConfig(): number { return (inv('0x0FD25587BB306C86', this.handle, rai())) & 0xFFFFFFFF; } /** * tier: https://github.com/Halen84/RDR3-Native-Flags-And-Enums/tree/main/eEntityThreatTier * * @param tier * @param p2 * @returns The instance for method chaining */ setThreatTier(tier: int, p2: boolean): this { inv('0x4B436BAC8CBE9B07', this.handle, tier, p2); return this; } /** * Returns the heading of the entity in degrees. Also know as the "Yaw" of an entity. * * @returns */ get Heading(): float { return inv('0xC230DD956E2F5507', this.handle, raf()); } /** * Returns the LOD distance of an entity. * * @returns */ get LodDist(): int { return inv('0xDF240D0C2A948683', this.handle, rai()); } /** * @returns */ doesHaveDrawable(): boolean { return !!inv('0x20487F0DA9AF164A', this.handle, rai()); } /** * @param xyzw */ set Quaternion(xyzw: Vector4) { inv('0x100E7007D13E3687', this.handle, f(xyzw.x), f(xyzw.y), f(xyzw.z), f(xyzw.w)); } /** * @param xyzw * @returns The instance for method chaining */ setQuaternion(xyzw: Vector4): this { inv('0x100E7007D13E3687', this.handle, f(xyzw.x), f(xyzw.y), f(xyzw.z), f(xyzw.w)); return this; } /** * @returns */ get IsAttachedToAnyObject(): boolean { return !!inv('0x306C1F6178F01AB3', this.handle, rai()); } /** * Sets a ped or an object totally invincible. It doesn't take any kind of damage. Peds will not ragdoll on explosions. * * @param toggle */ set Invincible(toggle: boolean) { inv('0xA5C38736C426FCB8', this.handle, toggle); } /** * Sets a ped or an object totally invincible. It doesn't take any kind of damage. Peds will not ragdoll on explosions. * * @param toggle * @returns The instance for method chaining */ setInvincible(toggle: boolean): this { inv('0xA5C38736C426FCB8', this.handle, toggle); return this; } /** * Attaches entity1 to bone (boneIndex) of entity2. boneIndex - this is different to boneID, use GET_PED_BONE_INDEX to get the index from the ID. use the index for attaching to specific bones. entity1 will be attached to entity2's centre if bone index given doesn't correspond to bone indexes for that entity type. * https://github.com/femga/rdr3_discoveries/tree/master/boneNames useSoftPinning - if set to false attached entity will not detach when fixed * collision - controls collision between the two entities (FALSE disables collision). * isPed - pitch doesn't work when false and roll will only work on negative numbers (only peds) * vertexIndex - position of vertex * fixedRot - if false it ignores entity vector * * @param entity2 * @param boneIndex * @param pos * @param rot * @param p9 * @param useSoftPinning * @param collision * @param isPed * @param vertexIndex * @param fixedRot * @param p15 * @param p16 */ attachToEntity(entity2: Entity, boneIndex: int, pos: Vector3, rot: Vector3, p9: boolean, useSoftPinning: boolean, collision: boolean, isPed: boolean, vertexIndex: int, fixedRot: boolean, p15: boolean, p16: boolean): void { inv('0x6B9BBD38AB0796DF', this.handle, entity2.handle, boneIndex, f(pos.x), f(pos.y), f(pos.z), f(rot.x), f(rot.y), f(rot.z), p9, useSoftPinning, collision, isPed, vertexIndex, fixedRot, p15, p16); } /** * @returns */ get IsAnimal(): any { return inv('0x9A100F1CF4546629', this.handle); } /** * p6/relative - makes the xyz force not relative to world coords, but to something else * p7/highForce - setting false will make the force really low * * @param forceType * @param pos * @param component * @param isDirectionRel * @param isForceRel * @param p8 */ applyForceToCenterOfMass(forceType: int, pos: Vector3, component: int, isDirectionRel: boolean, isForceRel: boolean, p8: boolean): void { inv('0x31DA7CEC5334DB37', this.handle, forceType, f(pos.x), f(pos.y), f(pos.z), component, isDirectionRel, isForceRel, p8); } /** * Old name: _GET_ENTITY_CAN_BE_DAMAGED * * @returns */ get CanBeDamaged(): any { return inv('0x75DF9E73F2F005FD', this.handle); } /** * Seems to return true if entity is burned / scorched * *GET_ENTITY** * * @returns */ N_0x37B01666BAE8F7EF(): any { return inv('0x37B01666BAE8F7EF', this.handle); } /** * @param toggle */ set RequiresMoreExpensiveRiverCheck(toggle: boolean) { inv('0x850C940EE3E7B8B5', this.handle, toggle); } /** * @param toggle * @returns The instance for method chaining */ setRequiresMoreExpensiveRiverCheck(toggle: boolean): this { inv('0x850C940EE3E7B8B5', this.handle, toggle); return this; } /** * @param boneIndex * @returns Returns the offset from the entity for the selected bone index. * @example * ```lua * CreateThread(function() * while true do * local playerPed = PlayerPedId() * local boneOffset = Citizen.InvokeNative(0x5E214112806591EA, playerPed, GetEntityBoneIndexByName(playerPed, "skel_r_hand"), Citizen.ResultAsVector()) * local coords = GetOffsetFromEntityInWorldCoords(playerPed, boneOffset) * * DrawMarker(0x50638AB9, coords, 0, 0, 0, 0, 0, 0, 0.05, 0.05, 0.05, 250, 250, 100, 250, 0, 0, 2, 0, 0, 0, 0) * * Wait(0) * end * end) * ``` */ getOffsetFromBone(boneIndex: int): Vector3 { return Vector3.fromArray(inv('0x5E214112806591EA', this.handle, boneIndex, rav())); } N_0x9C6906EF8CB20C5F(): void { inv('0x9C6906EF8CB20C5F', this.handle); } /** * Simply returns whatever is passed to it (Regardless of whether the handle is valid or not). * * @returns */ get PedIndexFromIndex(): Ped | null { return createFromHandle('Ped', inv('0x0F16D042BD640EA3', this.handle, rai())); } /** * Sets whether the entity can be targeted without being in line-of-sight. * * @param toggle */ set CanBeTargetedWithoutLos(toggle: boolean) { inv('0x6D09F32E284D0FB7', this.handle, toggle); } /** * Sets whether the entity can be targeted without being in line-of-sight. * * @param toggle * @returns The instance for method chaining */ setCanBeTargetedWithoutLos(toggle: boolean): this { inv('0x6D09F32E284D0FB7', this.handle, toggle); return this; } /** * @returns */ get IsOnScreen(): boolean { return !!inv('0x613C15D5D8DB781F', this.handle, rai()); } /** * Old name: _SET_ENTITY_DECALS_DISABLED * * @param toggle */ set Noweapondecals(toggle: boolean) { inv('0xC64E597783BE9A1D', this.handle, toggle); } /** * Old name: _SET_ENTITY_DECALS_DISABLED * * @param toggle * @returns The instance for method chaining */ setNoweapondecals(toggle: boolean): this { inv('0xC64E597783BE9A1D', this.handle, toggle); return this; } /** * @returns */ get Health(): int { return inv('0x82368787EA73C0F7', this.handle, rai()); } /** * sets the fill in state for some objects like for the stew, coffee mug ,poker chips, jugs ? P1 is either 0 or 2 p2 seems to be a label/name p3 is the fill in state, max seems to be for some 3.0 (most is 1.0) - 0.0 * heres some of the labels/names found * tumbler_fill, Canvas, Stew_Fill, from Chip01_Ctrl to Chip10_Ctrl, from empty_jug01_Ctrl to empty_jug20_Ctrl, from full_jug01_Ctrl to full_jug20_Ctrl, CTRL_cupFill, Food_DOF_Fill, from WhiteChip_Ctrl_0 to WhiteChip_Ctrl_10, from BlueChip_Ctrl_0 to BlueChip_Ctrl_10, from BlackChip_Ctrl_0 to BlackChip_Ctrl_10, from RedChip_Ctrl_0 to RedChip_Ctrl_10, * * @param p1 * @param p2 * @param fill * @returns The instance for method chaining */ setFillInStateForEntity(p1: int, p2: string, fill: float): this { inv('0x669655FFB29EF1A9', this.handle, p1, p2, f(fill)); return this; } /** * @returns */ doesHavePhysics(): boolean { return !!inv('0xA512B3F1B2A0B51C', this.handle, rai()); } /** * Returns true if calling script owns specified entity * * @returns */ doesThreadOwnThisEntity(): boolean { return !!inv('0x88AD6CC10D8D35B2', this.handle, rai()); } /** * Attach an entity to coordinates physically better name may be perfered? seems to be used with boats `p_skiff02x` ? The last 6 params are always 0 everywhere in the base code. p7 = 500.0 some kind of time? p8 =1 * * @param pos * @param offset * @param p7 * @param p8 * @param p9 * @param p10 * @param p11 * @param p12 * @param p13 * @param p14 */ attachToCoordsPhysically(pos: Vector3, offset: Vector3, p7: float, p8: boolean, p9: int, p10: int, p11: int, p12: int, p13: int, p14: int): void { inv('0x445D7D8EA66E373E', this.handle, f(pos.x), f(pos.y), f(pos.z), f(offset.x), f(offset.y), f(offset.z), f(p7), p8, p9, p10, p11, p12, p13, p14); } /** * *REMOVE_DECALS** - _REMOVE_FORCED* */ N_0x5826EFD6D73C4DE5(): void { inv('0x5826EFD6D73C4DE5', this.handle); } /** * @param toggle */ freezePosition(toggle: boolean): void { inv('0x7D9EFB7AD6B19754', this.handle, toggle); } /** * Alters entity's health by 'amount'. Can be negative (to drain health). * In the scripts entity2 and weaponHash are unused (zero). * * @param amount * @param entity2 * @param weaponHash * @returns */ changeHealth(amount: float, entity2: Entity, weaponHash: eWeaponHash): any { return inv('0x835F131E7DC8F97A', this.handle, f(amount), entity2.handle, weaponHash); } /** * @returns */ get AttachedTo(): Entity | null { return createFromHandle('Entity', inv('0x56D713888A566481', this.handle, rai())); } /** * @param toggle */ set OnlyDamagedByPlayer(toggle: boolean) { inv('0x473598683095D430', this.handle, toggle); } /** * @param toggle * @returns The instance for method chaining */ setOnlyDamagedByPlayer(toggle: boolean): this { inv('0x473598683095D430', this.handle, toggle); return this; } /** * @param p1 * @param p2 * @returns The instance for method chaining */ setIsTargetPriority(p1: boolean, p2: float): this { inv('0x0A5D170C44CB2189', this.handle, p1, f(p2)); return this; } /** * @param pos * @param flags * @returns */ hasClearLosToCoord(pos: Vector3, flags: int): any { return inv('0x0C9DBF48C6BA6E4C', this.handle, f(pos.x), f(pos.y), f(pos.z), flags); } /** * @param flagId * @param value Refer to {@link eCarryingFlags} * @returns The instance for method chaining */ setCarryingFlag(flagId: eCarryingFlags, value: boolean): this { inv('0x18FF3110CF47115D', this.handle, flagId, value); return this; } /** * @returns */ get IsPredator(): any { return inv('0x5594AFE9DE0C01B7', this.handle); } /** * enum eCarriableState * { * CARRIABLE_STATE_NONE, * CARRIABLE_STATE_TRANSITIONING_TO_HOGTIED, * CARRIABLE_STATE_CARRIABLE_INTRO, * CARRIABLE_STATE_CARRIABLE, * CARRIABLE_STATE_BEING_PICKED_UP_FROM_GROUND, * CARRIABLE_STATE_CARRIED_BY_HUMAN, * CARRIABLE_STATE_BEING_PLACED_ON_GROUND, * CARRIABLE_STATE_CARRIED_BY_MOUNT, * CARRIABLE_STATE_BEING_PLACED_ON_MOUNT, * CARRIABLE_STATE_BEING_PICKED_UP_FROM_MOUNT, * CARRIABLE_STATE_BEING_CUT_FREE, * CARRIABLE_STATE_BEING_PLACED_ON_GROUND_ESCAPE, * CARRIABLE_STATE_BEING_PLACED_IN_VEHICLE * }; * * @returns */ get CarriableState(): int { return inv('0x61914209C36EFDDB', this.handle, rai()); } /** * @param value */ set MaxHealth(value: int) { inv('0x166E7CF68597D8B5', this.handle, value); } /** * @param value * @returns The instance for method chaining */ setMaxHealth(value: int): this { inv('0x166E7CF68597D8B5', this.handle, value); return this; } /** * Params: p1 (probably animType) = 1, 0 * * @param p1 * @returns */ isPlayingAnyAnim(p1: int): boolean { return !!inv('0x0B7CB1300CBFE19C', this.handle, p1, rai()); } /** * @param enabled */ set LightsEnabled(enabled: boolean) { inv('0xEBDC12861D079ABA', this.handle, enabled); } /** * @param enabled * @returns The instance for method chaining */ setLightsEnabled(enabled: boolean): this { inv('0xEBDC12861D079ABA', this.handle, enabled); return this; } /** * Offset values are relative to the entity. x = left/right * y = forward/backward * z = up/down * * @param offset * @returns */ getOffsetFromInWorldCoords(offset: Vector3): Vector3 { return Vector3.fromArray(inv('0x1899F328B0E12848', this.handle, f(offset.x), f(offset.y), f(offset.z), rav())); } /** * Checks if entity1 is within the box defined by x/y/zSize of entity2. Last three parameters are almost always p5 = 0, p6 = 1, p7 = 0 * * @param entity2 * @param xSize * @param ySize * @param zSize * @param p5 * @param p6 * @param p7 * @returns */ isAtEntity(entity2: Entity, xSize: float, ySize: float, zSize: float, p5: boolean, p6: boolean, p7: int): boolean { return !!inv('0xC057F02B837A27F6', this.handle, entity2.handle, f(xSize), f(ySize), f(zSize), p5, p6, p7, rai()); } /** * @param toggle */ set Visible(toggle: boolean) { inv('0x1794B4FCC84D812F', this.handle, toggle); } /** * @param toggle * @returns The instance for method chaining */ setVisible(toggle: boolean): this { inv('0x1794B4FCC84D812F', this.handle, toggle); return this; } /** * Old name: _SET_ENTITY_CLEANUP_BY_ENGINE * * @param toggle */ set ShouldFreezeWaitingOnCollision(toggle: boolean) { inv('0x740CB4F3F602C9F4', this.handle, toggle); } /** * Old name: _SET_ENTITY_CLEANUP_BY_ENGINE * * @param toggle * @returns The instance for method chaining */ setShouldFreezeWaitingOnCollision(toggle: boolean): this { inv('0x740CB4F3F602C9F4', this.handle, toggle); return this; } /** * Note: this native was removed in 1232 but added back in 1311 * Old name: _GET_ENTITY_PROOFS * * @returns */ get Proofs(): int { return inv('0x6CF0DAD7FA1088EA', this.handle, rai()); } /** * skin - everything alpha except skin * Set entity alpha level. Ranging from 0 to 255 but changes occur after every 20 percent (after every 51). * * @param alphaLevel * @param skin * @returns The instance for method chaining */ setAlpha(alphaLevel: int, skin: boolean): this { inv('0x0DF7692B1D9E7BA7', this.handle, alphaLevel, skin); return this; } /** * @returns */ get ThreatTier(): int { return inv('0xE12F56CB25D9CE23', this.handle, rai()); } /** * Used in Script Function DUELING_DID_PLAYER_DISARM_OPPONENT * * @param entity2 * @param p2 * @param p3 * @returns */ N_0x3EC28DA1FFAC9DDD(entity2: Entity, p2: any, p3: any): boolean { return !!inv('0x3EC28DA1FFAC9DDD', this.handle, entity2.handle, p2, p3, rai()); } /** * * @remarks **Warning:** This native isn't useful for RedM, you should refer to [natives: DELETE_ENTITY * instead.] Must be called from a background script, otherwise it will do nothing. */ delete2(): void { inv('0x5E94EA09E7207C16', this.handle); } /** * @param debugFlag The entity to check * @returns Returns `true` if the entity is currently airborn. */ isInAir(debugFlag: boolean = false): boolean { return !!inv('0x886E37EC497200B6', this.handle, debugFlag, rai()); } get IsInAir(): boolean { return this.isInAir(); } /** * @returns */ get IsAMissionEntity(): boolean { return !!inv('0x138190F64DB4BBD1', this.handle, rai()); } /** * @returns */ get IsAttachedToAnyPed(): boolean { return !!inv('0xC841153DED2CA89A', this.handle, rai()); } /** * @param to * @returns */ isAttachedToEntity(to: Entity): boolean { return !!inv('0x154A3C529497053E', this.handle, to.handle, rai()); } /** * @returns */ hasBeenDamagedByAnyObject(): boolean { return !!inv('0x73BB763880CD23A6', this.handle, rai()); } /** * @param rotationOrder * @returns */ getRotation(rotationOrder: int): Vector3 { return Vector3.fromArray(inv('0xE09CAF86C32CB48F', this.handle, rotationOrder, rav())); } /** * @param toggle */ set MotionBlur(toggle: boolean) { inv('0x516C6ABD18322B63', this.handle, toggle); } /** * @param toggle * @returns The instance for method chaining */ setMotionBlur(toggle: boolean): this { inv('0x516C6ABD18322B63', this.handle, toggle); return this; } resetAlpha(): void { inv('0x744B9EF44779D9AB', this.handle); } /** * Checks if entity is within x/y/zSize distance of x/y/z. Last three are unknown ints, almost always p7 = 0, p8 = 1, p9 = 0 * * @param pos * @param xSize * @param ySize * @param zSize * @param p7 * @param p8 * @param p9 * @returns */ isAtCoord(pos: Vector3, xSize: float, ySize: float, zSize: float, p7: boolean, p8: boolean, p9: int): boolean { return !!inv('0x5E58342602E94718', this.handle, f(pos.x), f(pos.y), f(pos.z), f(xSize), f(ySize), f(zSize), p7, p8, p9, rai()); } /** * LOD distance can be 0 to 0xFFFF (higher values will result in 0xFFFF) as it is actually stored as a 16-bit value (aka uint16_t). * * @param value */ set LodDist(value: int) { inv('0x5FB407F0A7C877BF', this.handle, value); } /** * LOD distance can be 0 to 0xFFFF (higher values will result in 0xFFFF) as it is actually stored as a 16-bit value (aka uint16_t). * * @param value * @returns The instance for method chaining */ setLodDist(value: int): this { inv('0x5FB407F0A7C877BF', this.handle, value); return this; } /** * @param toggle */ set Dynamic(toggle: boolean) { inv('0xFBFC4473F66CE344', this.handle, toggle); } /** * @param toggle * @returns The instance for method chaining */ setDynamic(toggle: boolean): this { inv('0xFBFC4473F66CE344', this.handle, toggle); return this; } /** * @param radius */ set CustomPickupRadius(radius: float) { inv('0x482D17E45665DA44', this.handle, f(radius)); } /** * @param radius * @returns The instance for method chaining */ setCustomPickupRadius(radius: float): this { inv('0x482D17E45665DA44', this.handle, f(radius)); return this; } /** * @returns */ get PopulationType(): int { return inv('0xADE28862B6D7B85B', this.handle, rai()); } /** * @returns */ get IsAVehicle(): boolean { return !!inv('0xC3D96AF45FCCEC4C', this.handle, rai()); } /** * @param pos * @param atTop * @param inWorldCoords * @returns */ getHeight(pos: Vector3, atTop: boolean, inWorldCoords: boolean): float { return inv('0x296DEBC84474B375', this.handle, f(pos.x), f(pos.y), f(pos.z), atTop, inWorldCoords, raf()); } /** * @param pos * @returns */ getOffsetFromGivenWorldCoords(pos: Vector3): Vector3 { return Vector3.fromArray(inv('0x497C6B1A2C9AE69C', this.handle, f(pos.x), f(pos.y), f(pos.z), rav())); } addTrackingTrails(): void { inv('0x1AD922AB5038DEF3', this.handle); } /** * @param toggle */ set CanClimbOnEntity(toggle: boolean) { inv('0x24AED2A608F93C4C', this.handle, toggle); } /** * @param toggle * @returns The instance for method chaining */ setCanClimbOnEntity(toggle: boolean): this { inv('0x24AED2A608F93C4C', this.handle, toggle); return this; } /** * @returns minimum; maximum */ get WorldPositionOfDimensions(): [Vector3, Vector3] { const result = inv<[number[], number[]]>('0xF3FDA9A617A15145', this.handle, pvv(), pvv()); return [Vector3.fromArray(result[0]), Vector3.fromArray(result[1])]; } /** * @param p1 * @returns */ isUnderwater(p1: boolean): boolean { return !!inv('0xD4E5C1E93C466127', this.handle, p1, rai()); } /** * @param animation * @param animGroup * @param p3 * @returns */ stopAnim(animation: string, animGroup: string, p3: float): any { return inv('0x786591D986DE9159', this.handle, animation, animGroup, f(p3)); } /** * @returns */ hasCollidedWithAnything(): boolean { return !!inv('0xDF18751EC74F90FF', this.handle, rai()); } /** * Simply returns whatever is passed to it (Regardless of whether the handle is valid or not). * * @returns */ get VehicleIndexFromIndex(): Vehicle | null { return createFromHandle('Vehicle', inv('0xDF1E5AAC561AFC59', this.handle, rai())); } /** * @returns */ get IsVisible(): boolean { return !!inv('0xFFC96ECB7FA404CA', this.handle, rai()); } /** * SET_ENTITY_LO* * * @param toggle */ N_0xFF9965C47FA404DA(toggle: boolean): void { inv('0xFF9965C47FA404DA', this.handle, toggle); } /** * Valid indices: 0 - 3 * Index 1 always returns a `hogtied` config, doesn't matter the entity. * It's for humans only and the ped must be resurrected first if it's dead. * * @param index * @returns */ getOptimalCarryConfig(index: int): number { return (inv('0x34F008A7E48C496B', this.handle, index, rai())) & 0xFFFFFFFF; } /** * @returns The instance for method chaining */ setFadeIn(): this { inv('0xA91E6CF94404E8C9', this.handle); return this; } /** * @returns */ hasBeenDamagedByAnyPed(): boolean { return !!inv('0x9934E9C42D52D87E', this.handle, rai()); } /** * Gets the network ID of this entity for network synchronization. */ get NetworkId(): number { return inv('0xA11700682F3AD45C', this.handle, rai()); } } registerHandle('Entity', Entity);