@nativewrappers/redm 0.0.90 → 0.0.92
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/Events.js +4 -2
- package/entities/BaseEntity.d.ts +2 -2
- package/entities/BaseEntity.js +8 -8
- package/entities/Ped.d.ts +27 -0
- package/entities/Ped.js +128 -77
- package/entities/Vehicle.d.ts +11 -0
- package/entities/Vehicle.js +27 -0
- package/package.json +1 -1
package/common/decors/Events.js
CHANGED
|
@@ -123,11 +123,13 @@ function ConVar(name, is_floating_point, deserialize) {
|
|
|
123
123
|
}
|
|
124
124
|
} else if (default_type === "boolean") {
|
|
125
125
|
con_var_type = 3 /* Boolean */;
|
|
126
|
-
} else if (
|
|
126
|
+
} else if (default_type === "string") {
|
|
127
127
|
con_var_type = 0 /* String */;
|
|
128
128
|
}
|
|
129
129
|
if (!deserialize && con_var_type === null) {
|
|
130
|
-
throw new Error(
|
|
130
|
+
throw new Error(
|
|
131
|
+
`Failed to determine what to use to deserialize '${name}' was for var had type '${default_type}' which can't be deserialized without providing your own deserialize function.`
|
|
132
|
+
);
|
|
131
133
|
}
|
|
132
134
|
if (con_var_type === null) {
|
|
133
135
|
con_var_type = 0 /* String */;
|
package/entities/BaseEntity.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Vector3 } from "../common/utils/Vector";
|
|
2
2
|
export declare class BaseEntity {
|
|
3
|
-
|
|
3
|
+
protected handle: number;
|
|
4
4
|
constructor(entHandle: number);
|
|
5
5
|
/**
|
|
6
6
|
* Replaces the current handle for the entity used on, this hsould be used sparringly, mainly
|
|
@@ -24,7 +24,7 @@ export declare class BaseEntity {
|
|
|
24
24
|
*/
|
|
25
25
|
replaceHandle(newHandle: number): void;
|
|
26
26
|
/**
|
|
27
|
-
* @returns the network for the specified entity, this doesn't check if the entity is networked, you should use {@link
|
|
27
|
+
* @returns the network for the specified entity, this doesn't check if the entity is networked, you should use {@link IsNetworked}
|
|
28
28
|
*/
|
|
29
29
|
get NetworkId(): number;
|
|
30
30
|
/**
|
package/entities/BaseEntity.js
CHANGED
|
@@ -33,22 +33,22 @@ class BaseEntity {
|
|
|
33
33
|
this.handle = newHandle;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
* @returns the network for the specified entity, this doesn't check if the entity is networked, you should use {@link
|
|
36
|
+
* @returns the network for the specified entity, this doesn't check if the entity is networked, you should use {@link IsNetworked}
|
|
37
37
|
*/
|
|
38
38
|
get NetworkId() {
|
|
39
|
-
return NetworkGetNetworkIdFromEntity(this.
|
|
39
|
+
return NetworkGetNetworkIdFromEntity(this.handle);
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* @returns `true` if the current entity is networked, false otherwise
|
|
43
43
|
*/
|
|
44
44
|
get IsNetworked() {
|
|
45
|
-
return NetworkGetEntityIsNetworked(this.
|
|
45
|
+
return NetworkGetEntityIsNetworked(this.handle);
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
48
|
* @returns Returns true if the entity handle is not 0 and exists in the game engine
|
|
49
49
|
*/
|
|
50
50
|
get Exists() {
|
|
51
|
-
return this.handle !== 0 && DoesEntityExist(this.
|
|
51
|
+
return this.handle !== 0 && DoesEntityExist(this.handle);
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
54
|
* @returns Returns true if the entity is dead
|
|
@@ -66,25 +66,25 @@ class BaseEntity {
|
|
|
66
66
|
* @param amount the health to set the health to, setting to `0` will kill the entity, if using on a {@link Ped} you should check the MaxHealth before setting.
|
|
67
67
|
*/
|
|
68
68
|
set Health(amount) {
|
|
69
|
-
SetEntityHealth(this.
|
|
69
|
+
SetEntityHealth(this.handle, amount, 0);
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
72
|
* @returns the amount of health the current {@link BaseEntity} has
|
|
73
73
|
*/
|
|
74
74
|
get Health() {
|
|
75
|
-
return GetEntityHealth(this.
|
|
75
|
+
return GetEntityHealth(this.handle);
|
|
76
76
|
}
|
|
77
77
|
/**
|
|
78
78
|
* @returns the heading of the current {@link BaseEntity}
|
|
79
79
|
*/
|
|
80
80
|
get Heading() {
|
|
81
|
-
return GetEntityHeading(this.
|
|
81
|
+
return GetEntityHeading(this.handle);
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
84
84
|
* @param heading sets the entitys heading to the specified heading, this can be in the range of 0..360
|
|
85
85
|
*/
|
|
86
86
|
set Heading(heading) {
|
|
87
|
-
SetEntityHeading(this.
|
|
87
|
+
SetEntityHeading(this.handle, heading);
|
|
88
88
|
}
|
|
89
89
|
/**
|
|
90
90
|
* @returns the position of the current Entity
|
package/entities/Ped.d.ts
CHANGED
|
@@ -9,6 +9,17 @@ import { Vehicle } from "./Vehicle";
|
|
|
9
9
|
export declare class Ped extends BaseEntity {
|
|
10
10
|
private attributes;
|
|
11
11
|
private tasks;
|
|
12
|
+
/**
|
|
13
|
+
* Gets the entity from the handle given, if the entity doesn't exist it will return
|
|
14
|
+
* null.
|
|
15
|
+
*/
|
|
16
|
+
static fromHandle(handle: number): Ped | null;
|
|
17
|
+
/**
|
|
18
|
+
* Gets the ped from the current network id, this doesn't check that
|
|
19
|
+
* the entity is actually a ped
|
|
20
|
+
*/
|
|
21
|
+
static fromNetworkId(netId: number): Ped | null;
|
|
22
|
+
static fromStateBagName(bagName: string): Ped | null;
|
|
12
23
|
constructor(handle: number);
|
|
13
24
|
/**
|
|
14
25
|
* Blocks scenarios inbetween the specified vectors
|
|
@@ -159,4 +170,20 @@ export declare class Ped extends BaseEntity {
|
|
|
159
170
|
*/
|
|
160
171
|
applyDamagePack(damagePack: string, damage: number, mult: number): void;
|
|
161
172
|
get CurrentVehicle(): Vehicle | null;
|
|
173
|
+
giveHashCommand(commandHash: number, activationDuration: number): void;
|
|
174
|
+
/**
|
|
175
|
+
* Adds or removes the ped stamina, depending on of the amount is positive or negative.
|
|
176
|
+
* @param amount the amount of stamina to add/remove
|
|
177
|
+
*/
|
|
178
|
+
changeStamina(amount: number): void;
|
|
179
|
+
get MaxStamina(): number;
|
|
180
|
+
/**
|
|
181
|
+
* Returns the amount of stamina the ped has
|
|
182
|
+
*/
|
|
183
|
+
get Stamina(): number;
|
|
184
|
+
/**
|
|
185
|
+
* returns the normalized stamina for the player, taking into account their unlocked stamina
|
|
186
|
+
*/
|
|
187
|
+
get StaminaNormalized(): number;
|
|
188
|
+
resetStamina(): void;
|
|
162
189
|
}
|
package/entities/Ped.js
CHANGED
|
@@ -11,6 +11,33 @@ class Ped extends BaseEntity {
|
|
|
11
11
|
}
|
|
12
12
|
attributes;
|
|
13
13
|
tasks;
|
|
14
|
+
/**
|
|
15
|
+
* Gets the entity from the handle given, if the entity doesn't exist it will return
|
|
16
|
+
* null.
|
|
17
|
+
*/
|
|
18
|
+
static fromHandle(handle) {
|
|
19
|
+
if (handle === 0 || !DoesEntityExist(handle)) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
return new Ped(handle);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Gets the ped from the current network id, this doesn't check that
|
|
26
|
+
* the entity is actually a ped
|
|
27
|
+
*/
|
|
28
|
+
static fromNetworkId(netId) {
|
|
29
|
+
if (netId === 0 || !NetworkDoesEntityExistWithNetworkId(netId)) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
return new Ped(NetToPed(netId));
|
|
33
|
+
}
|
|
34
|
+
static fromStateBagName(bagName) {
|
|
35
|
+
const ent = GetEntityFromStateBagName(bagName);
|
|
36
|
+
if (ent === 0) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
return new Ped(ent);
|
|
40
|
+
}
|
|
14
41
|
constructor(handle) {
|
|
15
42
|
super(handle);
|
|
16
43
|
}
|
|
@@ -52,13 +79,13 @@ class Ped extends BaseEntity {
|
|
|
52
79
|
* While this increases the peds max health, if used on a player it wont increase the max core value on the hud
|
|
53
80
|
*/
|
|
54
81
|
set MaxHealth(amount) {
|
|
55
|
-
SetPedMaxHealth(this.
|
|
82
|
+
SetPedMaxHealth(this.handle, amount);
|
|
56
83
|
}
|
|
57
84
|
/**
|
|
58
85
|
* @returns the maximum health of the ped
|
|
59
86
|
*/
|
|
60
87
|
get MaxHealth() {
|
|
61
|
-
return GetPedMaxHealth(this.
|
|
88
|
+
return GetPedMaxHealth(this.handle);
|
|
62
89
|
}
|
|
63
90
|
/**
|
|
64
91
|
* @returns the {@link Attributes} for the current ped
|
|
@@ -68,158 +95,154 @@ class Ped extends BaseEntity {
|
|
|
68
95
|
return this.attributes = new Attributes(this);
|
|
69
96
|
}
|
|
70
97
|
get InVehicle() {
|
|
71
|
-
return IsPedInAnyVehicle(this.
|
|
98
|
+
return IsPedInAnyVehicle(this.handle, true);
|
|
72
99
|
}
|
|
73
100
|
get IsInjured() {
|
|
74
|
-
return IsPedInjured(this.
|
|
101
|
+
return IsPedInjured(this.handle);
|
|
75
102
|
}
|
|
76
103
|
get IsFatallyInjured() {
|
|
77
|
-
return IsPedFatallyInjured(this.
|
|
104
|
+
return IsPedFatallyInjured(this.handle);
|
|
78
105
|
}
|
|
79
106
|
get IsPlayer() {
|
|
80
|
-
return IsPedAPlayer(this.
|
|
107
|
+
return IsPedAPlayer(this.handle);
|
|
81
108
|
}
|
|
82
109
|
get IsShooting() {
|
|
83
|
-
return IsPedShooting(this.
|
|
110
|
+
return IsPedShooting(this.handle);
|
|
84
111
|
}
|
|
85
112
|
get Accuracy() {
|
|
86
|
-
return GetPedAccuracy(this.
|
|
113
|
+
return GetPedAccuracy(this.handle);
|
|
87
114
|
}
|
|
88
115
|
set Accuracy(accuracy) {
|
|
89
|
-
SetPedAccuracy(this.
|
|
116
|
+
SetPedAccuracy(this.handle, accuracy);
|
|
90
117
|
}
|
|
91
118
|
get CanBeKnockedOffVehicle() {
|
|
92
|
-
return CanKnockPedOffVehicle(this.
|
|
119
|
+
return CanKnockPedOffVehicle(this.handle);
|
|
93
120
|
}
|
|
94
121
|
get IsMale() {
|
|
95
|
-
return IsPedMale(this.
|
|
122
|
+
return IsPedMale(this.handle);
|
|
96
123
|
}
|
|
97
124
|
get IsHuman() {
|
|
98
|
-
return IsPedHuman(this.
|
|
125
|
+
return IsPedHuman(this.handle);
|
|
99
126
|
}
|
|
100
127
|
get IsOnTopOfVehicle() {
|
|
101
|
-
return IsPedOnVehicle(this.
|
|
128
|
+
return IsPedOnVehicle(this.handle, false);
|
|
102
129
|
}
|
|
103
130
|
get Vehicle() {
|
|
104
|
-
|
|
105
|
-
if (vehicle === 0) {
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
108
|
-
return new Vehicle(vehicle);
|
|
131
|
+
return Vehicle.fromHandle(GetVehiclePedIsIn(this.handle, false));
|
|
109
132
|
}
|
|
110
133
|
/**
|
|
111
134
|
* @returns the last mount that this ped was on, or null if it doesn't exist
|
|
112
135
|
*/
|
|
113
136
|
get Mount() {
|
|
114
|
-
const pedId = _N("0x4C8B59171957BCF7", this.
|
|
115
|
-
return
|
|
137
|
+
const pedId = _N("0x4C8B59171957BCF7", this.handle, Citizen.resultAsInteger());
|
|
138
|
+
return Ped.fromHandle(pedId);
|
|
116
139
|
}
|
|
117
140
|
/**
|
|
118
141
|
* returns the horse that this ped is leading
|
|
119
142
|
*/
|
|
120
143
|
get LeadingHorse() {
|
|
121
|
-
const pedId = _N("0x693126B5D0457D0D", this.
|
|
122
|
-
return
|
|
144
|
+
const pedId = _N("0x693126B5D0457D0D", this.handle, Citizen.resultAsInteger());
|
|
145
|
+
return Ped.fromHandle(pedId);
|
|
123
146
|
}
|
|
124
147
|
/**
|
|
125
148
|
* returns the owner of the current animal
|
|
126
149
|
*/
|
|
127
150
|
get Owner() {
|
|
128
|
-
const pedId = _N("0xF103823FFE72BB49", this.
|
|
129
|
-
return
|
|
151
|
+
const pedId = _N("0xF103823FFE72BB49", this.handle, Citizen.resultAsInteger());
|
|
152
|
+
return Ped.fromHandle(pedId);
|
|
130
153
|
}
|
|
131
154
|
get TamingState() {
|
|
132
|
-
return _N("0x454AD4DA6C41B5BD", this.
|
|
155
|
+
return _N("0x454AD4DA6C41B5BD", this.handle, Citizen.resultAsInteger());
|
|
133
156
|
}
|
|
134
157
|
get IsInteractingWithAnimal() {
|
|
135
|
-
return _N("0x7FC84E85D98F063D", this.
|
|
158
|
+
return _N("0x7FC84E85D98F063D", this.handle, Citizen.resultAsInteger());
|
|
136
159
|
}
|
|
137
160
|
get IsSittingInAnyVehicle() {
|
|
138
|
-
return IsPedSittingInAnyVehicle(this.
|
|
161
|
+
return IsPedSittingInAnyVehicle(this.handle);
|
|
139
162
|
}
|
|
140
163
|
get IsPlantingBomb() {
|
|
141
|
-
return IsPedPlantingBomb(this.
|
|
164
|
+
return IsPedPlantingBomb(this.handle);
|
|
142
165
|
}
|
|
143
166
|
get IsInAnyBoat() {
|
|
144
|
-
return IsPedInAnyBoat(this.
|
|
167
|
+
return IsPedInAnyBoat(this.handle);
|
|
145
168
|
}
|
|
146
169
|
get IsInAnyHeli() {
|
|
147
|
-
return IsPedInAnyHeli(this.
|
|
170
|
+
return IsPedInAnyHeli(this.handle);
|
|
148
171
|
}
|
|
149
172
|
get IsInAnyPlane() {
|
|
150
|
-
return IsPedInAnyPlane(this.
|
|
173
|
+
return IsPedInAnyPlane(this.handle);
|
|
151
174
|
}
|
|
152
175
|
get IsInFlyingVehicle() {
|
|
153
|
-
return IsPedInFlyingVehicle(this.
|
|
176
|
+
return IsPedInFlyingVehicle(this.handle);
|
|
154
177
|
}
|
|
155
178
|
get IsFalling() {
|
|
156
|
-
return IsPedFalling(this.
|
|
179
|
+
return IsPedFalling(this.handle);
|
|
157
180
|
}
|
|
158
181
|
get IsSliding() {
|
|
159
|
-
return _N("0xD6740E14E4CEFC0B", this.
|
|
182
|
+
return _N("0xD6740E14E4CEFC0B", this.handle, Citizen.resultAsInteger());
|
|
160
183
|
}
|
|
161
184
|
get IsJumping() {
|
|
162
|
-
return IsPedJumping(this.
|
|
185
|
+
return IsPedJumping(this.handle);
|
|
163
186
|
}
|
|
164
187
|
get IsClimbing() {
|
|
165
|
-
return IsPedClimbing(this.
|
|
188
|
+
return IsPedClimbing(this.handle);
|
|
166
189
|
}
|
|
167
190
|
get IsClimbingLadder() {
|
|
168
|
-
return _N("0x59643424B68D52B5", this.
|
|
191
|
+
return _N("0x59643424B68D52B5", this.handle, Citizen.resultAsInteger());
|
|
169
192
|
}
|
|
170
193
|
get IsVaulting() {
|
|
171
|
-
return IsPedVaulting(this.
|
|
194
|
+
return IsPedVaulting(this.handle);
|
|
172
195
|
}
|
|
173
196
|
get IsDiving() {
|
|
174
|
-
return IsPedDiving(this.
|
|
197
|
+
return IsPedDiving(this.handle);
|
|
175
198
|
}
|
|
176
199
|
get IsOpeningADoor() {
|
|
177
|
-
return IsPedOpeningADoor(this.
|
|
200
|
+
return IsPedOpeningADoor(this.handle);
|
|
178
201
|
}
|
|
179
202
|
set SeeingRange(value) {
|
|
180
|
-
SetPedSeeingRange(this.
|
|
203
|
+
SetPedSeeingRange(this.handle, value);
|
|
181
204
|
}
|
|
182
205
|
set HearingRange(value) {
|
|
183
|
-
SetPedHearingRange(this.
|
|
206
|
+
SetPedHearingRange(this.handle, value);
|
|
184
207
|
}
|
|
185
208
|
get IsStealthed() {
|
|
186
|
-
return GetPedStealthMovement(this.
|
|
209
|
+
return GetPedStealthMovement(this.handle);
|
|
187
210
|
}
|
|
188
211
|
get IsJacking() {
|
|
189
|
-
return IsPedJacking(this.
|
|
212
|
+
return IsPedJacking(this.handle);
|
|
190
213
|
}
|
|
191
214
|
get IsStunned() {
|
|
192
|
-
return IsPedBeingStunned(this.
|
|
215
|
+
return IsPedBeingStunned(this.handle, 0);
|
|
193
216
|
}
|
|
194
217
|
get IsBeingJacked() {
|
|
195
|
-
return IsPedBeingJacked(this.
|
|
218
|
+
return IsPedBeingJacked(this.handle);
|
|
196
219
|
}
|
|
197
220
|
get IsInCombatRoll() {
|
|
198
|
-
return _N("0xC48A9EB0D499B3E5", this.
|
|
221
|
+
return _N("0xC48A9EB0D499B3E5", this.handle, Citizen.resultAsInteger());
|
|
199
222
|
}
|
|
200
223
|
get CrouchMovement() {
|
|
201
|
-
return _N("0xD5FE956C70FF370B", this.
|
|
224
|
+
return _N("0xD5FE956C70FF370B", this.handle, Citizen.resultAsInteger());
|
|
202
225
|
}
|
|
203
226
|
/**
|
|
204
227
|
* returns true if {@link DamageCleanliness} was ever lower than {@link eDamageCleanliness.Good}
|
|
205
228
|
*/
|
|
206
229
|
get IsDamaged() {
|
|
207
|
-
return _N("0x6CFC373008A1EDAF", this.
|
|
230
|
+
return _N("0x6CFC373008A1EDAF", this.handle, Citizen.resultAsInteger());
|
|
208
231
|
}
|
|
209
232
|
set IsDamaged(damaged) {
|
|
210
|
-
_N("0xDACE03C65C6666DB", this.
|
|
233
|
+
_N("0xDACE03C65C6666DB", this.handle, damaged);
|
|
211
234
|
}
|
|
212
235
|
get DamageCleanliness() {
|
|
213
|
-
return _N("0x88EFFED5FE8B0B4A", this.
|
|
236
|
+
return _N("0x88EFFED5FE8B0B4A", this.handle, Citizen.resultAsInteger());
|
|
214
237
|
}
|
|
215
238
|
set DamageCleanliness(cleanliness) {
|
|
216
|
-
_N("0x7528720101A807A5", this.
|
|
239
|
+
_N("0x7528720101A807A5", this.handle, cleanliness);
|
|
217
240
|
}
|
|
218
241
|
set DefenseModifier(amount) {
|
|
219
|
-
_N("0x9B6808EC46BE849B", this.
|
|
242
|
+
_N("0x9B6808EC46BE849B", this.handle, amount);
|
|
220
243
|
}
|
|
221
244
|
set CanBeTargeted(toggle) {
|
|
222
|
-
SetPedCanBeTargetted(this.
|
|
245
|
+
SetPedCanBeTargetted(this.handle, toggle);
|
|
223
246
|
}
|
|
224
247
|
// TODO: Team class wrapper
|
|
225
248
|
// TODO: Bone wrapper `GET_PED_LAST_DAMAGE_BONE`
|
|
@@ -227,31 +250,31 @@ class Ped extends BaseEntity {
|
|
|
227
250
|
* returns the ped who jacked this ped
|
|
228
251
|
*/
|
|
229
252
|
getJacker() {
|
|
230
|
-
return new Ped(GetPedsJacker(this.
|
|
253
|
+
return new Ped(GetPedsJacker(this.handle));
|
|
231
254
|
}
|
|
232
255
|
setCrouchMovement(state, immediately = false) {
|
|
233
|
-
_N("0x7DE9692C6F64CFE8", this.
|
|
256
|
+
_N("0x7DE9692C6F64CFE8", this.handle, state, 0, immediately);
|
|
234
257
|
}
|
|
235
258
|
canBeTargetedByPlayer(player, toggle) {
|
|
236
|
-
SetPedCanBeTargettedByPlayer(this.
|
|
259
|
+
SetPedCanBeTargettedByPlayer(this.handle, player.Handle, toggle);
|
|
237
260
|
}
|
|
238
261
|
clearLastBoneDamage() {
|
|
239
|
-
ClearPedLastDamageBone(this.
|
|
262
|
+
ClearPedLastDamageBone(this.handle);
|
|
240
263
|
}
|
|
241
264
|
set OwnsAnimal(animal) {
|
|
242
|
-
_N("0x931B241409216C1F", this.
|
|
265
|
+
_N("0x931B241409216C1F", this.handle, animal.Handle, false);
|
|
243
266
|
}
|
|
244
267
|
isInteractionPossible(animal) {
|
|
245
|
-
return _N("0xD543D3A8FDE4F185", this.
|
|
268
|
+
return _N("0xD543D3A8FDE4F185", this.handle, animal.Handle, Citizen.resultAsInteger());
|
|
246
269
|
}
|
|
247
270
|
isOnVehicle(vehicle) {
|
|
248
|
-
return IsPedOnSpecificVehicle(this.
|
|
271
|
+
return IsPedOnSpecificVehicle(this.handle, vehicle.Handle);
|
|
249
272
|
}
|
|
250
273
|
isSittingInVehicle(vehicle) {
|
|
251
|
-
return IsPedSittingInVehicle(this.
|
|
274
|
+
return IsPedSittingInVehicle(this.handle, vehicle.Handle);
|
|
252
275
|
}
|
|
253
276
|
warpOutOfVehicle() {
|
|
254
|
-
_N("0xE0B61ED8BB37712F", this.
|
|
277
|
+
_N("0xE0B61ED8BB37712F", this.handle);
|
|
255
278
|
}
|
|
256
279
|
/**
|
|
257
280
|
* puts the ped onto the specified mount
|
|
@@ -259,10 +282,10 @@ class Ped extends BaseEntity {
|
|
|
259
282
|
* @param seatIndex the seat index to put the ped on
|
|
260
283
|
*/
|
|
261
284
|
setOntoMount(targetPed, seatIndex) {
|
|
262
|
-
_N("0x028F76B6E78246EB", this.
|
|
285
|
+
_N("0x028F76B6E78246EB", this.handle, targetPed.Handle, seatIndex, true);
|
|
263
286
|
}
|
|
264
287
|
removeFromMount() {
|
|
265
|
-
_N("0x5337B721C51883A9", this.
|
|
288
|
+
_N("0x5337B721C51883A9", this.handle, true, true);
|
|
266
289
|
}
|
|
267
290
|
/**
|
|
268
291
|
* Sets the ped into the specified vehicle
|
|
@@ -270,31 +293,31 @@ class Ped extends BaseEntity {
|
|
|
270
293
|
* @param seatIndex the seat index to put the ped into
|
|
271
294
|
*/
|
|
272
295
|
setIntoVehicle(vehicle, seatIndex) {
|
|
273
|
-
SetPedIntoVehicle(this.
|
|
296
|
+
SetPedIntoVehicle(this.handle, vehicle.Handle, seatIndex);
|
|
274
297
|
}
|
|
275
298
|
/**
|
|
276
299
|
* kills the ped and optionally sets the killer
|
|
277
300
|
* @param killer the entity that killed the ped
|
|
278
301
|
*/
|
|
279
302
|
killPed(killer) {
|
|
280
|
-
SetEntityHealth(this.
|
|
303
|
+
SetEntityHealth(this.handle, 0, killer ? killer.Handle : 0);
|
|
281
304
|
}
|
|
282
305
|
damage(amount, boneId = 0, killer) {
|
|
283
|
-
ApplyDamageToPed(this.
|
|
306
|
+
ApplyDamageToPed(this.handle, amount, 0, boneId, killer ? killer.Handle : 0);
|
|
284
307
|
}
|
|
285
308
|
/**
|
|
286
309
|
* this returns a different type then the getter so we can't use set, maybe ts will fix soon (tm)
|
|
287
310
|
* @param state how hard it will be to knock a ped off their vehicle
|
|
288
311
|
*/
|
|
289
312
|
setCanBeKnockedOffVehicle(state) {
|
|
290
|
-
SetPedCanBeKnockedOffVehicle(this.
|
|
313
|
+
SetPedCanBeKnockedOffVehicle(this.handle, state);
|
|
291
314
|
}
|
|
292
315
|
/**
|
|
293
316
|
* Removes the specified ped if its not a player entity
|
|
294
317
|
*/
|
|
295
318
|
delete() {
|
|
296
|
-
SetEntityAsMissionEntity(this.
|
|
297
|
-
DeletePed(this.
|
|
319
|
+
SetEntityAsMissionEntity(this.handle, true, true);
|
|
320
|
+
DeletePed(this.handle);
|
|
298
321
|
}
|
|
299
322
|
/**
|
|
300
323
|
* creates a clone of the ped
|
|
@@ -304,23 +327,23 @@ class Ped extends BaseEntity {
|
|
|
304
327
|
* @returns the cloned ped
|
|
305
328
|
*/
|
|
306
329
|
clone(network, bScriptHostPed, copyHeadBlend) {
|
|
307
|
-
return new Ped(ClonePed(this.
|
|
330
|
+
return new Ped(ClonePed(this.handle, network, bScriptHostPed, copyHeadBlend));
|
|
308
331
|
}
|
|
309
332
|
/**
|
|
310
333
|
* clones the ped onto the target ped
|
|
311
334
|
* @param targetPed the ped to clone onto
|
|
312
335
|
*/
|
|
313
336
|
cloneTo(targetPed) {
|
|
314
|
-
ClonePedToTarget(this.
|
|
337
|
+
ClonePedToTarget(this.handle, targetPed.Handle);
|
|
315
338
|
}
|
|
316
339
|
/**
|
|
317
340
|
* @param amount - the amount of armour to add to the ped
|
|
318
341
|
*/
|
|
319
342
|
addArmour(amount) {
|
|
320
|
-
AddArmourToPed(this.
|
|
343
|
+
AddArmourToPed(this.handle, amount);
|
|
321
344
|
}
|
|
322
345
|
applyDamage(damageAmount, boneId = 0, pedKiller = null) {
|
|
323
|
-
ApplyDamageToPed(this.
|
|
346
|
+
ApplyDamageToPed(this.handle, damageAmount, 0, boneId, pedKiller ? pedKiller.Handle : 0);
|
|
324
347
|
}
|
|
325
348
|
/**
|
|
326
349
|
* @param damagePack - the damage decal to apply see [here](https://github.com/femga/rdr3_discoveries/blob/master/peds_customization/ped_decals.lua) for more documentation
|
|
@@ -328,10 +351,10 @@ class Ped extends BaseEntity {
|
|
|
328
351
|
* @param mult - the multiplier?
|
|
329
352
|
*/
|
|
330
353
|
applyDamagePack(damagePack, damage, mult) {
|
|
331
|
-
ApplyPedDamagePack(this.
|
|
354
|
+
ApplyPedDamagePack(this.handle, damagePack, damage, mult);
|
|
332
355
|
}
|
|
333
356
|
get CurrentVehicle() {
|
|
334
|
-
const veh = GetVehiclePedIsIn(this.
|
|
357
|
+
const veh = GetVehiclePedIsIn(this.handle, false);
|
|
335
358
|
if (veh === 0) return null;
|
|
336
359
|
return new Vehicle(veh);
|
|
337
360
|
}
|
|
@@ -339,6 +362,34 @@ class Ped extends BaseEntity {
|
|
|
339
362
|
// applyBloodSpecific() {
|
|
340
363
|
// ApplyPedBloodSpecific
|
|
341
364
|
// }
|
|
365
|
+
giveHashCommand(commandHash, activationDuration) {
|
|
366
|
+
Citizen.invokeNative("0xD65FDC686A031C83", this.handle, commandHash, activationDuration);
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Adds or removes the ped stamina, depending on of the amount is positive or negative.
|
|
370
|
+
* @param amount the amount of stamina to add/remove
|
|
371
|
+
*/
|
|
372
|
+
changeStamina(amount) {
|
|
373
|
+
_N("0xC3D4B754C0E86B9E", this.handle, amount);
|
|
374
|
+
}
|
|
375
|
+
get MaxStamina() {
|
|
376
|
+
return _N("0xCB42AFE2B613EE55", this.handle);
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Returns the amount of stamina the ped has
|
|
380
|
+
*/
|
|
381
|
+
get Stamina() {
|
|
382
|
+
return _N("0x775A1CA7893AA8B5", this.handle);
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* returns the normalized stamina for the player, taking into account their unlocked stamina
|
|
386
|
+
*/
|
|
387
|
+
get StaminaNormalized() {
|
|
388
|
+
return _N("0x22F2A386D43048A9", this.handle);
|
|
389
|
+
}
|
|
390
|
+
resetStamina() {
|
|
391
|
+
_N("0x36513AFFC703C60D", this.handle);
|
|
392
|
+
}
|
|
342
393
|
}
|
|
343
394
|
export {
|
|
344
395
|
Ped
|
package/entities/Vehicle.d.ts
CHANGED
|
@@ -2,6 +2,17 @@ import type { VehicleSeat } from "../enums/VehicleSeat";
|
|
|
2
2
|
import { BaseEntity } from "./BaseEntity";
|
|
3
3
|
export declare class Vehicle extends BaseEntity {
|
|
4
4
|
constructor(handle: number);
|
|
5
|
+
/**
|
|
6
|
+
* Gets the entity from the handle given, if the entity doesn't exist it will return
|
|
7
|
+
* null.
|
|
8
|
+
*/
|
|
9
|
+
static fromHandle(handle: number): Vehicle | null;
|
|
10
|
+
/**
|
|
11
|
+
* Gets the ped from the current network id, this doesn't check that
|
|
12
|
+
* the entity is actually a ped
|
|
13
|
+
*/
|
|
14
|
+
static fromNetworkId(netId: number): Vehicle | null;
|
|
15
|
+
static fromStateBagName(bagName: string): Vehicle | null;
|
|
5
16
|
/**
|
|
6
17
|
*
|
|
7
18
|
* @param seatIndex the seat index to check
|
package/entities/Vehicle.js
CHANGED
|
@@ -9,6 +9,33 @@ class Vehicle extends BaseEntity {
|
|
|
9
9
|
constructor(handle) {
|
|
10
10
|
super(handle);
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Gets the entity from the handle given, if the entity doesn't exist it will return
|
|
14
|
+
* null.
|
|
15
|
+
*/
|
|
16
|
+
static fromHandle(handle) {
|
|
17
|
+
if (handle === 0 || !DoesEntityExist(handle)) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
return new Vehicle(handle);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Gets the ped from the current network id, this doesn't check that
|
|
24
|
+
* the entity is actually a ped
|
|
25
|
+
*/
|
|
26
|
+
static fromNetworkId(netId) {
|
|
27
|
+
if (netId === 0 || !NetworkDoesEntityExistWithNetworkId(netId)) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
return new Vehicle(NetToPed(netId));
|
|
31
|
+
}
|
|
32
|
+
static fromStateBagName(bagName) {
|
|
33
|
+
const ent = GetEntityFromStateBagName(bagName);
|
|
34
|
+
if (ent === 0) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
return new Vehicle(ent);
|
|
38
|
+
}
|
|
12
39
|
/**
|
|
13
40
|
*
|
|
14
41
|
* @param seatIndex the seat index to check
|