@nativewrappers/server 0.0.122 → 0.0.123
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common/decors/ConVar.d.ts +14 -0
- package/common/decors/ConVar.js +70 -0
- package/common/decors/Events.d.ts +29 -28
- package/common/decors/Events.js +76 -121
- package/common/decors/Exports.d.ts +1 -0
- package/common/decors/Exports.js +53 -0
- package/common/decors/Permissions.d.ts +3 -0
- package/common/decors/Permissions.js +49 -0
- package/common/decors/Resources.d.ts +8 -0
- package/common/decors/Resources.js +83 -0
- package/common/decors/Ticks.d.ts +9 -0
- package/common/decors/Ticks.js +32 -0
- package/common-game/CommonGameConstants.d.ts +7 -0
- package/common-game/CommonGameConstants.js +24 -0
- package/common-game/CommonModel.d.ts +99 -0
- package/common-game/CommonModel.js +172 -0
- package/common-game/CommonTasks.d.ts +44 -0
- package/common-game/CommonTasks.js +233 -0
- package/common-game/cfx/StateBagChangeHandler.d.ts +1 -0
- package/common-game/cfx/StateBagChangeHandler.js +0 -0
- package/common-game/cfx/cfx.d.ts +6 -0
- package/common-game/cfx/cfx.js +4 -0
- package/common-game/definitions/index.d.js +0 -0
- package/common-game/definitions/redm.d.js +0 -0
- package/common-game/entities/CommonBaseEntity.d.ts +116 -0
- package/common-game/entities/CommonBaseEntity.js +266 -0
- package/common-game/entities/CommonBaseEntityBone.d.ts +11 -0
- package/common-game/entities/CommonBaseEntityBone.js +32 -0
- package/common-game/entities/CommonBaseEntityBoneCollection.d.ts +9 -0
- package/common-game/entities/CommonBaseEntityBoneCollection.js +17 -0
- package/common-game/entities/CommonEntityBone.d.ts +5 -0
- package/common-game/entities/CommonEntityBone.js +14 -0
- package/common-game/entities/CommonEntityBoneCollection.d.ts +9 -0
- package/common-game/entities/CommonEntityBoneCollection.js +24 -0
- package/common-game/entities/CommonEntityType.d.ts +4 -0
- package/common-game/entities/CommonEntityType.js +0 -0
- package/common-game/entities/CommonPed.d.ts +16 -0
- package/common-game/entities/CommonPed.js +52 -0
- package/common-game/entities/CommonPedBone.d.ts +6 -0
- package/common-game/entities/CommonPedBone.js +17 -0
- package/common-game/entities/CommonPedBoneCollection.d.ts +10 -0
- package/common-game/entities/CommonPedBoneCollection.js +31 -0
- package/common-game/entities/CommonPlayer.d.ts +61 -0
- package/common-game/entities/CommonPlayer.js +156 -0
- package/common-game/entities/CommonProp.d.ts +15 -0
- package/common-game/entities/CommonProp.js +43 -0
- package/common-game/entities/CommonVehicle.d.ts +11 -0
- package/common-game/entities/CommonVehicle.js +36 -0
- package/common-game/entities/GetEntityClassIdFromHandle.d.ts +2 -0
- package/common-game/entities/GetEntityClassIdFromHandle.js +23 -0
- package/common-game/entities/IHandle.d.ts +6 -0
- package/common-game/entities/IHandle.js +20 -0
- package/common-game/enums/VehicleSeat.d.ts +13 -0
- package/common-game/enums/VehicleSeat.js +17 -0
- package/common-game/interfaces/Dimension.d.ts +5 -0
- package/common-game/interfaces/Dimension.js +0 -0
- package/common-game/utils/Animations.d.ts +19 -0
- package/common-game/utils/Animations.js +43 -0
- package/index.d.ts +29 -0
- package/index.js +29 -0
- package/package.json +1 -1
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { StateBagChangeHandler } from "../cfx/StateBagChangeHandler";
|
|
2
|
+
import { CommonPed } from "./CommonPed";
|
|
3
|
+
import type { CommonEntity } from "./CommonEntityType";
|
|
4
|
+
export declare class CommonPlayer {
|
|
5
|
+
private handle;
|
|
6
|
+
private ped?;
|
|
7
|
+
private pvp;
|
|
8
|
+
private stateBagCookies;
|
|
9
|
+
private source;
|
|
10
|
+
private type;
|
|
11
|
+
static AllPlayers(excludeLocalPlayer?: boolean): IterableIterator<CommonPlayer>;
|
|
12
|
+
/**
|
|
13
|
+
* @param handle the handoe of the ped to get the player of
|
|
14
|
+
* @returns the player, or null if the player doesn't exist
|
|
15
|
+
*/
|
|
16
|
+
static fromPedHandle(handle: number): CommonPlayer | null;
|
|
17
|
+
/**
|
|
18
|
+
* @param serverId the server id to get the player of
|
|
19
|
+
* @returns the player, or null if the player doesn't exist
|
|
20
|
+
*/
|
|
21
|
+
static fromServerId(serverId: number): CommonPlayer | null;
|
|
22
|
+
/**
|
|
23
|
+
* @param [minimumDistance=Number.MAX_VALUE] the minimum distance this should check
|
|
24
|
+
* @param [fromPlayer=GameConstants.Player] the player to get the distance from
|
|
25
|
+
* @returns the closest player from {@param fromPlayer} and the distance the player was
|
|
26
|
+
*/
|
|
27
|
+
static getClosestPlayerPedWithDistance(minimumDistance?: number, fromPlayer?: CommonPlayer): [CommonPed | null, number];
|
|
28
|
+
/**
|
|
29
|
+
* @param [minimumDistance=Number.MAX_VALUE] the minimum distance this should check
|
|
30
|
+
* @param [fromPlayer=GameConstants.Player] the player to get the distance from
|
|
31
|
+
* @returns the closest player from {@param fromPlayer} and the distance the player was
|
|
32
|
+
*/
|
|
33
|
+
static getClosestPlayerPed(minimumDistance?: number, fromPlayer?: CommonPlayer): CommonPed | null;
|
|
34
|
+
/**
|
|
35
|
+
* @param handle the player handle, or if on the server, their source.
|
|
36
|
+
*/
|
|
37
|
+
constructor(handle?: number);
|
|
38
|
+
get Handle(): number;
|
|
39
|
+
/**
|
|
40
|
+
* This is here for compatibility with older versions.
|
|
41
|
+
*/
|
|
42
|
+
get Character(): CommonPed;
|
|
43
|
+
get Ped(): CommonPed;
|
|
44
|
+
get ServerId(): number;
|
|
45
|
+
get State(): StateBagInterface;
|
|
46
|
+
AddStateBagChangeHandler(keyFilter: string | null, handler: StateBagChangeHandler<unknown>): number;
|
|
47
|
+
/**
|
|
48
|
+
* A short hand function for AddStateBagChangeHandler, this gets automatically cleaned up on entity deletion.
|
|
49
|
+
* @param keyFilter the key to filter for or null
|
|
50
|
+
* @param handler the function to handle the change
|
|
51
|
+
* @returns a cookie to be used in RemoveStateBagChangeHandler
|
|
52
|
+
*/
|
|
53
|
+
listenForStateChange(keyFilter: string | null, handler: StateBagChangeHandler<unknown>): number;
|
|
54
|
+
removeStateListener(tgtCookie: number): void;
|
|
55
|
+
removeAllStateListeners(): void;
|
|
56
|
+
get Name(): string;
|
|
57
|
+
get IsDead(): boolean;
|
|
58
|
+
set DisableFiring(value: boolean);
|
|
59
|
+
get EntityPlayerIsAimingAt(): CommonEntity | null;
|
|
60
|
+
get StealthNoise(): number;
|
|
61
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { CommonPed } from "./CommonPed";
|
|
4
|
+
import { ClassTypes } from "../../common/utils/ClassTypes";
|
|
5
|
+
import { GetEntityClassFromHandle } from "./GetEntityClassIdFromHandle";
|
|
6
|
+
import cfx from "../cfx/cfx";
|
|
7
|
+
import { GameConstants } from "../CommonGameConstants";
|
|
8
|
+
class CommonPlayer {
|
|
9
|
+
static {
|
|
10
|
+
__name(this, "CommonPlayer");
|
|
11
|
+
}
|
|
12
|
+
handle;
|
|
13
|
+
ped;
|
|
14
|
+
pvp = false;
|
|
15
|
+
stateBagCookies = [];
|
|
16
|
+
source;
|
|
17
|
+
type = ClassTypes.Player;
|
|
18
|
+
static *AllPlayers(excludeLocalPlayer = true) {
|
|
19
|
+
for (const ply of GetActivePlayers()) {
|
|
20
|
+
if (excludeLocalPlayer && ply === GameConstants.PlayerId) {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
yield new CommonPlayer(ply);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @param handle the handoe of the ped to get the player of
|
|
28
|
+
* @returns the player, or null if the player doesn't exist
|
|
29
|
+
*/
|
|
30
|
+
static fromPedHandle(handle) {
|
|
31
|
+
const playerHandle = NetworkGetPlayerIndexFromPed(handle);
|
|
32
|
+
if (!handle) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return new CommonPlayer(playerHandle);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @param serverId the server id to get the player of
|
|
39
|
+
* @returns the player, or null if the player doesn't exist
|
|
40
|
+
*/
|
|
41
|
+
static fromServerId(serverId) {
|
|
42
|
+
const player = GetPlayerFromServerId(serverId);
|
|
43
|
+
if (player === -1) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
return new CommonPlayer(player);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* @param [minimumDistance=Number.MAX_VALUE] the minimum distance this should check
|
|
50
|
+
* @param [fromPlayer=GameConstants.Player] the player to get the distance from
|
|
51
|
+
* @returns the closest player from {@param fromPlayer} and the distance the player was
|
|
52
|
+
*/
|
|
53
|
+
static getClosestPlayerPedWithDistance(minimumDistance = Number.MAX_VALUE, fromPlayer = GameConstants.Player) {
|
|
54
|
+
const ped = fromPlayer.Ped;
|
|
55
|
+
const pos = ped.Position;
|
|
56
|
+
const data = [null, Number.MAX_VALUE];
|
|
57
|
+
for (const ply of CommonPlayer.AllPlayers(true)) {
|
|
58
|
+
const tgtPed = ply.Ped;
|
|
59
|
+
const dist = pos.distance(tgtPed.Position);
|
|
60
|
+
if (dist < data[1] && dist < minimumDistance) {
|
|
61
|
+
data[0] = tgtPed;
|
|
62
|
+
data[1] = dist;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return data;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* @param [minimumDistance=Number.MAX_VALUE] the minimum distance this should check
|
|
69
|
+
* @param [fromPlayer=GameConstants.Player] the player to get the distance from
|
|
70
|
+
* @returns the closest player from {@param fromPlayer} and the distance the player was
|
|
71
|
+
*/
|
|
72
|
+
static getClosestPlayerPed(minimumDistance = Number.MAX_VALUE, fromPlayer = GameConstants.Player) {
|
|
73
|
+
const data = this.getClosestPlayerPedWithDistance(minimumDistance, fromPlayer);
|
|
74
|
+
return data[0];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* @param handle the player handle, or if on the server, their source.
|
|
78
|
+
*/
|
|
79
|
+
constructor(handle = -1) {
|
|
80
|
+
this.handle = handle;
|
|
81
|
+
this.source = this.ServerId;
|
|
82
|
+
}
|
|
83
|
+
get Handle() {
|
|
84
|
+
return this.handle;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* This is here for compatibility with older versions.
|
|
88
|
+
*/
|
|
89
|
+
get Character() {
|
|
90
|
+
return this.Ped;
|
|
91
|
+
}
|
|
92
|
+
get Ped() {
|
|
93
|
+
const handle = GetPlayerPed(this.handle);
|
|
94
|
+
if (typeof this.ped === "undefined" || handle !== this.ped.Handle) {
|
|
95
|
+
this.ped = new CommonPed(handle);
|
|
96
|
+
}
|
|
97
|
+
return this.ped;
|
|
98
|
+
}
|
|
99
|
+
get ServerId() {
|
|
100
|
+
if (this.source) {
|
|
101
|
+
return this.source;
|
|
102
|
+
}
|
|
103
|
+
return GetPlayerServerId(this.handle);
|
|
104
|
+
}
|
|
105
|
+
get State() {
|
|
106
|
+
return cfx.Player(this.ServerId).state;
|
|
107
|
+
}
|
|
108
|
+
AddStateBagChangeHandler(keyFilter, handler) {
|
|
109
|
+
const cookie = AddStateBagChangeHandler(keyFilter, `player:${this.ServerId}`, handler);
|
|
110
|
+
this.stateBagCookies.push(cookie);
|
|
111
|
+
return cookie;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* A short hand function for AddStateBagChangeHandler, this gets automatically cleaned up on entity deletion.
|
|
115
|
+
* @param keyFilter the key to filter for or null
|
|
116
|
+
* @param handler the function to handle the change
|
|
117
|
+
* @returns a cookie to be used in RemoveStateBagChangeHandler
|
|
118
|
+
*/
|
|
119
|
+
listenForStateChange(keyFilter, handler) {
|
|
120
|
+
return this.AddStateBagChangeHandler(keyFilter, handler);
|
|
121
|
+
}
|
|
122
|
+
removeStateListener(tgtCookie) {
|
|
123
|
+
this.stateBagCookies = this.stateBagCookies.filter((cookie) => {
|
|
124
|
+
const isCookie = cookie === tgtCookie;
|
|
125
|
+
if (isCookie) RemoveStateBagChangeHandler(cookie);
|
|
126
|
+
return isCookie;
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
removeAllStateListeners() {
|
|
130
|
+
for (const cookie of this.stateBagCookies) {
|
|
131
|
+
RemoveStateBagChangeHandler(cookie);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
get Name() {
|
|
135
|
+
return GetPlayerName(this.handle);
|
|
136
|
+
}
|
|
137
|
+
get IsDead() {
|
|
138
|
+
return IsPlayerDead(this.handle);
|
|
139
|
+
}
|
|
140
|
+
set DisableFiring(value) {
|
|
141
|
+
DisablePlayerFiring(this.handle, value);
|
|
142
|
+
}
|
|
143
|
+
get EntityPlayerIsAimingAt() {
|
|
144
|
+
const [entityHit, entity] = GetEntityPlayerIsFreeAimingAt(this.handle);
|
|
145
|
+
if (entityHit) {
|
|
146
|
+
return GetEntityClassFromHandle(entity);
|
|
147
|
+
}
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
get StealthNoise() {
|
|
151
|
+
return GetPlayerCurrentStealthNoise(this.handle);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
export {
|
|
155
|
+
CommonPlayer
|
|
156
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ClassTypes } from "../../common/utils/ClassTypes";
|
|
2
|
+
import { CommonBaseEntity } from "./CommonBaseEntity";
|
|
3
|
+
import { CommonEntityBoneCollection } from "./CommonEntityBoneCollection";
|
|
4
|
+
import type { CommonEntity } from "./CommonEntityType";
|
|
5
|
+
export declare class CommonProp extends CommonBaseEntity {
|
|
6
|
+
static fromHandle(handle: number): CommonProp | null;
|
|
7
|
+
static fromNetworkId(networkId: number): CommonProp | null;
|
|
8
|
+
protected type: ClassTypes;
|
|
9
|
+
protected bones?: CommonEntityBoneCollection | undefined;
|
|
10
|
+
constructor(handle: number);
|
|
11
|
+
exists(): boolean;
|
|
12
|
+
placeOnGround(): void;
|
|
13
|
+
getEntityAttachedTo(): CommonEntity;
|
|
14
|
+
get Bones(): CommonEntityBoneCollection;
|
|
15
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { ClassTypes } from "../../common/utils/ClassTypes";
|
|
4
|
+
import { CommonBaseEntity } from "./CommonBaseEntity";
|
|
5
|
+
import { CommonEntityBoneCollection } from "./CommonEntityBoneCollection";
|
|
6
|
+
import { GetEntityClassFromHandle } from "./GetEntityClassIdFromHandle";
|
|
7
|
+
class CommonProp extends CommonBaseEntity {
|
|
8
|
+
static {
|
|
9
|
+
__name(this, "CommonProp");
|
|
10
|
+
}
|
|
11
|
+
static fromHandle(handle) {
|
|
12
|
+
return new this(handle);
|
|
13
|
+
}
|
|
14
|
+
static fromNetworkId(networkId) {
|
|
15
|
+
if (!NetworkDoesEntityExistWithNetworkId(networkId)) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
return new this(NetworkGetEntityFromNetworkId(networkId));
|
|
19
|
+
}
|
|
20
|
+
type = ClassTypes.Prop;
|
|
21
|
+
bones;
|
|
22
|
+
constructor(handle) {
|
|
23
|
+
super(handle);
|
|
24
|
+
}
|
|
25
|
+
exists() {
|
|
26
|
+
return super.exists() && GetEntityType(this.handle) === 3;
|
|
27
|
+
}
|
|
28
|
+
placeOnGround() {
|
|
29
|
+
PlaceObjectOnGroundProperly(this.handle);
|
|
30
|
+
}
|
|
31
|
+
getEntityAttachedTo() {
|
|
32
|
+
return GetEntityClassFromHandle(this.handle);
|
|
33
|
+
}
|
|
34
|
+
get Bones() {
|
|
35
|
+
if (!this.bones) {
|
|
36
|
+
this.bones = new CommonEntityBoneCollection(this);
|
|
37
|
+
}
|
|
38
|
+
return this.bones;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
CommonProp
|
|
43
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ClassTypes } from "../../common/utils/ClassTypes";
|
|
2
|
+
import { CommonBaseEntity } from "./CommonBaseEntity";
|
|
3
|
+
import { CommonEntityBoneCollection } from "./CommonEntityBoneCollection";
|
|
4
|
+
export declare class CommonVehicle extends CommonBaseEntity {
|
|
5
|
+
static fromHandle(handle: number): CommonVehicle | null;
|
|
6
|
+
static fromNetworkId(networkId: number): CommonVehicle | null;
|
|
7
|
+
protected type: ClassTypes;
|
|
8
|
+
protected bones?: CommonEntityBoneCollection;
|
|
9
|
+
constructor(handle: number);
|
|
10
|
+
get Bones(): CommonEntityBoneCollection;
|
|
11
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { ClassTypes } from "../../common/utils/ClassTypes";
|
|
4
|
+
import { CommonBaseEntity } from "./CommonBaseEntity";
|
|
5
|
+
import { CommonEntityBoneCollection } from "./CommonEntityBoneCollection";
|
|
6
|
+
class CommonVehicle extends CommonBaseEntity {
|
|
7
|
+
static {
|
|
8
|
+
__name(this, "CommonVehicle");
|
|
9
|
+
}
|
|
10
|
+
static fromHandle(handle) {
|
|
11
|
+
if (handle === 0 || !DoesEntityExist(handle)) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
return new this(handle);
|
|
15
|
+
}
|
|
16
|
+
static fromNetworkId(networkId) {
|
|
17
|
+
if (!NetworkDoesEntityExistWithNetworkId(networkId)) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
return new this(NetworkGetEntityFromNetworkId(networkId));
|
|
21
|
+
}
|
|
22
|
+
type = ClassTypes.Vehicle;
|
|
23
|
+
bones;
|
|
24
|
+
constructor(handle) {
|
|
25
|
+
super(handle);
|
|
26
|
+
}
|
|
27
|
+
get Bones() {
|
|
28
|
+
if (!this.bones) {
|
|
29
|
+
this.bones = new CommonEntityBoneCollection(this);
|
|
30
|
+
}
|
|
31
|
+
return this.bones;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
CommonVehicle
|
|
36
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { CommonPed } from "./CommonPed";
|
|
4
|
+
import { CommonProp } from "./CommonProp";
|
|
5
|
+
import { CommonVehicle } from "./CommonVehicle";
|
|
6
|
+
function GetEntityClassFromHandle(entityId) {
|
|
7
|
+
switch (GetEntityType(entityId)) {
|
|
8
|
+
case 1: {
|
|
9
|
+
return CommonPed.fromHandle(entityId);
|
|
10
|
+
}
|
|
11
|
+
case 2: {
|
|
12
|
+
return CommonVehicle.fromHandle(entityId);
|
|
13
|
+
}
|
|
14
|
+
case 3: {
|
|
15
|
+
return CommonProp.fromHandle(entityId);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
__name(GetEntityClassFromHandle, "GetEntityClassFromHandle");
|
|
21
|
+
export {
|
|
22
|
+
GetEntityClassFromHandle
|
|
23
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
class IHandle {
|
|
4
|
+
static {
|
|
5
|
+
__name(this, "IHandle");
|
|
6
|
+
}
|
|
7
|
+
handle;
|
|
8
|
+
constructor(handle) {
|
|
9
|
+
this.handle = handle;
|
|
10
|
+
}
|
|
11
|
+
exists() {
|
|
12
|
+
return DoesEntityExist(this.handle);
|
|
13
|
+
}
|
|
14
|
+
get Handle() {
|
|
15
|
+
return this.handle;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
IHandle
|
|
20
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var VehicleSeat = /* @__PURE__ */ ((VehicleSeat2) => {
|
|
2
|
+
VehicleSeat2[VehicleSeat2["AnyPassenger"] = -2] = "AnyPassenger";
|
|
3
|
+
VehicleSeat2[VehicleSeat2["Driver"] = -1] = "Driver";
|
|
4
|
+
VehicleSeat2[VehicleSeat2["FrontRight"] = 0] = "FrontRight";
|
|
5
|
+
VehicleSeat2[VehicleSeat2["BackLeft"] = 1] = "BackLeft";
|
|
6
|
+
VehicleSeat2[VehicleSeat2["BackRight"] = 2] = "BackRight";
|
|
7
|
+
VehicleSeat2[VehicleSeat2["ExtraLeft1"] = 3] = "ExtraLeft1";
|
|
8
|
+
VehicleSeat2[VehicleSeat2["ExtraRight1"] = 4] = "ExtraRight1";
|
|
9
|
+
VehicleSeat2[VehicleSeat2["ExtraLeft2"] = 5] = "ExtraLeft2";
|
|
10
|
+
VehicleSeat2[VehicleSeat2["ExtraRight2"] = 6] = "ExtraRight2";
|
|
11
|
+
VehicleSeat2[VehicleSeat2["ExtraLeft3"] = 7] = "ExtraLeft3";
|
|
12
|
+
VehicleSeat2[VehicleSeat2["ExtraRight3"] = 8] = "ExtraRight3";
|
|
13
|
+
return VehicleSeat2;
|
|
14
|
+
})(VehicleSeat || {});
|
|
15
|
+
export {
|
|
16
|
+
VehicleSeat
|
|
17
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A utility to load an animation dictionary, anything that loads an animation should RemoveAnimDict after its finish being used.
|
|
3
|
+
* @param animDict the animation dictionary to load
|
|
4
|
+
* @param waitTime how long to wait for the dictionary to load
|
|
5
|
+
* @returns {boolean} if the animation successfully loaded
|
|
6
|
+
*/
|
|
7
|
+
export declare const LoadAnimDict: (animDict: string, waitTime?: number) => Promise<boolean>;
|
|
8
|
+
/**
|
|
9
|
+
* A utility to load multiple animation dictionary, anything that loads an animation should RemoveAnimDict after its finish being used.
|
|
10
|
+
* @param animDict the animation dictionary to load
|
|
11
|
+
* @param waitTime how long to wait for the dictionary to load
|
|
12
|
+
* @returns if the animation successfully loaded, if the animation failed to load it will return an array of animations that failed to load
|
|
13
|
+
*/
|
|
14
|
+
export declare const LoadAnimDictArray: (animDict: string[], waitTime?: number) => Promise<[boolean, string[] | null]>;
|
|
15
|
+
/**
|
|
16
|
+
* A utility to unload multiple animation dictionary
|
|
17
|
+
* @param animDict the animation dictionaries to unload
|
|
18
|
+
*/
|
|
19
|
+
export declare const RemoveAnimDictArray: (animDict: string[]) => void;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { Delay } from "../../common/utils/Delay";
|
|
4
|
+
const LoadAnimDict = /* @__PURE__ */ __name(async (animDict, waitTime = 1e3) => {
|
|
5
|
+
const start = GetGameTimer();
|
|
6
|
+
if (!HasAnimDictLoaded(animDict)) {
|
|
7
|
+
RequestAnimDict(animDict);
|
|
8
|
+
}
|
|
9
|
+
while (!HasAnimDictLoaded(animDict)) {
|
|
10
|
+
if (GetGameTimer() - start >= waitTime) return false;
|
|
11
|
+
await Delay(0);
|
|
12
|
+
}
|
|
13
|
+
return true;
|
|
14
|
+
}, "LoadAnimDict");
|
|
15
|
+
const LoadAnimDictArray = /* @__PURE__ */ __name(async (animDict, waitTime = 1e3) => {
|
|
16
|
+
const start = GetGameTimer();
|
|
17
|
+
for (const dict of animDict) {
|
|
18
|
+
if (!HasAnimDictLoaded(dict)) {
|
|
19
|
+
RequestAnimDict(dict);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const animsLoaded = /* @__PURE__ */ new Set();
|
|
23
|
+
while (animsLoaded.size !== animDict.length) {
|
|
24
|
+
for (const dict of animDict) {
|
|
25
|
+
if (!animsLoaded.has(dict) && HasAnimDictLoaded(dict)) {
|
|
26
|
+
animsLoaded.add(dict);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (GetGameTimer() - start >= waitTime) return [false, animDict.filter((dict) => !animsLoaded.has(dict))];
|
|
30
|
+
await Delay(0);
|
|
31
|
+
}
|
|
32
|
+
return [true, null];
|
|
33
|
+
}, "LoadAnimDictArray");
|
|
34
|
+
const RemoveAnimDictArray = /* @__PURE__ */ __name((animDict) => {
|
|
35
|
+
for (const dict of animDict) {
|
|
36
|
+
RemoveAnimDict(dict);
|
|
37
|
+
}
|
|
38
|
+
}, "RemoveAnimDictArray");
|
|
39
|
+
export {
|
|
40
|
+
LoadAnimDict,
|
|
41
|
+
LoadAnimDictArray,
|
|
42
|
+
RemoveAnimDictArray
|
|
43
|
+
};
|
package/index.d.ts
CHANGED
|
@@ -12,6 +12,30 @@ export * from "./entities/Ped";
|
|
|
12
12
|
export * from "./entities/Player";
|
|
13
13
|
export * from "./entities/Prop";
|
|
14
14
|
export * from "./entities/Vehicle";
|
|
15
|
+
export * from "./common-game/CommonGameConstants";
|
|
16
|
+
export * from "./common-game/CommonModel";
|
|
17
|
+
export * from "./common-game/CommonTasks";
|
|
18
|
+
export * from "./common-game/utils/Animations";
|
|
19
|
+
export * from "./common-game/interfaces/Dimension";
|
|
20
|
+
export * from "./common-game/enums/VehicleSeat";
|
|
21
|
+
export * from "./common-game/entities/CommonBaseEntity";
|
|
22
|
+
export * from "./common-game/entities/CommonBaseEntityBone";
|
|
23
|
+
export * from "./common-game/entities/CommonBaseEntityBoneCollection";
|
|
24
|
+
export * from "./common-game/entities/CommonEntityBone";
|
|
25
|
+
export * from "./common-game/entities/CommonEntityBoneCollection";
|
|
26
|
+
export * from "./common-game/entities/CommonEntityType";
|
|
27
|
+
export * from "./common-game/entities/CommonPed";
|
|
28
|
+
export * from "./common-game/entities/CommonPedBone";
|
|
29
|
+
export * from "./common-game/entities/CommonPedBoneCollection";
|
|
30
|
+
export * from "./common-game/entities/CommonPlayer";
|
|
31
|
+
export * from "./common-game/entities/CommonProp";
|
|
32
|
+
export * from "./common-game/entities/CommonVehicle";
|
|
33
|
+
export * from "./common-game/entities/GetEntityClassIdFromHandle";
|
|
34
|
+
export * from "./common-game/entities/IHandle";
|
|
35
|
+
export * from "./common-game/definitions/index.d";
|
|
36
|
+
export * from "./common-game/definitions/redm.d";
|
|
37
|
+
export * from "./common-game/cfx/StateBagChangeHandler";
|
|
38
|
+
export * from "./common-game/cfx/cfx";
|
|
15
39
|
export * from "./common/Command";
|
|
16
40
|
export * from "./common/Convar";
|
|
17
41
|
export * from "./common/GlobalData";
|
|
@@ -32,6 +56,11 @@ export * from "./common/utils/getStringFromUInt8Array";
|
|
|
32
56
|
export * from "./common/utils/getUInt32FromUint8Array";
|
|
33
57
|
export * from "./common/utils/randomInt";
|
|
34
58
|
export * from "./common/net/NetworkedMap";
|
|
59
|
+
export * from "./common/decors/ConVar";
|
|
35
60
|
export * from "./common/decors/Events";
|
|
61
|
+
export * from "./common/decors/Exports";
|
|
62
|
+
export * from "./common/decors/Permissions";
|
|
63
|
+
export * from "./common/decors/Resources";
|
|
64
|
+
export * from "./common/decors/Ticks";
|
|
36
65
|
export * from "./cfx/StateBagChangeHandler";
|
|
37
66
|
export * from "./cfx/index";
|
package/index.js
CHANGED
|
@@ -12,6 +12,30 @@ export * from "./entities/Ped";
|
|
|
12
12
|
export * from "./entities/Player";
|
|
13
13
|
export * from "./entities/Prop";
|
|
14
14
|
export * from "./entities/Vehicle";
|
|
15
|
+
export * from "./common-game/CommonGameConstants";
|
|
16
|
+
export * from "./common-game/CommonModel";
|
|
17
|
+
export * from "./common-game/CommonTasks";
|
|
18
|
+
export * from "./common-game/utils/Animations";
|
|
19
|
+
export * from "./common-game/interfaces/Dimension";
|
|
20
|
+
export * from "./common-game/enums/VehicleSeat";
|
|
21
|
+
export * from "./common-game/entities/CommonBaseEntity";
|
|
22
|
+
export * from "./common-game/entities/CommonBaseEntityBone";
|
|
23
|
+
export * from "./common-game/entities/CommonBaseEntityBoneCollection";
|
|
24
|
+
export * from "./common-game/entities/CommonEntityBone";
|
|
25
|
+
export * from "./common-game/entities/CommonEntityBoneCollection";
|
|
26
|
+
export * from "./common-game/entities/CommonEntityType";
|
|
27
|
+
export * from "./common-game/entities/CommonPed";
|
|
28
|
+
export * from "./common-game/entities/CommonPedBone";
|
|
29
|
+
export * from "./common-game/entities/CommonPedBoneCollection";
|
|
30
|
+
export * from "./common-game/entities/CommonPlayer";
|
|
31
|
+
export * from "./common-game/entities/CommonProp";
|
|
32
|
+
export * from "./common-game/entities/CommonVehicle";
|
|
33
|
+
export * from "./common-game/entities/GetEntityClassIdFromHandle";
|
|
34
|
+
export * from "./common-game/entities/IHandle";
|
|
35
|
+
export * from "./common-game/definitions/index.d";
|
|
36
|
+
export * from "./common-game/definitions/redm.d";
|
|
37
|
+
export * from "./common-game/cfx/StateBagChangeHandler";
|
|
38
|
+
export * from "./common-game/cfx/cfx";
|
|
15
39
|
export * from "./common/Command";
|
|
16
40
|
export * from "./common/Convar";
|
|
17
41
|
export * from "./common/GlobalData";
|
|
@@ -32,6 +56,11 @@ export * from "./common/utils/getStringFromUInt8Array";
|
|
|
32
56
|
export * from "./common/utils/getUInt32FromUint8Array";
|
|
33
57
|
export * from "./common/utils/randomInt";
|
|
34
58
|
export * from "./common/net/NetworkedMap";
|
|
59
|
+
export * from "./common/decors/ConVar";
|
|
35
60
|
export * from "./common/decors/Events";
|
|
61
|
+
export * from "./common/decors/Exports";
|
|
62
|
+
export * from "./common/decors/Permissions";
|
|
63
|
+
export * from "./common/decors/Resources";
|
|
64
|
+
export * from "./common/decors/Ticks";
|
|
36
65
|
export * from "./cfx/StateBagChangeHandler";
|
|
37
66
|
export * from "./cfx/index";
|