@nativewrappers/server 0.0.79 → 0.0.81
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/Game.js +62 -0
- package/cfx/StateBagChangeHandler.js +0 -0
- package/cfx/index.d.ts +1 -1
- package/cfx/index.js +4 -0
- package/common/Command.js +111 -0
- package/common/Convar.js +58 -0
- package/common/GlobalData.js +16 -0
- package/common/Kvp.js +137 -0
- package/common/Resource.js +54 -0
- package/common/decors/Events.js +170 -0
- package/common/net/NetworkedMap.js +225 -0
- package/common/types.js +0 -0
- package/common/utils/ClassTypes.js +15 -0
- package/common/utils/Color.js +33 -0
- package/common/utils/Delay.d.ts +1 -0
- package/common/utils/Delay.js +6 -0
- package/common/utils/Maths.js +18 -0
- package/common/utils/Point.d.ts +9 -0
- package/common/utils/Point.js +36 -0
- package/common/utils/PointF.d.ts +1 -1
- package/common/utils/PointF.js +18 -0
- package/common/utils/Quaternion.d.ts +1 -1
- package/common/utils/Quaternion.js +33 -0
- package/common/utils/Vector.js +589 -0
- package/common/utils/cleanPlayerName.js +17 -0
- package/common/utils/enumValues.js +20 -0
- package/common/utils/getStringFromUInt8Array.js +6 -0
- package/common/utils/getUInt32FromUint8Array.js +6 -0
- package/entities/BaseEntity.d.ts +2 -3
- package/entities/BaseEntity.js +141 -0
- package/entities/Entity.js +20 -0
- package/entities/Ped.d.ts +1 -1
- package/entities/Ped.js +85 -0
- package/entities/Player.d.ts +1 -1
- package/entities/Player.js +143 -0
- package/entities/Prop.d.ts +1 -1
- package/entities/Prop.js +38 -0
- package/entities/Vehicle.d.ts +2 -2
- package/entities/Vehicle.js +181 -0
- package/enum/OrphanMode.js +9 -0
- package/enum/PopulationType.js +17 -0
- package/enum/VehicleLockStatus.js +13 -0
- package/enum/VehicleType.js +14 -0
- package/enum/eEntityType.js +9 -0
- package/package.json +2 -2
- package/type/Anticheat.js +0 -0
- package/type/Hash.js +0 -0
- package/common/index.d.ts +0 -8
- package/common/utils/Vector2.d.ts +0 -1
- package/common/utils/Vector3.d.ts +0 -1
- package/common/utils/Vector4.d.ts +0 -1
- package/common/utils/index.d.ts +0 -12
- package/entities/index.d.ts +0 -5
- package/enum/index.d.ts +0 -5
- package/index.d.ts +0 -7
- package/index.js +0 -2125
- package/utils/index.d.ts +0 -1
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import cfx from "../cfx";
|
|
4
|
+
import { ClassTypes } from "../../common/utils/ClassTypes";
|
|
5
|
+
import { Vector3, Vector4 } from "../common/utils/Vector";
|
|
6
|
+
class BaseEntity {
|
|
7
|
+
constructor(handle) {
|
|
8
|
+
this.handle = handle;
|
|
9
|
+
}
|
|
10
|
+
static {
|
|
11
|
+
__name(this, "BaseEntity");
|
|
12
|
+
}
|
|
13
|
+
type = ClassTypes.Entity;
|
|
14
|
+
// Replaces the current handle for the entity used on, this hsould be used sparringly, mainly
|
|
15
|
+
// in situations where you're going to reuse an entity over and over and don't want to make a
|
|
16
|
+
// new entity every time.
|
|
17
|
+
//
|
|
18
|
+
// **WARNING**: This does no checks, if you provide it an invalid entity it will use it
|
|
19
|
+
//
|
|
20
|
+
// ```ts
|
|
21
|
+
// const REUSABLE_ENTITY = new Entity(entityHandle);
|
|
22
|
+
//
|
|
23
|
+
// onNet("entityHandler", (entNetId: number) => {
|
|
24
|
+
// // if no net entity we should ignore
|
|
25
|
+
// const entId = NetworkGetEntityFromNetworkId(entNetId);
|
|
26
|
+
// if (entId === 0) return;
|
|
27
|
+
//
|
|
28
|
+
// // Reuse our entity so we don't have to initialize a new one
|
|
29
|
+
// REUSABLE_ENTITY.replaceHandle(entId);
|
|
30
|
+
// // Do something with REUSABLE_ENTITY entity
|
|
31
|
+
// })
|
|
32
|
+
// ```
|
|
33
|
+
replaceHandle(newHandle) {
|
|
34
|
+
this.handle = newHandle;
|
|
35
|
+
}
|
|
36
|
+
static fromNetworkId(networkId) {
|
|
37
|
+
const ent = NetworkGetEntityFromNetworkId(networkId);
|
|
38
|
+
if (ent === 0) return null;
|
|
39
|
+
return new BaseEntity(ent);
|
|
40
|
+
}
|
|
41
|
+
static fromStateBagName(stateBagName) {
|
|
42
|
+
const ent = GetEntityFromStateBagName(stateBagName);
|
|
43
|
+
if (ent === 0) return null;
|
|
44
|
+
return new BaseEntity(ent);
|
|
45
|
+
}
|
|
46
|
+
get State() {
|
|
47
|
+
return cfx.Entity(this.handle).state;
|
|
48
|
+
}
|
|
49
|
+
get Handle() {
|
|
50
|
+
return this.handle;
|
|
51
|
+
}
|
|
52
|
+
get Owner() {
|
|
53
|
+
return NetworkGetEntityOwner(this.handle);
|
|
54
|
+
}
|
|
55
|
+
get FirstOwner() {
|
|
56
|
+
return NetworkGetFirstEntityOwner(this.handle);
|
|
57
|
+
}
|
|
58
|
+
get Exists() {
|
|
59
|
+
return this.handle !== 0 && DoesEntityExist(this.handle);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* @returns the entity that the calling entity is attached to, or null if
|
|
63
|
+
* there is none
|
|
64
|
+
*/
|
|
65
|
+
get AttachedTo() {
|
|
66
|
+
const ent = GetEntityAttachedTo(this.handle);
|
|
67
|
+
if (ent === 0) return null;
|
|
68
|
+
return new BaseEntity(ent);
|
|
69
|
+
}
|
|
70
|
+
get Position() {
|
|
71
|
+
return Vector3.fromArray(GetEntityCoords(this.handle));
|
|
72
|
+
}
|
|
73
|
+
get Heading() {
|
|
74
|
+
return GetEntityHeading(this.handle);
|
|
75
|
+
}
|
|
76
|
+
get PositionAndHeading() {
|
|
77
|
+
return Vector4.fromArray([...GetEntityCoords(this.handle), GetEntityHeading(this.handle)]);
|
|
78
|
+
}
|
|
79
|
+
get Health() {
|
|
80
|
+
return GetEntityHealth(this.handle);
|
|
81
|
+
}
|
|
82
|
+
get MaxHealth() {
|
|
83
|
+
return GetEntityMaxHealth(this.handle);
|
|
84
|
+
}
|
|
85
|
+
get Model() {
|
|
86
|
+
return GetEntityModel(this.handle);
|
|
87
|
+
}
|
|
88
|
+
get PopulationType() {
|
|
89
|
+
return GetEntityPopulationType(this.handle);
|
|
90
|
+
}
|
|
91
|
+
get Rotation() {
|
|
92
|
+
return Vector3.fromArray(GetEntityRotation(this.handle));
|
|
93
|
+
}
|
|
94
|
+
get RotationVelocity() {
|
|
95
|
+
return Vector3.fromArray(GetEntityRotationVelocity(this.handle));
|
|
96
|
+
}
|
|
97
|
+
get RoutingBucket() {
|
|
98
|
+
return GetEntityRoutingBucket(this.handle);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* @returns The script that made the entity
|
|
102
|
+
*/
|
|
103
|
+
get Script() {
|
|
104
|
+
return GetEntityScript(this.handle);
|
|
105
|
+
}
|
|
106
|
+
get Speed() {
|
|
107
|
+
return GetEntitySpeed(this.handle);
|
|
108
|
+
}
|
|
109
|
+
get Type() {
|
|
110
|
+
return GetEntityType(this.handle);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* @returns the entitys velocity, if the entity is a ped it will return Vector3(0, 0, 0)
|
|
114
|
+
*/
|
|
115
|
+
get Velocity() {
|
|
116
|
+
return Vector3.fromArray(GetEntityVelocity(this.handle));
|
|
117
|
+
}
|
|
118
|
+
get IsVisible() {
|
|
119
|
+
return IsEntityVisible(this.handle);
|
|
120
|
+
}
|
|
121
|
+
get NetworkId() {
|
|
122
|
+
return NetworkGetNetworkIdFromEntity(this.handle);
|
|
123
|
+
}
|
|
124
|
+
get IsNoLongerNeeded() {
|
|
125
|
+
return HasEntityBeenMarkedAsNoLongerNeeded(this.handle);
|
|
126
|
+
}
|
|
127
|
+
get OrphanMode() {
|
|
128
|
+
return GetEntityOrphanMode(this.Handle);
|
|
129
|
+
}
|
|
130
|
+
set OrphanMode(orphanMode) {
|
|
131
|
+
SetEntityOrphanMode(this.Handle, orphanMode);
|
|
132
|
+
}
|
|
133
|
+
delete() {
|
|
134
|
+
if (this.Exists) {
|
|
135
|
+
DeleteEntity(this.handle);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
export {
|
|
140
|
+
BaseEntity
|
|
141
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { BaseEntity } from "./BaseEntity";
|
|
4
|
+
class Entity extends BaseEntity {
|
|
5
|
+
static {
|
|
6
|
+
__name(this, "Entity");
|
|
7
|
+
}
|
|
8
|
+
constructor(handle) {
|
|
9
|
+
super(handle);
|
|
10
|
+
}
|
|
11
|
+
static fromNetworkId(netId) {
|
|
12
|
+
return new Entity(NetworkGetEntityFromNetworkId(netId));
|
|
13
|
+
}
|
|
14
|
+
static fromHandle(handle) {
|
|
15
|
+
return new Entity(handle);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
Entity
|
|
20
|
+
};
|
package/entities/Ped.d.ts
CHANGED
package/entities/Ped.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
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 { BaseEntity } from "./BaseEntity";
|
|
5
|
+
import { Vehicle } from "./Vehicle";
|
|
6
|
+
class Ped extends BaseEntity {
|
|
7
|
+
static {
|
|
8
|
+
__name(this, "Ped");
|
|
9
|
+
}
|
|
10
|
+
type = ClassTypes.Ped;
|
|
11
|
+
constructor(handle) {
|
|
12
|
+
super(handle);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get an interable list of peds currently on the server
|
|
16
|
+
* @returns Iterable list of Peds.
|
|
17
|
+
*/
|
|
18
|
+
static *AllPeds() {
|
|
19
|
+
for (const pedId of GetAllPeds()) {
|
|
20
|
+
yield new Ped(pedId);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
static fromNetworkId(netId) {
|
|
24
|
+
const ent = NetworkGetEntityFromNetworkId(netId);
|
|
25
|
+
if (ent === 0) return null;
|
|
26
|
+
return new Ped(ent);
|
|
27
|
+
}
|
|
28
|
+
static fromStateBagName(stateBagName) {
|
|
29
|
+
const handle = GetEntityFromStateBagName(stateBagName);
|
|
30
|
+
if (handle === 0) return null;
|
|
31
|
+
return new Ped(handle);
|
|
32
|
+
}
|
|
33
|
+
static fromSource(source) {
|
|
34
|
+
return new Ped(GetPlayerPed(source));
|
|
35
|
+
}
|
|
36
|
+
get Armour() {
|
|
37
|
+
return GetPedArmour(this.handle);
|
|
38
|
+
}
|
|
39
|
+
get CauseOfDeath() {
|
|
40
|
+
return GetPedCauseOfDeath(this.handle);
|
|
41
|
+
}
|
|
42
|
+
get DesiredHeading() {
|
|
43
|
+
return GetPedDesiredHeading(this.handle);
|
|
44
|
+
}
|
|
45
|
+
get MaxHealth() {
|
|
46
|
+
return GetPedMaxHealth(this.handle);
|
|
47
|
+
}
|
|
48
|
+
get TaskCommand() {
|
|
49
|
+
return GetPedScriptTaskCommand(this.handle);
|
|
50
|
+
}
|
|
51
|
+
get TaskStage() {
|
|
52
|
+
return GetPedScriptTaskStage(this.handle);
|
|
53
|
+
}
|
|
54
|
+
get LastSourceOfDamage() {
|
|
55
|
+
return GetPedSourceOfDamage(this.handle);
|
|
56
|
+
}
|
|
57
|
+
get DeathCause() {
|
|
58
|
+
return GetPedCauseOfDeath(this.handle);
|
|
59
|
+
}
|
|
60
|
+
get Weapon() {
|
|
61
|
+
return GetSelectedPedWeapon(this.handle);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* @returns the current vehicle the ped is in, or null if it doesn't exist
|
|
65
|
+
*/
|
|
66
|
+
get CurrentVehicle() {
|
|
67
|
+
const vehicle = GetVehiclePedIsIn(this.handle, false);
|
|
68
|
+
if (vehicle === 0) return null;
|
|
69
|
+
return new Vehicle(vehicle);
|
|
70
|
+
}
|
|
71
|
+
get LastVehicle() {
|
|
72
|
+
const vehicle = GetVehiclePedIsIn(this.handle, false);
|
|
73
|
+
if (vehicle === 0) return null;
|
|
74
|
+
return new Vehicle(GetVehiclePedIsIn(this.handle, true));
|
|
75
|
+
}
|
|
76
|
+
get IsPlayer() {
|
|
77
|
+
return IsPedAPlayer(this.handle);
|
|
78
|
+
}
|
|
79
|
+
getSpecificTaskType(index) {
|
|
80
|
+
return GetPedSpecificTaskType(this.handle, index);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
export {
|
|
84
|
+
Ped
|
|
85
|
+
};
|
package/entities/Player.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ClassTypes } from "../../common/utils/ClassTypes";
|
|
2
|
-
import { Vector3 } from "../utils";
|
|
3
2
|
import { Ped } from "./Ped";
|
|
3
|
+
import { Vector3 } from "../common/utils/Vector";
|
|
4
4
|
export declare class Player {
|
|
5
5
|
private readonly source;
|
|
6
6
|
protected type: ClassTypes;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import cfx from "../cfx";
|
|
4
|
+
import { ClassTypes } from "../../common/utils/ClassTypes";
|
|
5
|
+
import { Ped } from "./Ped";
|
|
6
|
+
import { cleanPlayerName } from "../common/utils/cleanPlayerName";
|
|
7
|
+
import { Vector3 } from "../common/utils/Vector";
|
|
8
|
+
class Player {
|
|
9
|
+
constructor(source) {
|
|
10
|
+
this.source = source;
|
|
11
|
+
}
|
|
12
|
+
static {
|
|
13
|
+
__name(this, "Player");
|
|
14
|
+
}
|
|
15
|
+
type = ClassTypes.Player;
|
|
16
|
+
/**
|
|
17
|
+
* Get an interable list of players currently on the server
|
|
18
|
+
* @returns Iterable list of Players.
|
|
19
|
+
*/
|
|
20
|
+
static *AllPlayers() {
|
|
21
|
+
const num = GetNumPlayerIndices();
|
|
22
|
+
for (let i = 0; i < num; i++) {
|
|
23
|
+
yield new Player(Number.parseInt(GetPlayerFromIndex(i)));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
get Exists() {
|
|
27
|
+
return this.source !== 0;
|
|
28
|
+
}
|
|
29
|
+
get Source() {
|
|
30
|
+
return this.source;
|
|
31
|
+
}
|
|
32
|
+
get State() {
|
|
33
|
+
return cfx.Player(this.source).state;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Returns the player source casted as a string
|
|
37
|
+
*/
|
|
38
|
+
get Src() {
|
|
39
|
+
return this.source;
|
|
40
|
+
}
|
|
41
|
+
get Ped() {
|
|
42
|
+
return new Ped(GetPlayerPed(this.Src));
|
|
43
|
+
}
|
|
44
|
+
get Tokens() {
|
|
45
|
+
return getPlayerTokens(this.source);
|
|
46
|
+
}
|
|
47
|
+
get Identifiers() {
|
|
48
|
+
return getPlayerIdentifiers(this.source);
|
|
49
|
+
}
|
|
50
|
+
get Endpoint() {
|
|
51
|
+
return GetPlayerEndpoint(this.Src);
|
|
52
|
+
}
|
|
53
|
+
get CamerRotation() {
|
|
54
|
+
return Vector3.fromArray(GetPlayerCameraRotation(this.Src));
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Returns the time since the last player UDP message
|
|
58
|
+
*/
|
|
59
|
+
get LastMessage() {
|
|
60
|
+
return GetPlayerLastMsg(this.Src);
|
|
61
|
+
}
|
|
62
|
+
get MaxArmour() {
|
|
63
|
+
return GetPlayerMaxArmour(this.Src);
|
|
64
|
+
}
|
|
65
|
+
get MaxHealth() {
|
|
66
|
+
return GetPlayerMaxHealth(this.Src);
|
|
67
|
+
}
|
|
68
|
+
get MeleeModifier() {
|
|
69
|
+
return GetPlayerMeleeWeaponDamageModifier(this.Src);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* @returns the players name
|
|
73
|
+
*/
|
|
74
|
+
get Name() {
|
|
75
|
+
return GetPlayerName(this.Src);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* @returns the players name with any color code unicode, etc removed, this can lead to there being no name at all
|
|
79
|
+
*/
|
|
80
|
+
filteredName() {
|
|
81
|
+
return cleanPlayerName(this.Name);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* @returns the players round trip ping
|
|
85
|
+
*/
|
|
86
|
+
get Ping() {
|
|
87
|
+
return GetPlayerPing(this.Src);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* @returns the current routhing bucket the player is in, default is 0
|
|
91
|
+
*/
|
|
92
|
+
get RoutingBucket() {
|
|
93
|
+
return GetPlayerRoutingBucket(this.Src);
|
|
94
|
+
}
|
|
95
|
+
get Team() {
|
|
96
|
+
return GetPlayerTeam(this.Src);
|
|
97
|
+
}
|
|
98
|
+
get WantedPosition() {
|
|
99
|
+
return Vector3.fromArray(GetPlayerWantedCentrePosition(this.Src));
|
|
100
|
+
}
|
|
101
|
+
get WantedLevel() {
|
|
102
|
+
return GetPlayerWantedLevel(this.Src);
|
|
103
|
+
}
|
|
104
|
+
get IsEvadingWanted() {
|
|
105
|
+
return IsPlayerEvadingWantedLevel(this.Src);
|
|
106
|
+
}
|
|
107
|
+
get WeaponDamageModifier() {
|
|
108
|
+
return GetPlayerWeaponDamageModifier(this.Src);
|
|
109
|
+
}
|
|
110
|
+
get WeaponDefenseModifier() {
|
|
111
|
+
return GetPlayerWeaponDefenseModifier(this.Src);
|
|
112
|
+
}
|
|
113
|
+
get WeaponDefenseModifier2() {
|
|
114
|
+
return GetPlayerWeaponDefenseModifier_2(this.Src);
|
|
115
|
+
}
|
|
116
|
+
get AirDragMultiplier() {
|
|
117
|
+
return GetAirDragMultiplierForPlayersVehicle(this.Src);
|
|
118
|
+
}
|
|
119
|
+
get IsUsingSuperJump() {
|
|
120
|
+
return IsPlayerUsingSuperJump(this.Src);
|
|
121
|
+
}
|
|
122
|
+
get IsMuted() {
|
|
123
|
+
return MumbleIsPlayerMuted(this.source);
|
|
124
|
+
}
|
|
125
|
+
set IsMuted(isMuted) {
|
|
126
|
+
MumbleSetPlayerMuted(this.source, isMuted);
|
|
127
|
+
}
|
|
128
|
+
isAceAllowed(object) {
|
|
129
|
+
return IsPlayerAceAllowed(this.Src, object);
|
|
130
|
+
}
|
|
131
|
+
timeInPersuit(lastPursuit = false) {
|
|
132
|
+
return GetPlayerTimeInPursuit(this.Src, lastPursuit);
|
|
133
|
+
}
|
|
134
|
+
drop(reason = "No reason specified") {
|
|
135
|
+
DropPlayer(this.Src, reason);
|
|
136
|
+
}
|
|
137
|
+
emit(eventName, ...args) {
|
|
138
|
+
TriggerClientEvent(eventName, this.source, ...args);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
export {
|
|
142
|
+
Player
|
|
143
|
+
};
|
package/entities/Prop.d.ts
CHANGED
package/entities/Prop.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
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 { BaseEntity } from "./BaseEntity";
|
|
5
|
+
class Prop extends BaseEntity {
|
|
6
|
+
static {
|
|
7
|
+
__name(this, "Prop");
|
|
8
|
+
}
|
|
9
|
+
type = ClassTypes.Prop;
|
|
10
|
+
constructor(handle) {
|
|
11
|
+
super(handle);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Get an interable list of props currently on the server
|
|
15
|
+
* @returns Iterable list of Props.
|
|
16
|
+
*/
|
|
17
|
+
static *AllProps() {
|
|
18
|
+
for (const prop of GetAllObjects()) {
|
|
19
|
+
yield new Prop(prop);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
static fromNetworkId(networkId) {
|
|
23
|
+
const ent = NetworkGetEntityFromNetworkId(networkId);
|
|
24
|
+
if (ent === 0) return null;
|
|
25
|
+
return new Prop(ent);
|
|
26
|
+
}
|
|
27
|
+
static fromStateBagName(stateBagName) {
|
|
28
|
+
const ent = GetEntityFromStateBagName(stateBagName);
|
|
29
|
+
if (ent === 0) return null;
|
|
30
|
+
return new Prop(ent);
|
|
31
|
+
}
|
|
32
|
+
static fromHandle(handle) {
|
|
33
|
+
return new Prop(handle);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
Prop
|
|
38
|
+
};
|
package/entities/Vehicle.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Color } from "../common/utils/Color";
|
|
2
2
|
import type { VehicleLockStatus } from "../enum/VehicleLockStatus";
|
|
3
3
|
import type { VehicleType } from "../enum/VehicleType";
|
|
4
4
|
import type { Hash } from "../type/Hash";
|
|
5
|
-
import { Color } from "../utils";
|
|
6
5
|
import { BaseEntity } from "./BaseEntity";
|
|
6
|
+
import { ClassTypes } from "../common/utils/ClassTypes";
|
|
7
7
|
export declare class Vehicle extends BaseEntity {
|
|
8
8
|
protected type: ClassTypes;
|
|
9
9
|
constructor(handle: number);
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { Color } from "../common/utils/Color";
|
|
4
|
+
import { BaseEntity } from "./BaseEntity";
|
|
5
|
+
import { ClassTypes } from "../common/utils/ClassTypes";
|
|
6
|
+
class Vehicle extends BaseEntity {
|
|
7
|
+
static {
|
|
8
|
+
__name(this, "Vehicle");
|
|
9
|
+
}
|
|
10
|
+
type = ClassTypes.Vehicle;
|
|
11
|
+
constructor(handle) {
|
|
12
|
+
super(handle);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get an interable list of vehicles currently on the server
|
|
16
|
+
* @returns Iterable list of Vehicles.
|
|
17
|
+
*/
|
|
18
|
+
static *AllVehicles() {
|
|
19
|
+
for (const veh of GetAllVehicles()) {
|
|
20
|
+
yield new Vehicle(veh);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
static fromNetworkId(networkId) {
|
|
24
|
+
const ent = NetworkGetEntityFromNetworkId(networkId);
|
|
25
|
+
if (ent === 0) return null;
|
|
26
|
+
return new Vehicle(ent);
|
|
27
|
+
}
|
|
28
|
+
static fromStateBagName(stateBageName) {
|
|
29
|
+
const ent = GetEntityFromStateBagName(stateBageName);
|
|
30
|
+
if (ent === 0) return null;
|
|
31
|
+
return new Vehicle(ent);
|
|
32
|
+
}
|
|
33
|
+
get IsEngineRunning() {
|
|
34
|
+
return GetIsVehicleEngineRunning(this.handle);
|
|
35
|
+
}
|
|
36
|
+
get IsPrimaryColourCustom() {
|
|
37
|
+
return GetIsVehiclePrimaryColourCustom(this.handle);
|
|
38
|
+
}
|
|
39
|
+
get IsSecondaryColourCustom() {
|
|
40
|
+
return GetIsVehicleSecondaryColourCustom(this.handle);
|
|
41
|
+
}
|
|
42
|
+
get BodyHealth() {
|
|
43
|
+
return GetVehicleBodyHealth(this.handle);
|
|
44
|
+
}
|
|
45
|
+
get VehicleColours() {
|
|
46
|
+
return GetVehicleColours(this.handle);
|
|
47
|
+
}
|
|
48
|
+
get CustomPrimaryColour() {
|
|
49
|
+
return Color.fromArray(GetVehicleCustomPrimaryColour(this.handle));
|
|
50
|
+
}
|
|
51
|
+
get CustomSecondaryColour() {
|
|
52
|
+
return Color.fromArray(GetVehicleCustomSecondaryColour(this.handle));
|
|
53
|
+
}
|
|
54
|
+
get DashboardColour() {
|
|
55
|
+
return GetVehicleDashboardColour(this.handle);
|
|
56
|
+
}
|
|
57
|
+
get DirtLevel() {
|
|
58
|
+
return GetVehicleDirtLevel(this.handle);
|
|
59
|
+
}
|
|
60
|
+
get LockStatus() {
|
|
61
|
+
return GetVehicleDoorLockStatus(this.handle);
|
|
62
|
+
}
|
|
63
|
+
getDoorStatus(doorIndex) {
|
|
64
|
+
return GetVehicleDoorStatus(this.handle, doorIndex);
|
|
65
|
+
}
|
|
66
|
+
get DoorsLockedForPlayer() {
|
|
67
|
+
return GetVehicleDoorsLockedForPlayer(this.handle);
|
|
68
|
+
}
|
|
69
|
+
get EngineHealth() {
|
|
70
|
+
return GetVehicleEngineHealth(this.handle);
|
|
71
|
+
}
|
|
72
|
+
get ExtraColours() {
|
|
73
|
+
return GetVehicleExtraColours(this.handle);
|
|
74
|
+
}
|
|
75
|
+
get FlightNozzlePosition() {
|
|
76
|
+
return GetVehicleFlightNozzlePosition(this.handle);
|
|
77
|
+
}
|
|
78
|
+
get Handbrake() {
|
|
79
|
+
return GetVehicleHandbrake(this.handle);
|
|
80
|
+
}
|
|
81
|
+
get HeadlightsColour() {
|
|
82
|
+
return GetVehicleHeadlightsColour(this.handle);
|
|
83
|
+
}
|
|
84
|
+
get HomingLockonState() {
|
|
85
|
+
return GetVehicleHomingLockonState(this.handle);
|
|
86
|
+
}
|
|
87
|
+
get InteriorColour() {
|
|
88
|
+
return GetVehicleInteriorColour(this.handle);
|
|
89
|
+
}
|
|
90
|
+
get LightsState() {
|
|
91
|
+
const [_, lightsOn, highbeansOn] = GetVehicleLightsState(this.handle);
|
|
92
|
+
return [lightsOn, highbeansOn];
|
|
93
|
+
}
|
|
94
|
+
get Livery() {
|
|
95
|
+
return GetVehicleLivery(this.handle);
|
|
96
|
+
}
|
|
97
|
+
get LockOnTarget() {
|
|
98
|
+
return new Vehicle(GetVehicleLockOnTarget(this.handle));
|
|
99
|
+
}
|
|
100
|
+
get Plate() {
|
|
101
|
+
return GetVehicleNumberPlateText(this.handle);
|
|
102
|
+
}
|
|
103
|
+
get PlateTrimmed() {
|
|
104
|
+
return this.Plate.trim();
|
|
105
|
+
}
|
|
106
|
+
get PlateIndex() {
|
|
107
|
+
return GetVehicleNumberPlateTextIndex(this.handle);
|
|
108
|
+
}
|
|
109
|
+
get PetrolTankHealth() {
|
|
110
|
+
return GetVehiclePetrolTankHealth(this.handle);
|
|
111
|
+
}
|
|
112
|
+
get RadioStation() {
|
|
113
|
+
return GetVehicleRadioStationIndex(this.handle);
|
|
114
|
+
}
|
|
115
|
+
get RoofLivery() {
|
|
116
|
+
return GetVehicleRoofLivery(this.handle);
|
|
117
|
+
}
|
|
118
|
+
get SteeringAngle() {
|
|
119
|
+
return GetVehicleSteeringAngle(this.handle);
|
|
120
|
+
}
|
|
121
|
+
get VehicleType() {
|
|
122
|
+
return GetVehicleType(this.handle);
|
|
123
|
+
}
|
|
124
|
+
get TyreSmokeColour() {
|
|
125
|
+
return Color.fromArray(GetVehicleTyreSmokeColor(this.handle));
|
|
126
|
+
}
|
|
127
|
+
get WheelType() {
|
|
128
|
+
return GetVehicleWheelType(this.handle);
|
|
129
|
+
}
|
|
130
|
+
get WindowTint() {
|
|
131
|
+
return GetVehicleWindowTint(this.handle);
|
|
132
|
+
}
|
|
133
|
+
get HasBeenOwnedByPlayer() {
|
|
134
|
+
return HasVehicleBeenOwnedByPlayer(this.handle);
|
|
135
|
+
}
|
|
136
|
+
get IsEngineStarting() {
|
|
137
|
+
return IsVehicleEngineStarting(this.handle);
|
|
138
|
+
}
|
|
139
|
+
get IsSirenOn() {
|
|
140
|
+
return IsVehicleSirenOn(this.handle);
|
|
141
|
+
}
|
|
142
|
+
get MaxHealth() {
|
|
143
|
+
return GetEntityMaxHealth(this.handle);
|
|
144
|
+
}
|
|
145
|
+
get ScriptTaskCommand() {
|
|
146
|
+
return GetPedScriptTaskCommand(this.handle);
|
|
147
|
+
}
|
|
148
|
+
get ScriptTaskStage() {
|
|
149
|
+
return GetPedScriptTaskStage(this.handle);
|
|
150
|
+
}
|
|
151
|
+
get MainRotorHealth() {
|
|
152
|
+
return GetHeliMainRotorHealth(this.handle);
|
|
153
|
+
}
|
|
154
|
+
get TailRotorHealth() {
|
|
155
|
+
return GetHeliTailRotorHealth(this.handle);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* This might supposed to be TrainEngineHealth?
|
|
159
|
+
*/
|
|
160
|
+
get TrainCarriageEngine() {
|
|
161
|
+
return GetTrainCarriageEngine(this.handle);
|
|
162
|
+
}
|
|
163
|
+
get TrainCarriageIndex() {
|
|
164
|
+
return GetTrainCarriageIndex(this.handle);
|
|
165
|
+
}
|
|
166
|
+
isTyreBurst(wheelId, completely) {
|
|
167
|
+
return IsVehicleTyreBurst(this.handle, wheelId, completely);
|
|
168
|
+
}
|
|
169
|
+
isExtraTurnedOn(extraId) {
|
|
170
|
+
return IsVehicleExtraTurnedOn(this.handle, extraId);
|
|
171
|
+
}
|
|
172
|
+
getPedInSeat(seatIndex) {
|
|
173
|
+
return GetPedInVehicleSeat(this.handle, seatIndex);
|
|
174
|
+
}
|
|
175
|
+
getLastPedInSeat(seatIndex) {
|
|
176
|
+
return GetLastPedInVehicleSeat(this.handle, seatIndex);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
export {
|
|
180
|
+
Vehicle
|
|
181
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var OrphanMode = /* @__PURE__ */ ((OrphanMode2) => {
|
|
2
|
+
OrphanMode2[OrphanMode2["DeleteWhenNotRelevant"] = 0] = "DeleteWhenNotRelevant";
|
|
3
|
+
OrphanMode2[OrphanMode2["DeleteOnOwnerDisconnect"] = 1] = "DeleteOnOwnerDisconnect";
|
|
4
|
+
OrphanMode2[OrphanMode2["KeepEntity"] = 2] = "KeepEntity";
|
|
5
|
+
return OrphanMode2;
|
|
6
|
+
})(OrphanMode || {});
|
|
7
|
+
export {
|
|
8
|
+
OrphanMode
|
|
9
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var PopulationType = /* @__PURE__ */ ((PopulationType2) => {
|
|
2
|
+
PopulationType2[PopulationType2["Unknown"] = 0] = "Unknown";
|
|
3
|
+
PopulationType2[PopulationType2["RandomPermanent"] = 1] = "RandomPermanent";
|
|
4
|
+
PopulationType2[PopulationType2["RandomParked"] = 2] = "RandomParked";
|
|
5
|
+
PopulationType2[PopulationType2["Randompatrol"] = 3] = "Randompatrol";
|
|
6
|
+
PopulationType2[PopulationType2["RandomScenario"] = 4] = "RandomScenario";
|
|
7
|
+
PopulationType2[PopulationType2["RandomAmbient"] = 5] = "RandomAmbient";
|
|
8
|
+
PopulationType2[PopulationType2["Permanent"] = 6] = "Permanent";
|
|
9
|
+
PopulationType2[PopulationType2["Mission"] = 7] = "Mission";
|
|
10
|
+
PopulationType2[PopulationType2["Replay"] = 8] = "Replay";
|
|
11
|
+
PopulationType2[PopulationType2["Cache"] = 9] = "Cache";
|
|
12
|
+
PopulationType2[PopulationType2["Tool"] = 10] = "Tool";
|
|
13
|
+
return PopulationType2;
|
|
14
|
+
})(PopulationType || {});
|
|
15
|
+
export {
|
|
16
|
+
PopulationType
|
|
17
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
var VehicleLockStatus = /* @__PURE__ */ ((VehicleLockStatus2) => {
|
|
2
|
+
VehicleLockStatus2[VehicleLockStatus2["None"] = 0] = "None";
|
|
3
|
+
VehicleLockStatus2[VehicleLockStatus2["Locked"] = 2] = "Locked";
|
|
4
|
+
VehicleLockStatus2[VehicleLockStatus2["LockedForPlayer"] = 3] = "LockedForPlayer";
|
|
5
|
+
VehicleLockStatus2[VehicleLockStatus2["StickPlayerInside"] = 4] = "StickPlayerInside";
|
|
6
|
+
VehicleLockStatus2[VehicleLockStatus2["CanBeBrokenInto"] = 7] = "CanBeBrokenInto";
|
|
7
|
+
VehicleLockStatus2[VehicleLockStatus2["CanBeBrokenIntoPersist"] = 8] = "CanBeBrokenIntoPersist";
|
|
8
|
+
VehicleLockStatus2[VehicleLockStatus2["CannotBeTriedToEnter"] = 10] = "CannotBeTriedToEnter";
|
|
9
|
+
return VehicleLockStatus2;
|
|
10
|
+
})(VehicleLockStatus || {});
|
|
11
|
+
export {
|
|
12
|
+
VehicleLockStatus
|
|
13
|
+
};
|