Skip to content

Commit

Permalink
feat(client): Interior API
Browse files Browse the repository at this point in the history
  • Loading branch information
xxshady committed Nov 16, 2024
1 parent 10111ce commit 1bb2a59
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions client/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -4564,5 +4572,61 @@ declare module "alt-client" {
public static register(path: string): Font;
}

export class Interior {
protected constructor();

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 hash 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";
}

0 comments on commit 1bb2a59

Please sign in to comment.