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 Interior implements IHandle { constructor(public handle: number) {} static fromHandle(handle: number): Interior | null { return handle === 0 ? null : new Interior(handle); } /** * @param entitySetName * @returns */ isEntitySetActive(entitySetName: string): boolean { return !!inv('0x32810CA2125F5842', this.handle, entitySetName, rai()); } pinInMemory(): void { inv('0xBD3D33EABF680168', this.handle); } /** * @returns */ get Position(): Vector3 { return Vector3.fromArray(inv('0x2C9746D0CA15BE1C', this.handle, rav())); } /** * @returns */ get IsValidInterior(): boolean { return !!inv('0x017C1B3159F79F6C', this.handle, rai()); } /** * @returns */ get MinimapHash(): number { return (inv('0x3039BE60B3749716', this.handle, rai())) & 0xFFFFFFFF; } /** * @param entitySetName * @param p2 */ deactivateEntitySet(entitySetName: string, p2: boolean): void { inv('0x33B81A2C07A51FFF', this.handle, entitySetName, p2); } /** * @param entitySetName * @returns */ isEntitySetValid(entitySetName: string): boolean { return !!inv('0xD56FF170710FC826', this.handle, entitySetName, rai()); } /** * https://github.com/femga/rdr3_discoveries/tree/master/interiors/interior_sets * * @param entitySetName * @param p2 */ activateEntitySet(entitySetName: string, p2: int): void { inv('0x174D0AAB11CED739', this.handle, entitySetName, p2); } /** * @returns */ get IsReady(): boolean { return !!inv('0x941560D2D45DBFC8', this.handle, rai()); } /** * @param toggle */ disableInterior(toggle: boolean): void { inv('0x3C2B92A1A07D4FCE', this.handle, toggle); } /** * Actually returns void in IDA but the script header defines a BOOL return type * * @returns */ setInUse(): any { return inv('0xB5EF6FEF2DC9EBED', this.handle); } /** * Does something similar to INTERIOR::DISABLE_INTERIOR. You don't fall through the floor but everything is invisible inside and looks the same as when INTERIOR::DISABLE_INTERIOR is used. Peds behaves normally inside. */ unpinInterior(): void { inv('0x07FD1A0B814F6055', this.handle); } /** * @returns position; nameHash */ get LocationAndNamehash(): [Vector3, number] { const result = inv<[number[], number]>('0x8451E87D3C2B0286', this.handle, pvv(), pvi()); return [Vector3.fromArray(result[0]), result[1]]; } } registerHandle('Interior', Interior);