@nativewrappers/common 0.0.127 → 0.0.129
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.
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
import { CommonPlayer } from "./entities/CommonPlayer";
|
|
4
|
-
class
|
|
4
|
+
class CommonGameConstants {
|
|
5
5
|
static {
|
|
6
|
-
__name(this, "
|
|
6
|
+
__name(this, "CommonGameConstants");
|
|
7
7
|
}
|
|
8
8
|
// the actual player object that will get initialized on the first call to the `get Player()`
|
|
9
9
|
static player = null;
|
|
10
10
|
// The player id of the local client
|
|
11
11
|
static PlayerId = PlayerId();
|
|
12
12
|
// The server id of the local client.
|
|
13
|
-
static ServerId = GetPlayerServerId(
|
|
13
|
+
static ServerId = GetPlayerServerId(CommonGameConstants.PlayerId);
|
|
14
14
|
// The player class of the local object
|
|
15
15
|
static get Player() {
|
|
16
|
-
if (
|
|
17
|
-
|
|
16
|
+
if (CommonGameConstants.player === null) {
|
|
17
|
+
CommonGameConstants.player = new CommonPlayer(CommonGameConstants.PlayerId);
|
|
18
18
|
}
|
|
19
|
-
return
|
|
19
|
+
return CommonGameConstants.player;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
export {
|
|
23
|
-
|
|
23
|
+
CommonGameConstants
|
|
24
24
|
};
|
|
@@ -4,7 +4,7 @@ import { CommonPed } from "./CommonPed";
|
|
|
4
4
|
import { ClassTypes } from "../common/utils/ClassTypes";
|
|
5
5
|
import { GetEntityClassFromHandle } from "./GetEntityClassIdFromHandle";
|
|
6
6
|
import cfx from "../cfx/cfx";
|
|
7
|
-
import {
|
|
7
|
+
import { CommonGameConstants } from "../CommonGameConstants";
|
|
8
8
|
class CommonPlayer {
|
|
9
9
|
static {
|
|
10
10
|
__name(this, "CommonPlayer");
|
|
@@ -17,7 +17,7 @@ class CommonPlayer {
|
|
|
17
17
|
type = ClassTypes.Player;
|
|
18
18
|
static *AllPlayers(excludeLocalPlayer = true) {
|
|
19
19
|
for (const ply of GetActivePlayers()) {
|
|
20
|
-
if (excludeLocalPlayer && ply ===
|
|
20
|
+
if (excludeLocalPlayer && ply === CommonGameConstants.PlayerId) {
|
|
21
21
|
continue;
|
|
22
22
|
}
|
|
23
23
|
yield new CommonPlayer(ply);
|
|
@@ -50,7 +50,7 @@ class CommonPlayer {
|
|
|
50
50
|
* @param [fromPlayer=GameConstants.Player] the player to get the distance from
|
|
51
51
|
* @returns the closest player from {@param fromPlayer} and the distance the player was
|
|
52
52
|
*/
|
|
53
|
-
static getClosestPlayerPedWithDistance(minimumDistance = Number.MAX_VALUE, fromPlayer =
|
|
53
|
+
static getClosestPlayerPedWithDistance(minimumDistance = Number.MAX_VALUE, fromPlayer = CommonGameConstants.Player) {
|
|
54
54
|
const ped = fromPlayer.Ped;
|
|
55
55
|
const pos = ped.Position;
|
|
56
56
|
const data = [null, Number.MAX_VALUE];
|
|
@@ -69,7 +69,7 @@ class CommonPlayer {
|
|
|
69
69
|
* @param [fromPlayer=GameConstants.Player] the player to get the distance from
|
|
70
70
|
* @returns the closest player from {@param fromPlayer} and the distance the player was
|
|
71
71
|
*/
|
|
72
|
-
static getClosestPlayerPed(minimumDistance = Number.MAX_VALUE, fromPlayer =
|
|
72
|
+
static getClosestPlayerPed(minimumDistance = Number.MAX_VALUE, fromPlayer = CommonGameConstants.Player) {
|
|
73
73
|
const data = this.getClosestPlayerPedWithDistance(minimumDistance, fromPlayer);
|
|
74
74
|
return data[0];
|
|
75
75
|
}
|