@nativewrappers/fivem 0.0.22 → 0.0.25
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/client/Game.d.ts +4 -0
- package/client/Game.js +14 -0
- package/client/models/Player.d.ts +2 -0
- package/client/models/Player.js +13 -4
- package/client/models/Vehicle.d.ts +6 -0
- package/client/models/Vehicle.js +23 -0
- package/common/utils/Vector.d.ts +10 -17
- package/common/utils/Vector.js +3 -5
- package/package.json +1 -1
package/client/Game.d.ts
CHANGED
|
@@ -9,6 +9,10 @@ export declare abstract class Game {
|
|
|
9
9
|
* @param input The input string to calculate the hash
|
|
10
10
|
*/
|
|
11
11
|
static generateHash(input: string): number;
|
|
12
|
+
static setLocalPlayerGhosted(isGhosted: boolean, inverseGhost: boolean): void;
|
|
13
|
+
static setGhostAlpha(alpha: number): void;
|
|
14
|
+
static resetGhostAlpha(): void;
|
|
15
|
+
static setGhostingInverted(isInverted: boolean): void;
|
|
12
16
|
/**
|
|
13
17
|
* Gets the game language
|
|
14
18
|
*/
|
package/client/Game.js
CHANGED
|
@@ -19,6 +19,20 @@ export class Game {
|
|
|
19
19
|
this.hashCache.set(input, hash);
|
|
20
20
|
return hash;
|
|
21
21
|
}
|
|
22
|
+
static setLocalPlayerGhosted(isGhosted, inverseGhost) {
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
SetLocalPlayerAsGhost(isGhosted, inverseGhost);
|
|
25
|
+
}
|
|
26
|
+
static setGhostAlpha(alpha) {
|
|
27
|
+
SetGhostedEntityAlpha(alpha);
|
|
28
|
+
}
|
|
29
|
+
static resetGhostAlpha() {
|
|
30
|
+
ResetGhostedEntityAlpha();
|
|
31
|
+
}
|
|
32
|
+
static setGhostingInverted(isInverted) {
|
|
33
|
+
// actual name is SET_INVERT_GHOSTING
|
|
34
|
+
N_0xd7b6c73cad419bcf(isInverted);
|
|
35
|
+
}
|
|
22
36
|
/**
|
|
23
37
|
* Gets the game language
|
|
24
38
|
*/
|
|
@@ -37,6 +37,8 @@ export declare class Player {
|
|
|
37
37
|
get PvPEnabled(): boolean;
|
|
38
38
|
set PvPEnabled(value: boolean);
|
|
39
39
|
get IsDead(): boolean;
|
|
40
|
+
set DisableFiring(value: boolean);
|
|
41
|
+
set Ghosted(isGhosted: boolean);
|
|
40
42
|
get EntityPlayerIsAimingAt(): BaseEntity | null;
|
|
41
43
|
get StealthNoise(): number;
|
|
42
44
|
get FakeWantedLevel(): number;
|
package/client/models/Player.js
CHANGED
|
@@ -90,10 +90,19 @@ export class Player {
|
|
|
90
90
|
get IsDead() {
|
|
91
91
|
return IsPlayerDead(this.handle);
|
|
92
92
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
set DisableFiring(value) {
|
|
94
|
+
DisablePlayerFiring(this.handle, value);
|
|
95
|
+
}
|
|
96
|
+
set Ghosted(isGhosted) {
|
|
97
|
+
// if we're the local player then use the local version of the native
|
|
98
|
+
if (this.Handle === 128) {
|
|
99
|
+
SetLocalPlayerAsGhost(isGhosted);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
// actual name is SET_REMOTE_PLAYER_AS_GHOST
|
|
103
|
+
SetRelationshipToPlayer(this.handle, isGhosted);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
97
106
|
get EntityPlayerIsAimingAt() {
|
|
98
107
|
const [entityHit, entity] = GetEntityPlayerIsFreeAimingAt(this.handle);
|
|
99
108
|
if (entityHit) {
|
|
@@ -124,6 +124,12 @@ export declare class Vehicle extends BaseEntity {
|
|
|
124
124
|
set IsBurnoutForced(value: boolean);
|
|
125
125
|
get IsInBurnout(): boolean;
|
|
126
126
|
get Driver(): Ped;
|
|
127
|
+
get Ghosted(): boolean;
|
|
128
|
+
set GhostedForGhostPlayers(isGhostedForGhostPlayers: boolean);
|
|
129
|
+
set Ghosted(isGhosted: boolean);
|
|
130
|
+
static set GhostAlpha(alpha: number);
|
|
131
|
+
get IsInGhostCollision(): boolean;
|
|
132
|
+
static resetGhostAlpha(): void;
|
|
127
133
|
get Occupants(): Ped[];
|
|
128
134
|
get Passengers(): Ped[];
|
|
129
135
|
get Doors(): VehicleDoorCollection;
|
package/client/models/Vehicle.js
CHANGED
|
@@ -382,6 +382,29 @@ export class Vehicle extends BaseEntity {
|
|
|
382
382
|
get Driver() {
|
|
383
383
|
return this.getPedOnSeat(VehicleSeat.Driver);
|
|
384
384
|
}
|
|
385
|
+
// while ghosted use entity index, it doesn't look like you can ghost
|
|
386
|
+
// anything but players and vehicles
|
|
387
|
+
get Ghosted() {
|
|
388
|
+
// actual name is IS_ENTITY_A_GHOST
|
|
389
|
+
return IsEntityGhostedToLocalPlayer(this.handle);
|
|
390
|
+
}
|
|
391
|
+
set GhostedForGhostPlayers(isGhostedForGhostPlayers) {
|
|
392
|
+
// actual name is SET_ENTITY_GHOSTED_FOR_GHOST_PLAYERS
|
|
393
|
+
NetworkSetEntityGhostedWithOwner(this.handle, isGhostedForGhostPlayers);
|
|
394
|
+
}
|
|
395
|
+
set Ghosted(isGhosted) {
|
|
396
|
+
SetNetworkVehicleAsGhost(this.Handle, isGhosted);
|
|
397
|
+
}
|
|
398
|
+
static set GhostAlpha(alpha) {
|
|
399
|
+
SetGhostedEntityAlpha(alpha);
|
|
400
|
+
}
|
|
401
|
+
get IsInGhostCollision() {
|
|
402
|
+
// actual name is IS_ENTITY_IN_GHOST_COLLISION
|
|
403
|
+
return N_0x7ef7649b64d7ff10(this.handle);
|
|
404
|
+
}
|
|
405
|
+
static resetGhostAlpha() {
|
|
406
|
+
ResetGhostedEntityAlpha();
|
|
407
|
+
}
|
|
385
408
|
get Occupants() {
|
|
386
409
|
const driver = this.Driver;
|
|
387
410
|
if (!Ped.exists(driver)) {
|
package/common/utils/Vector.d.ts
CHANGED
|
@@ -9,26 +9,19 @@ export interface Vec2 {
|
|
|
9
9
|
/**
|
|
10
10
|
* Represents a 3-dimensional vector.
|
|
11
11
|
*/
|
|
12
|
-
export interface Vec3 {
|
|
13
|
-
x: number;
|
|
14
|
-
y: number;
|
|
12
|
+
export interface Vec3 extends Vec2 {
|
|
15
13
|
z: number;
|
|
16
14
|
}
|
|
17
15
|
/**
|
|
18
16
|
* Represents a 4-dimensional vector.
|
|
19
17
|
*/
|
|
20
|
-
export interface Vec4 {
|
|
21
|
-
x: number;
|
|
22
|
-
y: number;
|
|
23
|
-
z: number;
|
|
18
|
+
export interface Vec4 extends Vec3 {
|
|
24
19
|
w: number;
|
|
25
20
|
}
|
|
26
21
|
/**
|
|
27
22
|
* An object with vector components.
|
|
28
23
|
*/
|
|
29
|
-
interface
|
|
30
|
-
x: number;
|
|
31
|
-
y: number;
|
|
24
|
+
export interface Vec extends Vec2 {
|
|
32
25
|
z?: number;
|
|
33
26
|
w?: number;
|
|
34
27
|
}
|
|
@@ -47,7 +40,7 @@ type VectorType = typeof Vector;
|
|
|
47
40
|
/**
|
|
48
41
|
* Represents an object or class that can be treated as a vector.
|
|
49
42
|
*/
|
|
50
|
-
type VectorLike =
|
|
43
|
+
type VectorLike = Vec | Vector;
|
|
51
44
|
/**
|
|
52
45
|
* Utility type to get the vector type of an object based on its component.
|
|
53
46
|
*/
|
|
@@ -121,14 +114,14 @@ export declare class Vector {
|
|
|
121
114
|
* @param z - The value to add to the z-component.
|
|
122
115
|
* @returns A new vector with the z-component incremented.
|
|
123
116
|
*/
|
|
124
|
-
static addZ<T extends VectorType, U extends
|
|
117
|
+
static addZ<T extends VectorType, U extends Vec3 | Vec4>(this: T, obj: U, z: number): InferVector<U>;
|
|
125
118
|
/**
|
|
126
119
|
* Adds a scalar value to the w-component of a vector.
|
|
127
120
|
* @param obj - The vector.
|
|
128
121
|
* @param w - The value to add to the w-component.
|
|
129
122
|
* @returns A new vector with the w-component incremented.
|
|
130
123
|
*/
|
|
131
|
-
static addW<T extends VectorType, U extends
|
|
124
|
+
static addW<T extends VectorType, U extends Vec4>(this: T, obj: U, w: number): InferVector<U>;
|
|
132
125
|
/**
|
|
133
126
|
* Subtracts one vector from another or subtracts a scalar value from a vector.
|
|
134
127
|
* @param a - The vector.
|
|
@@ -163,7 +156,7 @@ export declare class Vector {
|
|
|
163
156
|
* @param b - The second vector.
|
|
164
157
|
* @returns A new vector perpendicular to both input vectors.
|
|
165
158
|
*/
|
|
166
|
-
static crossProduct<T extends VectorType, U extends
|
|
159
|
+
static crossProduct<T extends VectorType, U extends Vec3 | Vec4>(this: T, a: U, b: U): U;
|
|
167
160
|
/**
|
|
168
161
|
* Normalizes a vector, producing a new vector with the same direction but with a magnitude of 1.
|
|
169
162
|
* @param vector - The vector to be normalized.
|
|
@@ -256,7 +249,7 @@ export declare class Vector {
|
|
|
256
249
|
/**
|
|
257
250
|
* Converts the vector to an array of its components.
|
|
258
251
|
*/
|
|
259
|
-
toArray():
|
|
252
|
+
toArray<T extends this>(): VectorArray<T>;
|
|
260
253
|
/**
|
|
261
254
|
* Replaces the components of the vector with the components of another vector object.
|
|
262
255
|
* @param v - The object whose components will replace the current vector's components.
|
|
@@ -302,7 +295,7 @@ export declare class Vector3 extends Vector implements Vec3 {
|
|
|
302
295
|
/**
|
|
303
296
|
* @see Vector.crossProduct
|
|
304
297
|
*/
|
|
305
|
-
crossProduct(v:
|
|
298
|
+
crossProduct(v: Vec3 | Vec4): Vec3 | Vec4;
|
|
306
299
|
}
|
|
307
300
|
/**
|
|
308
301
|
* Represents a 4-dimensional vector.
|
|
@@ -331,6 +324,6 @@ export declare class Vector4 extends Vector {
|
|
|
331
324
|
/**
|
|
332
325
|
* @see Vector.crossProduct
|
|
333
326
|
*/
|
|
334
|
-
crossProduct(v:
|
|
327
|
+
crossProduct(v: Vec3 | Vec4): Vec3 | Vec4;
|
|
335
328
|
}
|
|
336
329
|
export {};
|
package/common/utils/Vector.js
CHANGED
|
@@ -155,11 +155,9 @@ export class Vector {
|
|
|
155
155
|
static dotProduct(a, b) {
|
|
156
156
|
let result = 0;
|
|
157
157
|
for (const key of ['x', 'y', 'z', 'w']) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
result += v1 * v2;
|
|
162
|
-
else if (v1 || v2) {
|
|
158
|
+
if (key in a && key in b)
|
|
159
|
+
result += a[key] * b[key];
|
|
160
|
+
else {
|
|
163
161
|
throw new Error('Vectors must have the same dimensions');
|
|
164
162
|
}
|
|
165
163
|
}
|