import type { Ped } from '../classes/Ped'; import { Vector2 } from '../types/Vector2'; import { Vector3 } from '../types/Vector3'; import { Vector4 } from '../types/Vector4'; import { Color } from '../types/Color'; import { Entity } from './Entity'; 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 Prop extends Entity { static fromHandle(handle: number): Prop | null { return handle === 0 ? null : new Prop(handle); } static fromNetworkId(netId: number): Prop | null { if (!inv('0x18A47D074708FD68', netId, rai())) return null; return Prop.fromHandle(inv('0xCE4E5D9B0A4FF560', netId, rai())); } /** * @param toggle */ set ObjectAllowLowLodBuoyancy(toggle: boolean) { inv('0x4D89D607CB3DD1D2', this.handle, toggle); } /** * @param toggle * @returns The instance for method chaining */ setObjectAllowLowLodBuoyancy(toggle: boolean): this { inv('0x4D89D607CB3DD1D2', this.handle, toggle); return this; } /** * @param p1 * @param p2 * @returns The instance for method chaining */ setTeamPickupObject(p1: any, p2: boolean): this { inv('0x53E0DF1A2A3CF0CA', this.handle, p1, p2); return this; } /** * @param p1 * @param p2 */ breakObjectFragmentChild(p1: any, p2: boolean): void { inv('0xE7E4C198B0185900', this.handle, p1, p2); } /** * @returns */ get LightIntensityFromObject(): float { return inv('0xFA3B61EC249B4674', this.handle, raf()); } /** * Returns float value to be used with _SET_LIGHT_INTENSITY_FOR_OBJECT * * @returns */ get ObjectLightIntensity(): float { return inv('0x3397CD4E0353DFBA', this.handle, raf()); } /** * Not official native name * * @param name */ set ObjectPromptName(name: string) { inv('0xAEE6C800E124CFE1', this.handle, name); } /** * Not official native name * * @param name * @returns The instance for method chaining */ setObjectPromptName(name: string): this { inv('0xAEE6C800E124CFE1', this.handle, name); return this; } /** * @param toggle */ hidePickupObject(toggle: boolean): void { inv('0x2777150CC7D9365E', this.handle, toggle); } /** * @param scale */ set ObjectBreakScale(scale: float) { inv('0xFFB99FFD17F65889', this.handle, f(scale)); } /** * @param scale * @returns The instance for method chaining */ setObjectBreakScale(scale: float): this { inv('0xFFB99FFD17F65889', this.handle, f(scale)); return this; } /** * @param toX * @param toY * @param toZ * @param speedX * @param speedY * @param speedZ * @param collision * @returns */ slideObject(toX: float, toY: float, toZ: float, speedX: float, speedY: float, speedZ: float, collision: boolean): boolean { return !!inv('0x2FDFF4107B8C1147', this.handle, f(toX), f(toY), f(toZ), f(speedX), f(speedY), f(speedZ), collision, rai()); } /** * @param p1 */ N_0x3DF1A0A58498E209(p1: any): void { inv('0x3DF1A0A58498E209', this.handle, p1); } /** * Params: p1 = 23 in R* Scripts * * @param p1 * @returns */ N_0x0943113E02322164(p1: int): any { return inv('0x0943113E02322164', this.handle, p1); } /** * @param disable */ set LightScatteringDisabledForObject(disable: boolean) { inv('0x04D1D4E411CE52D0', this.handle, disable); } /** * @param disable * @returns The instance for method chaining */ setLightScatteringDisabledForObject(disable: boolean): this { inv('0x04D1D4E411CE52D0', this.handle, disable); return this; } /** * @returns The instance for method chaining */ setPickupDoNotAutoPlaceOnGround(): this { inv('0x634C19521485AB25', this.handle); return this; } /** * @param txdHash * @param p2 * @param p3 * @returns The instance for method chaining */ setCustomTexturesOnObject(txdHash: string | number, p2: any, p3: any): this { inv('0xE124889AE0521FCF', this.handle, _h(txdHash), p2, p3); return this; } /** * @param targettable */ set ObjectTargettable2(targettable: boolean) { inv('0x581EDBE56E8D62C9', this.handle, targettable); } /** * @param targettable * @returns The instance for method chaining */ setObjectTargettable2(targettable: boolean): this { inv('0x581EDBE56E8D62C9', this.handle, targettable); return this; } /** * Not official native name * * @param gxtEntryHash */ set ObjectPromptNameFromGxtEntry(gxtEntryHash: string | number) { inv('0xD503D6F0986D58BC', this.handle, _h(gxtEntryHash)); } /** * Not official native name * * @param gxtEntryHash * @returns The instance for method chaining */ setObjectPromptNameFromGxtEntry(gxtEntryHash: string | number): this { inv('0xD503D6F0986D58BC', this.handle, _h(gxtEntryHash)); return this; } /** * Adjust the physics parameters of a prop, or otherwise known as "object". This is useful for simulated gravity. Other parameters seem to be unknown. p2: seems to be weight and gravity related. Higher value makes the obj fall faster. Very sensitive? * p3: seems similar to p2 * p4: makes obj fall slower the higher the value * p5: similar to p4 * * @param weight * @param p2 * @param p3 * @param p4 * @param p5 * @param gravity * @param p7 * @param p8 * @param p9 * @param p10 * @param buoyancy * @returns The instance for method chaining */ setObjectPhysicsParams(weight: float, p2: float, p3: float, p4: float, p5: float, gravity: float, p7: float, p8: float, p9: float, p10: float, buoyancy: float): this { inv('0xF6DF6E90DE7DF90F', this.handle, f(weight), f(p2), f(p3), f(p4), f(p5), f(gravity), f(p7), f(p8), f(p9), f(p10), f(buoyancy)); return this; } /** * @returns The instance for method chaining */ setPickupCollectableOnMount(): this { inv('0x00EE08603EADEE92', this.handle); return this; } breakAllObjectFragmentBones(): void { inv('0x8462BE2341A55B6F', this.handle); } /** * p2 is usually the same as speed parameter * * @param speed * @param p2 * @returns The instance for method chaining */ setObjectBurnSpeed(speed: float, p2: float): this { inv('0x646564A3B7DF68F8', this.handle, f(speed), f(p2)); return this; } /** * @param opacity */ set ObjectBurnOpacity(opacity: float) { inv('0x7D7285EFEAB5AF15', this.handle, f(opacity)); } /** * @param opacity * @returns The instance for method chaining */ setObjectBurnOpacity(opacity: float): this { inv('0x7D7285EFEAB5AF15', this.handle, f(opacity)); return this; } resetObjectVelocity(): void { inv('0xF40AB58D83C35027', this.handle); } /** * @returns */ get RayfireMapObjectAnimPhase(): float { return inv('0x260EE4FDBDF4DB01', this.handle, raf()); } /** * @returns */ createObjectSkeleton(): any { return inv('0xB6CBD40F8EA69E8A', this.handle); } /** * _PRE* or _Q* or _RE* */ makeItemCarriable(): void { inv('0x1461DF6DB886BE3F', this.handle); } /** * focus on objects like focus on peds, p1 is to enable/disable p2 is to enable/disable focus when you have a weapon out * * @param toggle * @param weaponLock * @returns The instance for method chaining */ setObjectTargettableFocus(toggle: boolean, weaponLock: boolean): this { inv('0xA22712E8471AA08E', this.handle, toggle, weaponLock); return this; } /** * @returns */ get StateOfRayfireMapObject(): int { return inv('0x899BA936634A322E', this.handle, rai()); } /** * @param ped */ attachPortablePickupToPed(ped: Ped): void { inv('0x8DC39368BDD57755', this.handle, ped.handle); } /** * @param lightIntensity */ set LightIntensityForObject(lightIntensity: float) { inv('0xF49574E2332A8F06', this.handle, f(lightIntensity)); } /** * @param lightIntensity * @returns The instance for method chaining */ setLightIntensityForObject(lightIntensity: float): this { inv('0xF49574E2332A8F06', this.handle, f(lightIntensity)); return this; } /** * Old name: _MARK_OBJECT_FOR_DELETION */ onlyCleanUpObjectWhenOutOfRange(): void { inv('0xADBE4809F19F927A', this.handle); } /** * @param targettable */ set ObjectTargettable(targettable: boolean) { inv('0x8A7391690F5AFD81', this.handle, targettable); } /** * @param targettable * @returns The instance for method chaining */ setObjectTargettable(targettable: boolean): this { inv('0x8A7391690F5AFD81', this.handle, targettable); return this; } /** * @returns */ get IsObjectVisible(): boolean { return !!inv('0x8B32ACE6326A7546', this.handle, rai()); } fixObjectFragment(): void { inv('0xF9C1681347C8BD15', this.handle); } /** * @param intensity */ set ObjectBurnIntensity(intensity: float) { inv('0xC8E21C1677DC5E6F', this.handle, f(intensity)); } /** * @param intensity * @returns The instance for method chaining */ setObjectBurnIntensity(intensity: float): this { inv('0xC8E21C1677DC5E6F', this.handle, f(intensity)); return this; } /** * @param state */ set StateOfRayfireMapObject(state: int) { inv('0x5C29F698D404C5E1', this.handle, state); } /** * @param state * @returns The instance for method chaining */ setStateOfRayfireMapObject(state: int): this { inv('0x5C29F698D404C5E1', this.handle, state); return this; } /** * @param p1 * @param p2 */ preventCollectionOfPortablePickup(p1: boolean, p2: boolean): void { inv('0x92AEFB5F6E294023', this.handle, p1, p2); } /** * @param enabled */ set ObjectTakesDamageFromCollidingWithBuildings(enabled: boolean) { inv('0xEB6F1A9B5510A5D2', this.handle, enabled); } /** * @param enabled * @returns The instance for method chaining */ setObjectTakesDamageFromCollidingWithBuildings(enabled: boolean): this { inv('0xEB6F1A9B5510A5D2', this.handle, enabled); return this; } detachPortablePickupFromPed(): void { inv('0xCF463D1E9A0AECB1', this.handle); } /** * @returns */ get IsObjectAPortablePickup(): boolean { return !!inv('0x0378C08504160D0D', this.handle, rai()); } /** * @param toggle */ set ActivateObjectPhysicsAsSoonAsItIsUnfrozen(toggle: boolean) { inv('0x406137F8EF90EAF5', this.handle, toggle); } /** * @param toggle * @returns The instance for method chaining */ setActivateObjectPhysicsAsSoonAsItIsUnfrozen(toggle: boolean): this { inv('0x406137F8EF90EAF5', this.handle, toggle); return this; } /** * @param bone */ damageBoneOnProp(bone: int): void { inv('0xE4EFB315BCD2A838', this.handle, bone); } /** * Seems to mostly have effect on wood-made objects https://imgur.com/a/32oQvOn * * @param burnLevel * @param affectAsh * @returns The instance for method chaining */ setObjectBurnLevel(burnLevel: float, affectAsh: boolean): this { inv('0x2797C633DCDBBAC5', this.handle, f(burnLevel), affectAsh); return this; } /** * Params: value = 0.0 - 586.67 (?) * * @param value */ set LightTranslucencyForObject(value: float) { inv('0x63E39F09310F481F', this.handle, f(value)); } /** * Params: value = 0.0 - 586.67 (?) * * @param value * @returns The instance for method chaining */ setLightTranslucencyForObject(value: float): this { inv('0x63E39F09310F481F', this.handle, f(value)); return this; } /** * Deletes the specified object, then sets the handle pointed to by the pointer to NULL. */ deleteObject(): void { inv('0x931914268722C263', this.handle); } /** * Sets object as auto-jumpable by horse. * * @param p1 */ set AutoJumpableByHorse(p1: boolean) { inv('0x98D2D9C053A1F449', this.handle, p1); } /** * Sets object as auto-jumpable by horse. * * @param p1 * @returns The instance for method chaining */ setAutoJumpableByHorse(p1: boolean): this { inv('0x98D2D9C053A1F449', this.handle, p1); return this; } /** * @returns */ doesRayfireMapObjectExist(): boolean { return !!inv('0x52AF537A0C5B8AAD', this.handle, rai()); } /** * @returns */ doesPickupObjectExist(): boolean { return !!inv('0xD9EFB6DBF7DAAEA3', this.handle, rai()); } /** * Sets object as not jumpable by horse. * * @param p1 */ set NotJumpableByHorse(p1: boolean) { inv('0xE1C708BA4885796B', this.handle, p1); } /** * Sets object as not jumpable by horse. * * @param p1 * @returns The instance for method chaining */ setNotJumpableByHorse(p1: boolean): this { inv('0xE1C708BA4885796B', this.handle, p1); return this; } /** * @param kickable */ set ObjectKickable(kickable: boolean) { inv('0xB7017DA4D498269F', this.handle, kickable); } /** * @param kickable * @returns The instance for method chaining */ setObjectKickable(kickable: boolean): this { inv('0xB7017DA4D498269F', this.handle, kickable); return this; } /** * @param p1 * @returns */ placeObjectOnGroundProperly(p1: boolean): boolean { return !!inv('0x58A850EAEE20FAA3', this.handle, p1, rai()); } /** * Alt name: _SET_OBJECT_TINT Old name: _SET_OBJECT_TEXTURE_VARIATION * * @param textureVariation */ set ObjectTintIndex(textureVariation: int) { inv('0x971DA0055324D033', this.handle, textureVariation); } /** * Alt name: _SET_OBJECT_TINT Old name: _SET_OBJECT_TEXTURE_VARIATION * * @param textureVariation * @returns The instance for method chaining */ setObjectTintIndex(textureVariation: int): this { inv('0x971DA0055324D033', this.handle, textureVariation); return this; } /** * *SET_OBJECT** * * @param p1 */ N_0xCAAF2BCCFEF37F77(p1: any): void { inv('0xCAAF2BCCFEF37F77', this.handle, p1); } trackObjectVisibility(): void { inv('0xB252BC036B525623', this.handle); } } registerHandle('Prop', Prop);