import { Vector2 } from '../types/Vector2'; import { Vector3 } from '../types/Vector3'; import { Vector4 } from '../types/Vector4'; import { Color } from '../types/Color'; 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 BaseModel { protected hash: number; constructor(hash: number) { this.hash = hash; } /** * Old name: _REQUEST_IMAP_2 */ requestIplByHash(): void { inv('0x9E211A378F95C97C', this.hash); } /** * Request a model to be loaded into streaming memory. You should make sure to check that the model exists with * * @param p1 The model to request */ requestModel(p1: boolean): void { inv('0xFA28FE3A6246FC30', this.hash, p1); } /** * Old name: _IS_IMAP_ACTIVE_2 * * @returns */ get IsIplActiveByHash(): boolean { return !!inv('0x93AC1B91CB6D9913', this.hash, rai()); } requestClipSetByHash(): void { inv('0xAC37644A538F7524', this.hash); } /** * @returns */ hasNamedPtfxAssetLoaded(): boolean { return !!inv('0x65BB72F29138F5D6', this.hash, rai()); } /** * _SET_E* or _SET_F* */ N_0x032A14D082A9B269(): void { inv('0x032A14D082A9B269', this.hash); } /** * Marks the model as no longer needed. * * @returns The instance for method chaining */ setModelAsNoLongerNeeded(): this { inv('0x4AD96EF928BD4F9A', this.hash); return this; } /** * @returns */ get IsModelAnObject(): boolean { return !!inv('0x274EE1B90CFA669E', this.hash, rai()); } /** * Old name: _REQUEST_IMAP */ requestIplHash(): void { inv('0x59767C5A7A9AE6DA', this.hash); } /** * Returns whether the specified model is valid * * @returns */ get IsModelValid(): boolean { return !!inv('0x392C8D8E07B70EFC', this.hash, rai()); } /** * Returns true if IPL is streamed in (?) * * @param pos * @returns */ isPositionInsideIplStreamingExtents(pos: Vector3): boolean { return !!inv('0x73B40D97D7BAAD77', this.hash, f(pos.x), f(pos.y), f(pos.z), rai()); } /** * Old name: _REMOVE_IMAP_2 */ removeIplByHash(): void { inv('0x431E3AB760629B34', this.hash); } removeNamedPtfxAsset(): void { inv('0xF20866829E1C81A2', this.hash); } requestCollisionForModel(): void { inv('0xF1767BE37F661551', this.hash); } /** * @param p1 * @param p2 * @param p3 * @returns */ requestScenarioType(p1: int, p2: any, p3: any): int { return inv('0x19A6BE7D9C6884D3', this.hash, p1, p2, p3, rai()); } /** * @returns */ removeScenarioAsset(): any { return inv('0x4EDDD9E9CA5AF985', this.hash); } /** * @returns */ hasCollisionForModelLoaded(): boolean { return !!inv('0x210A79C9EC89778F', this.hash, rai()); } /** * @returns Returns `true` if the specified model has been loaded into streaming memory, `false` otherwise. */ hasModelLoaded(): boolean { return !!inv('0x1283B8B89DD5D1B6', this.hash, rai()); } /** * @param p1 * @returns */ hasScenarioTypeLoaded(p1: boolean): any { return inv('0x9427C94D2E4094A4', this.hash, p1); } /** * Old name: _REMOVE_IMAP */ removeIplHash(): void { inv('0x5A3E5CF7B4014B96', this.hash); } /** * @returns Returns whether the specified model exists in the game. */ get IsModelInCdimage(): boolean { return !!inv('0xD6F3B6D7716CFF8E', this.hash, rai()); } requestNamedPtfxAsset(): void { inv('0xF2B2353BBC0D4E8F', this.hash); } /** * Outputs IPL position and radius (previously wrongly named heading) * https://github.com/femga/rdr3_discoveries/blob/master/imaps/imaps_with_coords_and_heading.lua * * @returns position; radius */ get IplBoundingSphere(): [any, Vector3, number] { const result = inv<[number, number[], number]>('0x9C77964B0E07B633', this.hash, pvv(), pvf()); return [result[0], Vector3.fromArray(result[1]), result[2]]; } /** * Old name: _IS_IMAP_ACTIVE * * @returns */ get IsIplActiveHash(): boolean { return !!inv('0xD779B9B910BD3B7C', this.hash, rai()); } }