@nativewrappers/server 0.0.174 → 0.0.176
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/net/NetworkedMap.js +1 -0
- package/common/utils/BitSet.d.ts +1 -1
- package/common/utils/BitSet.js +1 -1
- package/common-game/entities/CommonBaseEntity.d.ts +2 -2
- package/common-game/entities/CommonBaseEntity.js +3 -3
- package/common-game/entities/CommonPlayer.d.ts +1 -1
- package/common-game/entities/CommonPlayer.js +4 -4
- package/entities/Player.d.ts +9 -0
- package/entities/Player.js +13 -0
- package/enum/PeerStatistics.d.ts +11 -0
- package/enum/PeerStatistics.js +16 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +1 -1
package/common/utils/BitSet.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export declare class BitSet<T extends number> {
|
|
|
19
19
|
/**
|
|
20
20
|
* @returns `true` if the bit at {@param position} is set.
|
|
21
21
|
*/
|
|
22
|
-
test(position: number):
|
|
22
|
+
test(position: number): boolean;
|
|
23
23
|
/**
|
|
24
24
|
* @returns `true` if no bits in the bitset are set, false otherwise.
|
|
25
25
|
*/
|
package/common/utils/BitSet.js
CHANGED
|
@@ -30,7 +30,7 @@ class BitSet {
|
|
|
30
30
|
* @returns `true` if the bit at {@param position} is set.
|
|
31
31
|
*/
|
|
32
32
|
test(position) {
|
|
33
|
-
return this.value & position;
|
|
33
|
+
return (this.value & 1 << position) !== 0;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
* @returns `true` if no bits in the bitset are set, false otherwise.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ClassTypes } from "../../common/utils/ClassTypes";
|
|
2
2
|
import type { Quaternion } from "../../common/utils/Quaternion";
|
|
3
3
|
import { Vector3 } from "../../common/utils/Vector";
|
|
4
|
-
import type { CommonBaseEntityBoneCollection } from "./CommonBaseEntityBoneCollection";
|
|
5
|
-
import type { StateBagChangeHandler } from "../cfx/StateBagChangeHandler";
|
|
6
4
|
import { CommonModel } from "../CommonModel";
|
|
5
|
+
import type { StateBagChangeHandler } from "../cfx/StateBagChangeHandler";
|
|
7
6
|
import type { CommonBaseEntityBone } from "./CommonBaseEntityBone";
|
|
7
|
+
import type { CommonBaseEntityBoneCollection } from "./CommonBaseEntityBoneCollection";
|
|
8
8
|
import { IHandle } from "./IHandle";
|
|
9
9
|
export declare abstract class CommonBaseEntity extends IHandle {
|
|
10
10
|
protected stateBagCookies: number[];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { GlobalData } from "../../common/GlobalData";
|
|
3
4
|
import { Vector3 } from "../../common/utils/Vector";
|
|
4
|
-
import cfx from "../cfx/cfx";
|
|
5
5
|
import { CommonModel } from "../CommonModel";
|
|
6
|
-
import
|
|
6
|
+
import cfx from "../cfx/cfx";
|
|
7
7
|
import { IHandle } from "./IHandle";
|
|
8
8
|
class CommonBaseEntity extends IHandle {
|
|
9
9
|
static {
|
|
@@ -95,7 +95,7 @@ class CommonBaseEntity extends IHandle {
|
|
|
95
95
|
this.stateBagCookies = this.stateBagCookies.filter((cookie) => {
|
|
96
96
|
const isCookie = cookie === tgtCookie;
|
|
97
97
|
if (isCookie) RemoveStateBagChangeHandler(cookie);
|
|
98
|
-
return isCookie;
|
|
98
|
+
return !isCookie;
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
101
|
get Owner() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { StateBagChangeHandler } from "../cfx/StateBagChangeHandler";
|
|
2
|
-
import { CommonPed } from "./CommonPed";
|
|
3
2
|
import type { CommonEntity } from "./CommonEntityType";
|
|
3
|
+
import { CommonPed } from "./CommonPed";
|
|
4
4
|
export declare class CommonPlayer {
|
|
5
5
|
private handle;
|
|
6
6
|
private ped?;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import { CommonPed } from "./CommonPed";
|
|
4
3
|
import { ClassTypes } from "../../common/utils/ClassTypes";
|
|
5
|
-
import { GetEntityClassFromHandle } from "./GetEntityClassIdFromHandle";
|
|
6
|
-
import cfx from "../cfx/cfx";
|
|
7
4
|
import { CommonGameConstants } from "../CommonGameConstants";
|
|
5
|
+
import cfx from "../cfx/cfx";
|
|
6
|
+
import { CommonPed } from "./CommonPed";
|
|
7
|
+
import { GetEntityClassFromHandle } from "./GetEntityClassIdFromHandle";
|
|
8
8
|
class CommonPlayer {
|
|
9
9
|
static {
|
|
10
10
|
__name(this, "CommonPlayer");
|
|
@@ -123,7 +123,7 @@ class CommonPlayer {
|
|
|
123
123
|
this.stateBagCookies = this.stateBagCookies.filter((cookie) => {
|
|
124
124
|
const isCookie = cookie === tgtCookie;
|
|
125
125
|
if (isCookie) RemoveStateBagChangeHandler(cookie);
|
|
126
|
-
return isCookie;
|
|
126
|
+
return !isCookie;
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
129
|
removeAllStateListeners() {
|
package/entities/Player.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ClassTypes } from "../common/utils/ClassTypes";
|
|
2
2
|
import { Vector3 } from "../common/utils/Vector";
|
|
3
|
+
import { PeerStatistics } from "../enum/PeerStatistics";
|
|
3
4
|
import { Ped } from "./Ped";
|
|
4
5
|
export declare class Player {
|
|
5
6
|
private readonly source;
|
|
@@ -57,6 +58,14 @@ export declare class Player {
|
|
|
57
58
|
* @returns the players round trip ping
|
|
58
59
|
*/
|
|
59
60
|
get Ping(): number;
|
|
61
|
+
/**
|
|
62
|
+
* @returns the raw value of the specified ENet peer statistic for the player
|
|
63
|
+
*/
|
|
64
|
+
getPeerStatistic(statistic: PeerStatistics): number;
|
|
65
|
+
/**
|
|
66
|
+
* @returns the players packet loss as a fraction (0.0 - 1.0), this only updates once every 10 seconds
|
|
67
|
+
*/
|
|
68
|
+
get PacketLoss(): number;
|
|
60
69
|
/**
|
|
61
70
|
* @returns the current routhing bucket the player is in, default is 0
|
|
62
71
|
*/
|
package/entities/Player.js
CHANGED
|
@@ -4,6 +4,7 @@ import { ClassTypes } from "../common/utils/ClassTypes";
|
|
|
4
4
|
import { Vector3 } from "../common/utils/Vector";
|
|
5
5
|
import { cleanPlayerName } from "../common/utils/cleanPlayerName";
|
|
6
6
|
import cfx from "../cfx";
|
|
7
|
+
import { ENET_PACKET_LOSS_SCALE, PeerStatistics } from "../enum/PeerStatistics";
|
|
7
8
|
import { Ped } from "./Ped";
|
|
8
9
|
class Player {
|
|
9
10
|
constructor(source) {
|
|
@@ -111,6 +112,18 @@ class Player {
|
|
|
111
112
|
get Ping() {
|
|
112
113
|
return GetPlayerPing(this.Src);
|
|
113
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* @returns the raw value of the specified ENet peer statistic for the player
|
|
117
|
+
*/
|
|
118
|
+
getPeerStatistic(statistic) {
|
|
119
|
+
return GetPlayerPeerStatistics(this.Src, statistic);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* @returns the players packet loss as a fraction (0.0 - 1.0), this only updates once every 10 seconds
|
|
123
|
+
*/
|
|
124
|
+
get PacketLoss() {
|
|
125
|
+
return this.getPeerStatistic(PeerStatistics.PacketLoss) / ENET_PACKET_LOSS_SCALE;
|
|
126
|
+
}
|
|
114
127
|
/**
|
|
115
128
|
* @returns the current routhing bucket the player is in, default is 0
|
|
116
129
|
*/
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const ENET_PACKET_LOSS_SCALE = 65536;
|
|
2
|
+
export declare enum PeerStatistics {
|
|
3
|
+
PacketLoss = 0,
|
|
4
|
+
PacketLossVariance = 1,
|
|
5
|
+
PacketLossEpoch = 2,
|
|
6
|
+
RoundTripTime = 3,
|
|
7
|
+
RoundTripTimeVariance = 4,
|
|
8
|
+
LastRoundTripTime = 5,
|
|
9
|
+
LastRoundTripTimeVariance = 6,
|
|
10
|
+
PacketThrottleEpoch = 7
|
|
11
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const ENET_PACKET_LOSS_SCALE = 65536;
|
|
2
|
+
var PeerStatistics = /* @__PURE__ */ ((PeerStatistics2) => {
|
|
3
|
+
PeerStatistics2[PeerStatistics2["PacketLoss"] = 0] = "PacketLoss";
|
|
4
|
+
PeerStatistics2[PeerStatistics2["PacketLossVariance"] = 1] = "PacketLossVariance";
|
|
5
|
+
PeerStatistics2[PeerStatistics2["PacketLossEpoch"] = 2] = "PacketLossEpoch";
|
|
6
|
+
PeerStatistics2[PeerStatistics2["RoundTripTime"] = 3] = "RoundTripTime";
|
|
7
|
+
PeerStatistics2[PeerStatistics2["RoundTripTimeVariance"] = 4] = "RoundTripTimeVariance";
|
|
8
|
+
PeerStatistics2[PeerStatistics2["LastRoundTripTime"] = 5] = "LastRoundTripTime";
|
|
9
|
+
PeerStatistics2[PeerStatistics2["LastRoundTripTimeVariance"] = 6] = "LastRoundTripTimeVariance";
|
|
10
|
+
PeerStatistics2[PeerStatistics2["PacketThrottleEpoch"] = 7] = "PacketThrottleEpoch";
|
|
11
|
+
return PeerStatistics2;
|
|
12
|
+
})(PeerStatistics || {});
|
|
13
|
+
export {
|
|
14
|
+
ENET_PACKET_LOSS_SCALE,
|
|
15
|
+
PeerStatistics
|
|
16
|
+
};
|
package/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from "./type/Anticheat";
|
|
|
5
5
|
export * from "./type/Hash";
|
|
6
6
|
export * from "./game/generateHash";
|
|
7
7
|
export * from "./enum/OrphanMode";
|
|
8
|
+
export * from "./enum/PeerStatistics";
|
|
8
9
|
export * from "./enum/PopulationType";
|
|
9
10
|
export * from "./enum/VehicleLockStatus";
|
|
10
11
|
export * from "./enum/VehicleType";
|
package/index.js
CHANGED
|
@@ -5,6 +5,7 @@ export * from "./type/Anticheat";
|
|
|
5
5
|
export * from "./type/Hash";
|
|
6
6
|
export * from "./game/generateHash";
|
|
7
7
|
export * from "./enum/OrphanMode";
|
|
8
|
+
export * from "./enum/PeerStatistics";
|
|
8
9
|
export * from "./enum/PopulationType";
|
|
9
10
|
export * from "./enum/VehicleLockStatus";
|
|
10
11
|
export * from "./enum/VehicleType";
|