diff --git a/client/index.d.ts b/client/index.d.ts index 9f877e55..03d3c839 100644 --- a/client/index.d.ts +++ b/client/index.d.ts @@ -561,6 +561,14 @@ declare module "alt-client" { readonly propertyUpdateTicks: number[][]; } + /** + * Axis-Aligned Bounding Box. + */ + export interface IAABB { + min: number; + max: number; + } + export class BaseObject extends shared.BaseObject { /** * Whether this entity was created clientside or serverside. (Clientside = false, Serverside = true). @@ -4564,5 +4572,80 @@ declare module "alt-client" { public static register(path: string): Font; } + export class Interior { + protected constructor(); + + /** + * Create interior instance by id. Throws if id is invalid (for example, when it's 0). + * + * @example + * ```js + * // Get the interior where our local player is currently in + * const interiorId = natives.getInteriorFromEntity(alt.Player.local); + * if (interiorId !== 0) { + * const interior = alt.Interior.getForInteriorID(interiorId); + * + * // Output room count of it + * alt.log({ + * roomCount: interior.roomCount + * }); + * } else { + * alt.logError("Interior id is 0, seems like player is outside"); + * } + * ``` + */ + public static getForInteriorID(id: number): Interior; + + public readonly id: number; + public readonly pos: shared.Vector3; + public readonly rot: shared.Vector3; + public readonly roomCount: number; + public readonly portalCount: number; + public readonly entitiesExtents: IAABB; + + /** + * Get room by it's hash. Throws if room hash is invalid. + */ + public getRoomByHash(hash: number): InteriorRoom; + + /** + * Get room by it's index: from 0 to {@link roomCount}, for example if `roomCount = 2`, room indexes will be 0 and 1. + * Throws if room index is invalid. + */ + public getRoomByIndex(index: number): InteriorRoom; + + /** + * Get portal by it's index: from 0 to {@link portalCount}, for example if `portalCount = 2`, portal indexes will be 0 and 1. + * Throws if portal index is invalid. + */ + public getPortalByIndex(index: number): InteriorPortal; + } + + export class InteriorRoom { + public readonly index: number; + public readonly name: string; + public readonly nameHash: number; + public flag: number; + public timecycle: number; + public extents: IAABB; + } + + export class InteriorPortal { + public readonly index: number; + public readonly cornerCount: number; + public readonly entityCount: number; + public roomFrom: number; + public roomTo: number; + public flag: number; + + public getCornerPos(cornerIndex: number): shared.Vector3; + public setCornerPos(cornerIndex: number, value: shared.Vector3): void; + public getEntityArchetype(entityIndex: number): number; + public getEntityFlag(entityIndex: number): number; + public setEntityFlag(entityIndex: number, flag: number): void; + public getEntityPos(entityIndex: number): shared.Vector3; + public getEntityRot(entityIndex: number): shared.Vector3; + } + export * from "alt-shared"; }