Skip to content

Commit

Permalink
chore: Update master branch (#332)
Browse files Browse the repository at this point in the history
* chore: Bump version

* feat(client): Interior API (#325)

* feat(client): Interior API

* chore(client): add description for getForInteriorID

* chore(client): add example

* fix(client): typo

* fix(client): InteriorRoom and InteriorPortal don't have public constructors (#326)

* chore: Bump version

* feat(client): add config flag SWAP_ALLOW_HEAD_PROP_IN_VEHICLE_FLAG (#333)

---------

Co-authored-by: xLuxy <[email protected]>
  • Loading branch information
xxshady and xLuxy authored Jan 14, 2025
1 parent cc760fc commit 3436b91
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 3 deletions.
92 changes: 92 additions & 0 deletions client/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ declare module "alt-client" {
* Useful when damage in weapon meta is set to 0, and is calculated manually by script in event.
*/
ForceVehicleTyreBurst = "FORCE_VEHICLE_TYRE_BURST",
/**
* Prevents head props from being hidden when getting into the vehicle.
* Equivalent to calling `setPedResetFlag` native with flag 337 in every tick.
*/
SwapAllowHeadPropInVehicleFlag = "SWAP_ALLOW_HEAD_PROP_IN_VEHICLE_FLAG",
}

/** @deprecated This method will be removed in the next major release. (v17) */
Expand Down Expand Up @@ -561,6 +566,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 +4577,84 @@ 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 {
protected constructor();

public readonly index: number;
public readonly name: string;
public readonly nameHash: number;
public flag: number;
public timecycle: number;
public extents: IAABB;
}

export class InteriorPortal {
protected constructor();

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";
}
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@altv/types-client",
"version": "16.0.17",
"version": "16.0.19",
"description": "This package contains types definitions for alt:V client-side module.",
"types": "index.d.ts",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@altv/types-server",
"version": "16.0.11",
"version": "16.0.12",
"description": "This package contains types definitions for alt:V server-side module.",
"types": "index.d.ts",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion shared/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@altv/types-shared",
"version": "16.0.3",
"version": "16.0.4",
"description": "This package contains types definitions for alt:V JS module shared types.",
"types": "index.d.ts",
"files": [
Expand Down

0 comments on commit 3436b91

Please sign in to comment.