@nativewrappers/redm 0.0.72 → 0.0.73
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/README.md +45 -45
- package/common/utils/PointF.d.ts +0 -5
- package/index.js +60 -241
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
<h1 align="center">Monorepo for a FiveM server/client wrapper</h1>
|
|
2
|
-
|
|
3
|
-
<p align="center">
|
|
4
|
-
<i>🔥 A Javascript/Typescript package for FiveM resource development 🎮</i>
|
|
5
|
-
<br>
|
|
6
|
-
<small>This project is in no way affiliated with FiveM or the Cfx.re Collective.</small>
|
|
7
|
-
</br></br>
|
|
8
|
-
<a href="https://github.com/nativewrappers/nativewrappers/blob/master/LICENSE">
|
|
9
|
-
<img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat" alt="License: MIT">
|
|
10
|
-
</a>
|
|
11
|
-
<a href="https://www.npmjs.com/package/@nativewrappers/fivem">
|
|
12
|
-
<img src="https://img.shields.io/npm/v/@nativewrappers/fivem?style=flat" alt="npm version">
|
|
13
|
-
</a>
|
|
14
|
-
<a href="https://www.npmjs.com/package/@nativewrappers/fivem">
|
|
15
|
-
<img src="https://img.shields.io/npm/dm/@nativewrappers/fivem?style=flat">
|
|
16
|
-
</a>
|
|
17
|
-
<a href="https://github.com/nativewrappers/nativewrappers/actions/workflows/config.yml">
|
|
18
|
-
<img src="https://github.com/nativewrappers/nativewrappers/actions/workflows/config.yml/badge.svg" alt="Workflow Status">
|
|
19
|
-
</a>
|
|
20
|
-
<a href="https://github.com/nativewrappers/nativewrappers/commits/master">
|
|
21
|
-
<img src="https://img.shields.io/github/last-commit/nativewrappers/fivem.svg?style=flat" alt="Last commit">
|
|
22
|
-
</a>
|
|
23
|
-
</p>
|
|
24
|
-
|
|
25
|
-
<h3 align="center">This project is currently iterating rapidly, there will be breaking changes.</h3>
|
|
26
|
-
|
|
27
|
-
<p align="center">
|
|
28
|
-
<h2 align="center"><a href="https://github.com/nativewrappers/nativewrappers/tree/main/docs">Documentation</a></h2>
|
|
29
|
-
<!-- <a href="https://forum.fivem.net/t/fivem-js-v1-3-2-javascript-typescript-wrapper-now-with-menu-class-nativeui/268640">Forum</a> -->
|
|
30
|
-
</p>
|
|
31
|
-
|
|
32
|
-
## Features
|
|
33
|
-
|
|
34
|
-
- No runtime dependencies
|
|
35
|
-
- Entity management through class objects (i.e. `Vehicle` and `Ped` entities)
|
|
36
|
-
- Server and Client side variants on wrapper
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
## Download & Install
|
|
40
|
-
```
|
|
41
|
-
pnpm add @nativewrappers/redm # for redm,
|
|
42
|
-
pnpm add @nativewrappers/fivem # for fivem
|
|
43
|
-
pnpm add @nativewrappers/common # for any, should be game agnostic, provides Vector3, decors, kvps, helper functions, etc
|
|
44
|
-
pnpm add @nativewrappers/server # for server
|
|
45
|
-
```
|
|
1
|
+
<h1 align="center">Monorepo for a FiveM server/client wrapper</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<i>🔥 A Javascript/Typescript package for FiveM resource development 🎮</i>
|
|
5
|
+
<br>
|
|
6
|
+
<small>This project is in no way affiliated with FiveM or the Cfx.re Collective.</small>
|
|
7
|
+
</br></br>
|
|
8
|
+
<a href="https://github.com/nativewrappers/nativewrappers/blob/master/LICENSE">
|
|
9
|
+
<img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat" alt="License: MIT">
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/@nativewrappers/fivem">
|
|
12
|
+
<img src="https://img.shields.io/npm/v/@nativewrappers/fivem?style=flat" alt="npm version">
|
|
13
|
+
</a>
|
|
14
|
+
<a href="https://www.npmjs.com/package/@nativewrappers/fivem">
|
|
15
|
+
<img src="https://img.shields.io/npm/dm/@nativewrappers/fivem?style=flat">
|
|
16
|
+
</a>
|
|
17
|
+
<a href="https://github.com/nativewrappers/nativewrappers/actions/workflows/config.yml">
|
|
18
|
+
<img src="https://github.com/nativewrappers/nativewrappers/actions/workflows/config.yml/badge.svg" alt="Workflow Status">
|
|
19
|
+
</a>
|
|
20
|
+
<a href="https://github.com/nativewrappers/nativewrappers/commits/master">
|
|
21
|
+
<img src="https://img.shields.io/github/last-commit/nativewrappers/fivem.svg?style=flat" alt="Last commit">
|
|
22
|
+
</a>
|
|
23
|
+
</p>
|
|
24
|
+
|
|
25
|
+
<h3 align="center">This project is currently iterating rapidly, there will be breaking changes.</h3>
|
|
26
|
+
|
|
27
|
+
<p align="center">
|
|
28
|
+
<h2 align="center"><a href="https://github.com/nativewrappers/nativewrappers/tree/main/docs">Documentation</a></h2>
|
|
29
|
+
<!-- <a href="https://forum.fivem.net/t/fivem-js-v1-3-2-javascript-typescript-wrapper-now-with-menu-class-nativeui/268640">Forum</a> -->
|
|
30
|
+
</p>
|
|
31
|
+
|
|
32
|
+
## Features
|
|
33
|
+
|
|
34
|
+
- No runtime dependencies
|
|
35
|
+
- Entity management through class objects (i.e. `Vehicle` and `Ped` entities)
|
|
36
|
+
- Server and Client side variants on wrapper
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
## Download & Install
|
|
40
|
+
```
|
|
41
|
+
pnpm add @nativewrappers/redm # for redm,
|
|
42
|
+
pnpm add @nativewrappers/fivem # for fivem
|
|
43
|
+
pnpm add @nativewrappers/common # for any, should be game agnostic, provides Vector3, decors, kvps, helper functions, etc
|
|
44
|
+
pnpm add @nativewrappers/server # for server
|
|
45
|
+
```
|
package/common/utils/PointF.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -47,8 +47,7 @@ var Vector = class _Vector {
|
|
|
47
47
|
if (type !== EXT_VECTOR2 && type !== EXT_VECTOR3 && type !== EXT_VECTOR4)
|
|
48
48
|
throw new Error("Buffer type is not a valid Vector.");
|
|
49
49
|
const arr = new Array(buffer.length / 4);
|
|
50
|
-
for (let i = 0; i < arr.length; i++)
|
|
51
|
-
arr[i] = Number(buffer.readFloatLE(i * 4).toPrecision(7));
|
|
50
|
+
for (let i = 0; i < arr.length; i++) arr[i] = Number(buffer.readFloatLE(i * 4).toPrecision(7));
|
|
52
51
|
return this.fromArray(arr);
|
|
53
52
|
}
|
|
54
53
|
/**
|
|
@@ -101,12 +100,7 @@ var Vector = class _Vector {
|
|
|
101
100
|
* @returns A new vector with the z-component incremented.
|
|
102
101
|
*/
|
|
103
102
|
static addZ(obj, z) {
|
|
104
|
-
return this.create(
|
|
105
|
-
obj.x,
|
|
106
|
-
obj.y,
|
|
107
|
-
obj.z + z,
|
|
108
|
-
obj.w
|
|
109
|
-
);
|
|
103
|
+
return this.create(obj.x, obj.y, obj.z + z, obj.w);
|
|
110
104
|
}
|
|
111
105
|
/**
|
|
112
106
|
* Adds a scalar value to the w-component of a vector.
|
|
@@ -156,10 +150,8 @@ var Vector = class _Vector {
|
|
|
156
150
|
const isNumber = typeof b === "number";
|
|
157
151
|
x = operator(Math.abs(x), isNumber ? b : Math.abs(b.x ?? 0));
|
|
158
152
|
y = operator(Math.abs(y), isNumber ? b : Math.abs(b.y ?? 0));
|
|
159
|
-
if (z !== void 0)
|
|
160
|
-
|
|
161
|
-
if (w !== void 0)
|
|
162
|
-
w = operator(Math.abs(w), isNumber ? b : Math.abs(b.w ?? 0));
|
|
153
|
+
if (z !== void 0) z = operator(Math.abs(z), isNumber ? b : Math.abs(b.z ?? 0));
|
|
154
|
+
if (w !== void 0) w = operator(Math.abs(w), isNumber ? b : Math.abs(b.w ?? 0));
|
|
163
155
|
return this.create(x, y, z, w);
|
|
164
156
|
}
|
|
165
157
|
/**
|
|
@@ -210,8 +202,7 @@ var Vector = class _Vector {
|
|
|
210
202
|
const x = a[key];
|
|
211
203
|
const y = b[key];
|
|
212
204
|
if (!!x && !!y) result += x * y;
|
|
213
|
-
else if (x || y)
|
|
214
|
-
throw new Error("Vectors must have the same dimensions.");
|
|
205
|
+
else if (x || y) throw new Error("Vectors must have the same dimensions.");
|
|
215
206
|
}
|
|
216
207
|
return result;
|
|
217
208
|
}
|
|
@@ -225,15 +216,8 @@ var Vector = class _Vector {
|
|
|
225
216
|
const { x: ax, y: ay, z: az, w: aw } = a;
|
|
226
217
|
const { x: bx, y: by, z: bz } = b;
|
|
227
218
|
if (ax === void 0 || ay === void 0 || az === void 0 || bx === void 0 || by === void 0 || bz === void 0)
|
|
228
|
-
throw new Error(
|
|
229
|
-
|
|
230
|
-
);
|
|
231
|
-
return this.create(
|
|
232
|
-
ay * bz - az * by,
|
|
233
|
-
az * bx - ax * bz,
|
|
234
|
-
ax * by - ay * bx,
|
|
235
|
-
aw
|
|
236
|
-
);
|
|
219
|
+
throw new Error("Vector.crossProduct requires two three-dimensional vectors.");
|
|
220
|
+
return this.create(ay * bz - az * by, az * bx - ax * bz, ax * by - ay * bx, aw);
|
|
237
221
|
}
|
|
238
222
|
/**
|
|
239
223
|
* Normalizes a vector, producing a new vector with the same direction but with a magnitude of 1.
|
|
@@ -257,8 +241,7 @@ var Vector = class _Vector {
|
|
|
257
241
|
* @param primitive The object to use as a vector.
|
|
258
242
|
*/
|
|
259
243
|
static fromObject(primitive) {
|
|
260
|
-
if (Array.isArray(primitive))
|
|
261
|
-
return this.fromArray(primitive);
|
|
244
|
+
if (Array.isArray(primitive)) return this.fromArray(primitive);
|
|
262
245
|
if ("buffer" in primitive) return this.fromBuffer(primitive);
|
|
263
246
|
const { x, y, z, w } = primitive;
|
|
264
247
|
return this.create(x, y, z, w);
|
|
@@ -443,8 +426,7 @@ var Vector = class _Vector {
|
|
|
443
426
|
return Math.sqrt(sum);
|
|
444
427
|
}
|
|
445
428
|
swizzle(components) {
|
|
446
|
-
if (!/^[xyzw]+$/.test(components))
|
|
447
|
-
throw new Error(`Invalid key in swizzle components (${components}).`);
|
|
429
|
+
if (!/^[xyzw]+$/.test(components)) throw new Error(`Invalid key in swizzle components (${components}).`);
|
|
448
430
|
const arr = components.split("").map((char) => this[char] ?? 0);
|
|
449
431
|
return _Vector.create(...arr);
|
|
450
432
|
}
|
|
@@ -728,16 +710,7 @@ var BaseEntity = class {
|
|
|
728
710
|
* @param pos sets the position for the current ped
|
|
729
711
|
*/
|
|
730
712
|
set Position(pos) {
|
|
731
|
-
SetEntityCoords(
|
|
732
|
-
this.handle,
|
|
733
|
-
pos.x,
|
|
734
|
-
pos.y,
|
|
735
|
-
pos.z,
|
|
736
|
-
false,
|
|
737
|
-
false,
|
|
738
|
-
false,
|
|
739
|
-
false
|
|
740
|
-
);
|
|
713
|
+
SetEntityCoords(this.handle, pos.x, pos.y, pos.z, false, false, false, false);
|
|
741
714
|
}
|
|
742
715
|
};
|
|
743
716
|
|
|
@@ -793,17 +766,7 @@ var Entity = class extends BaseEntity {
|
|
|
793
766
|
*/
|
|
794
767
|
applyForceToCenter(direction, forceType = 0 /* MinForce */, isDirectional = false, isForceRel = true) {
|
|
795
768
|
const d = direction;
|
|
796
|
-
ApplyForceToEntityCenterOfMass(
|
|
797
|
-
this.Handle,
|
|
798
|
-
forceType,
|
|
799
|
-
d.x,
|
|
800
|
-
d.y,
|
|
801
|
-
d.z,
|
|
802
|
-
false,
|
|
803
|
-
isDirectional,
|
|
804
|
-
isForceRel,
|
|
805
|
-
false
|
|
806
|
-
);
|
|
769
|
+
ApplyForceToEntityCenterOfMass(this.Handle, forceType, d.x, d.y, d.z, false, isDirectional, isForceRel, false);
|
|
807
770
|
}
|
|
808
771
|
/**
|
|
809
772
|
* @param tgtEntity - the entity to attach to the {@Entity}
|
|
@@ -818,9 +781,7 @@ var Entity = class extends BaseEntity {
|
|
|
818
781
|
*/
|
|
819
782
|
attachTo(tgtEntity, pos, rot, boneIndex = 0, enableCollision = true, useSoftPinning = false, vertexIndex = 0, fixedRot = true) {
|
|
820
783
|
if (tgtEntity.Handle === this.Handle) {
|
|
821
|
-
throw new Error(
|
|
822
|
-
"tgtEntity had the same handle as the current entity, attaching an entity to itself will crash"
|
|
823
|
-
);
|
|
784
|
+
throw new Error("tgtEntity had the same handle as the current entity, attaching an entity to itself will crash");
|
|
824
785
|
}
|
|
825
786
|
const p = pos;
|
|
826
787
|
const r = rot;
|
|
@@ -867,22 +828,13 @@ var CoreAttribute = class {
|
|
|
867
828
|
_N("0x4AF5A4C7B9157D14", this.handle, this.attribute, amount, makeSound);
|
|
868
829
|
}
|
|
869
830
|
get Overpowered() {
|
|
870
|
-
return _N(
|
|
871
|
-
"0x200373A8DF081F22",
|
|
872
|
-
this.attribute,
|
|
873
|
-
Citizen.resultAsInteger()
|
|
874
|
-
);
|
|
831
|
+
return _N("0x200373A8DF081F22", this.attribute, Citizen.resultAsInteger());
|
|
875
832
|
}
|
|
876
833
|
/**
|
|
877
834
|
* @returns the amount of overpower time left in seconds
|
|
878
835
|
*/
|
|
879
836
|
get OverpoweredTimeLeft() {
|
|
880
|
-
return _N(
|
|
881
|
-
"0xB429F58803D285B1",
|
|
882
|
-
this.handle,
|
|
883
|
-
this.attribute,
|
|
884
|
-
Citizen.resultAsInteger()
|
|
885
|
-
);
|
|
837
|
+
return _N("0xB429F58803D285B1", this.handle, this.attribute, Citizen.resultAsInteger());
|
|
886
838
|
}
|
|
887
839
|
/**
|
|
888
840
|
* Returns how full the core is
|
|
@@ -950,18 +902,10 @@ var PedAttribute = class {
|
|
|
950
902
|
return GetAttributeBonusRank(this.handle, this.attribute);
|
|
951
903
|
}
|
|
952
904
|
get MaxRank() {
|
|
953
|
-
return _N(
|
|
954
|
-
"0x704674A0535A471D",
|
|
955
|
-
this.attribute,
|
|
956
|
-
Citizen.resultAsInteger()
|
|
957
|
-
);
|
|
905
|
+
return _N("0x704674A0535A471D", this.attribute, Citizen.resultAsInteger());
|
|
958
906
|
}
|
|
959
907
|
get Overpowered() {
|
|
960
|
-
return _N(
|
|
961
|
-
"0x103C2F885ABEB00B",
|
|
962
|
-
this.attribute,
|
|
963
|
-
Citizen.resultAsInteger()
|
|
964
|
-
);
|
|
908
|
+
return _N("0x103C2F885ABEB00B", this.attribute, Citizen.resultAsInteger());
|
|
965
909
|
}
|
|
966
910
|
};
|
|
967
911
|
var Attributes = class {
|
|
@@ -979,31 +923,23 @@ var Attributes = class {
|
|
|
979
923
|
}
|
|
980
924
|
}
|
|
981
925
|
getCore(attribute) {
|
|
982
|
-
if (attribute > 2)
|
|
983
|
-
|
|
984
|
-
if (attribute < 0)
|
|
985
|
-
throw new RangeError("The minimum enum for CoreAttribute is 0");
|
|
926
|
+
if (attribute > 2) throw new RangeError("The max enum for CoreAttribute is 2");
|
|
927
|
+
if (attribute < 0) throw new RangeError("The minimum enum for CoreAttribute is 0");
|
|
986
928
|
return this.coreAttributes[attribute];
|
|
987
929
|
}
|
|
988
930
|
get(attribute) {
|
|
989
|
-
if (attribute > 22)
|
|
990
|
-
|
|
991
|
-
if (attribute < 0)
|
|
992
|
-
throw new RangeError("The minimum enum for PedAttribute is 0");
|
|
931
|
+
if (attribute > 22) throw new RangeError("The max enum for PedAttribute is 22");
|
|
932
|
+
if (attribute < 0) throw new RangeError("The minimum enum for PedAttribute is 0");
|
|
993
933
|
return this.pedAttributes[attribute];
|
|
994
934
|
}
|
|
995
935
|
set CoreIcon(status) {
|
|
996
|
-
if (status > 15)
|
|
997
|
-
|
|
998
|
-
if (status < 0)
|
|
999
|
-
throw new RangeError("The minimum enum for StatusEffect is 0");
|
|
936
|
+
if (status > 15) throw new RangeError("The max enum for StatusEffect is 15");
|
|
937
|
+
if (status < 0) throw new RangeError("The minimum enum for StatusEffect is 0");
|
|
1000
938
|
_N("0xA4D3A1C008F250DF", status);
|
|
1001
939
|
}
|
|
1002
940
|
set PeriodicIcon(status) {
|
|
1003
|
-
if (status > 15)
|
|
1004
|
-
|
|
1005
|
-
if (status < 0)
|
|
1006
|
-
throw new RangeError("The minimum enum for StatusEffect is 0");
|
|
941
|
+
if (status > 15) throw new RangeError("The max enum for StatusEffect is 15!");
|
|
942
|
+
if (status < 0) throw new RangeError("The minimum enum for StatusEffect is 0");
|
|
1007
943
|
_N("0xFB6E111908502871", status);
|
|
1008
944
|
}
|
|
1009
945
|
};
|
|
@@ -1022,12 +958,7 @@ var Vehicle = class extends BaseEntity {
|
|
|
1022
958
|
* @returns true of the specified seat is free on the mount
|
|
1023
959
|
*/
|
|
1024
960
|
isSeatFree(seatIndex) {
|
|
1025
|
-
return _N(
|
|
1026
|
-
"0xAAB0FE202E9FC9F0",
|
|
1027
|
-
this.Handle,
|
|
1028
|
-
seatIndex,
|
|
1029
|
-
Citizen.resultAsInteger()
|
|
1030
|
-
);
|
|
961
|
+
return _N("0xAAB0FE202E9FC9F0", this.Handle, seatIndex, Citizen.resultAsInteger());
|
|
1031
962
|
}
|
|
1032
963
|
};
|
|
1033
964
|
|
|
@@ -1130,48 +1061,28 @@ var Ped = class _Ped extends BaseEntity {
|
|
|
1130
1061
|
* @returns the last mount that this ped was on, or null if it doesn't exist
|
|
1131
1062
|
*/
|
|
1132
1063
|
get Mount() {
|
|
1133
|
-
const pedId = _N(
|
|
1134
|
-
"0x4C8B59171957BCF7",
|
|
1135
|
-
this.Handle,
|
|
1136
|
-
Citizen.resultAsInteger()
|
|
1137
|
-
);
|
|
1064
|
+
const pedId = _N("0x4C8B59171957BCF7", this.Handle, Citizen.resultAsInteger());
|
|
1138
1065
|
return pedId ? new _Ped(pedId) : null;
|
|
1139
1066
|
}
|
|
1140
1067
|
/**
|
|
1141
1068
|
* returns the horse that this ped is leading
|
|
1142
1069
|
*/
|
|
1143
1070
|
get LeadingHorse() {
|
|
1144
|
-
const pedId = _N(
|
|
1145
|
-
"0x693126B5D0457D0D",
|
|
1146
|
-
this.Handle,
|
|
1147
|
-
Citizen.resultAsInteger()
|
|
1148
|
-
);
|
|
1071
|
+
const pedId = _N("0x693126B5D0457D0D", this.Handle, Citizen.resultAsInteger());
|
|
1149
1072
|
return pedId ? new _Ped(pedId) : null;
|
|
1150
1073
|
}
|
|
1151
1074
|
/**
|
|
1152
1075
|
* returns the owner of the current animal
|
|
1153
1076
|
*/
|
|
1154
1077
|
get Owner() {
|
|
1155
|
-
const pedId = _N(
|
|
1156
|
-
"0xF103823FFE72BB49",
|
|
1157
|
-
this.Handle,
|
|
1158
|
-
Citizen.resultAsInteger()
|
|
1159
|
-
);
|
|
1078
|
+
const pedId = _N("0xF103823FFE72BB49", this.Handle, Citizen.resultAsInteger());
|
|
1160
1079
|
return pedId ? new _Ped(pedId) : null;
|
|
1161
1080
|
}
|
|
1162
1081
|
get TamingState() {
|
|
1163
|
-
return _N(
|
|
1164
|
-
"0x454AD4DA6C41B5BD",
|
|
1165
|
-
this.Handle,
|
|
1166
|
-
Citizen.resultAsInteger()
|
|
1167
|
-
);
|
|
1082
|
+
return _N("0x454AD4DA6C41B5BD", this.Handle, Citizen.resultAsInteger());
|
|
1168
1083
|
}
|
|
1169
1084
|
get IsInteractingWithAnimal() {
|
|
1170
|
-
return _N(
|
|
1171
|
-
"0x7FC84E85D98F063D",
|
|
1172
|
-
this.Handle,
|
|
1173
|
-
Citizen.resultAsInteger()
|
|
1174
|
-
);
|
|
1085
|
+
return _N("0x7FC84E85D98F063D", this.Handle, Citizen.resultAsInteger());
|
|
1175
1086
|
}
|
|
1176
1087
|
get IsSittingInAnyVehicle() {
|
|
1177
1088
|
return IsPedSittingInAnyVehicle(this.Handle);
|
|
@@ -1195,11 +1106,7 @@ var Ped = class _Ped extends BaseEntity {
|
|
|
1195
1106
|
return IsPedFalling(this.Handle);
|
|
1196
1107
|
}
|
|
1197
1108
|
get IsSliding() {
|
|
1198
|
-
return _N(
|
|
1199
|
-
"0xD6740E14E4CEFC0B",
|
|
1200
|
-
this.Handle,
|
|
1201
|
-
Citizen.resultAsInteger()
|
|
1202
|
-
);
|
|
1109
|
+
return _N("0xD6740E14E4CEFC0B", this.Handle, Citizen.resultAsInteger());
|
|
1203
1110
|
}
|
|
1204
1111
|
get IsJumping() {
|
|
1205
1112
|
return IsPedJumping(this.Handle);
|
|
@@ -1208,11 +1115,7 @@ var Ped = class _Ped extends BaseEntity {
|
|
|
1208
1115
|
return IsPedClimbing(this.Handle);
|
|
1209
1116
|
}
|
|
1210
1117
|
get IsClimbingLadder() {
|
|
1211
|
-
return _N(
|
|
1212
|
-
"0x59643424B68D52B5",
|
|
1213
|
-
this.Handle,
|
|
1214
|
-
Citizen.resultAsInteger()
|
|
1215
|
-
);
|
|
1118
|
+
return _N("0x59643424B68D52B5", this.Handle, Citizen.resultAsInteger());
|
|
1216
1119
|
}
|
|
1217
1120
|
get IsVaulting() {
|
|
1218
1121
|
return IsPedVaulting(this.Handle);
|
|
@@ -1242,38 +1145,22 @@ var Ped = class _Ped extends BaseEntity {
|
|
|
1242
1145
|
return IsPedBeingJacked(this.Handle);
|
|
1243
1146
|
}
|
|
1244
1147
|
get IsInCombatRoll() {
|
|
1245
|
-
return _N(
|
|
1246
|
-
"0xC48A9EB0D499B3E5",
|
|
1247
|
-
this.Handle,
|
|
1248
|
-
Citizen.resultAsInteger()
|
|
1249
|
-
);
|
|
1148
|
+
return _N("0xC48A9EB0D499B3E5", this.Handle, Citizen.resultAsInteger());
|
|
1250
1149
|
}
|
|
1251
1150
|
get CrouchMovement() {
|
|
1252
|
-
return _N(
|
|
1253
|
-
"0xD5FE956C70FF370B",
|
|
1254
|
-
this.Handle,
|
|
1255
|
-
Citizen.resultAsInteger()
|
|
1256
|
-
);
|
|
1151
|
+
return _N("0xD5FE956C70FF370B", this.Handle, Citizen.resultAsInteger());
|
|
1257
1152
|
}
|
|
1258
1153
|
/**
|
|
1259
1154
|
* returns true if {@link DamageCleanliness} was ever lower than {@link eDamageCleanliness.Good}
|
|
1260
1155
|
*/
|
|
1261
1156
|
get IsDamaged() {
|
|
1262
|
-
return _N(
|
|
1263
|
-
"0x6CFC373008A1EDAF",
|
|
1264
|
-
this.Handle,
|
|
1265
|
-
Citizen.resultAsInteger()
|
|
1266
|
-
);
|
|
1157
|
+
return _N("0x6CFC373008A1EDAF", this.Handle, Citizen.resultAsInteger());
|
|
1267
1158
|
}
|
|
1268
1159
|
set IsDamaged(damaged) {
|
|
1269
1160
|
_N("0xDACE03C65C6666DB", this.Handle, damaged);
|
|
1270
1161
|
}
|
|
1271
1162
|
get DamageCleanliness() {
|
|
1272
|
-
return _N(
|
|
1273
|
-
"0x88EFFED5FE8B0B4A",
|
|
1274
|
-
this.Handle,
|
|
1275
|
-
Citizen.resultAsInteger()
|
|
1276
|
-
);
|
|
1163
|
+
return _N("0x88EFFED5FE8B0B4A", this.Handle, Citizen.resultAsInteger());
|
|
1277
1164
|
}
|
|
1278
1165
|
set DamageCleanliness(cleanliness) {
|
|
1279
1166
|
_N("0x7528720101A807A5", this.Handle, cleanliness);
|
|
@@ -1305,12 +1192,7 @@ var Ped = class _Ped extends BaseEntity {
|
|
|
1305
1192
|
_N("0x931B241409216C1F", this.Handle, animal.Handle, false);
|
|
1306
1193
|
}
|
|
1307
1194
|
isInteractionPossible(animal) {
|
|
1308
|
-
return _N(
|
|
1309
|
-
"0xD543D3A8FDE4F185",
|
|
1310
|
-
this.Handle,
|
|
1311
|
-
animal.Handle,
|
|
1312
|
-
Citizen.resultAsInteger()
|
|
1313
|
-
);
|
|
1195
|
+
return _N("0xD543D3A8FDE4F185", this.Handle, animal.Handle, Citizen.resultAsInteger());
|
|
1314
1196
|
}
|
|
1315
1197
|
isOnVehicle(vehicle) {
|
|
1316
1198
|
return IsPedOnSpecificVehicle(this.Handle, vehicle.Handle);
|
|
@@ -1348,13 +1230,7 @@ var Ped = class _Ped extends BaseEntity {
|
|
|
1348
1230
|
SetEntityHealth(this.Handle, 0, killer ? killer.Handle : 0);
|
|
1349
1231
|
}
|
|
1350
1232
|
damage(amount, boneId = 0, killer) {
|
|
1351
|
-
ApplyDamageToPed(
|
|
1352
|
-
this.Handle,
|
|
1353
|
-
amount,
|
|
1354
|
-
0,
|
|
1355
|
-
boneId,
|
|
1356
|
-
killer ? killer.Handle : 0
|
|
1357
|
-
);
|
|
1233
|
+
ApplyDamageToPed(this.Handle, amount, 0, boneId, killer ? killer.Handle : 0);
|
|
1358
1234
|
}
|
|
1359
1235
|
/**
|
|
1360
1236
|
* this returns a different type then the getter so we can't use set, maybe ts will fix soon (tm)
|
|
@@ -1378,9 +1254,7 @@ var Ped = class _Ped extends BaseEntity {
|
|
|
1378
1254
|
* @returns the cloned ped
|
|
1379
1255
|
*/
|
|
1380
1256
|
clone(network, bScriptHostPed, copyHeadBlend) {
|
|
1381
|
-
return new _Ped(
|
|
1382
|
-
ClonePed(this.Handle, network, bScriptHostPed, copyHeadBlend)
|
|
1383
|
-
);
|
|
1257
|
+
return new _Ped(ClonePed(this.Handle, network, bScriptHostPed, copyHeadBlend));
|
|
1384
1258
|
}
|
|
1385
1259
|
/**
|
|
1386
1260
|
* clones the ped onto the target ped
|
|
@@ -1396,13 +1270,7 @@ var Ped = class _Ped extends BaseEntity {
|
|
|
1396
1270
|
AddArmourToPed(this.Handle, amount);
|
|
1397
1271
|
}
|
|
1398
1272
|
applyDamage(damageAmount, boneId = 0, pedKiller = null) {
|
|
1399
|
-
ApplyDamageToPed(
|
|
1400
|
-
this.Handle,
|
|
1401
|
-
damageAmount,
|
|
1402
|
-
0,
|
|
1403
|
-
boneId,
|
|
1404
|
-
pedKiller ? pedKiller.Handle : 0
|
|
1405
|
-
);
|
|
1273
|
+
ApplyDamageToPed(this.Handle, damageAmount, 0, boneId, pedKiller ? pedKiller.Handle : 0);
|
|
1406
1274
|
}
|
|
1407
1275
|
/**
|
|
1408
1276
|
* @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
|
|
@@ -1449,16 +1317,7 @@ var handleUpgrade = /* @__PURE__ */ __name((name, amount) => {
|
|
|
1449
1317
|
const a2 = new DataView(b1);
|
|
1450
1318
|
const b2 = new ArrayBuffer(8 * 12);
|
|
1451
1319
|
const a3 = new DataView(b2);
|
|
1452
|
-
_N(
|
|
1453
|
-
"0xCB5D11F9508A928D",
|
|
1454
|
-
1,
|
|
1455
|
-
a2,
|
|
1456
|
-
a3,
|
|
1457
|
-
GetHashKey(name),
|
|
1458
|
-
1084182731,
|
|
1459
|
-
amount,
|
|
1460
|
-
752097756
|
|
1461
|
-
);
|
|
1320
|
+
_N("0xCB5D11F9508A928D", 1, a2, a3, GetHashKey(name), 1084182731, amount, 752097756);
|
|
1462
1321
|
}, "handleUpgrade");
|
|
1463
1322
|
var Player = class _Player {
|
|
1464
1323
|
static {
|
|
@@ -2676,17 +2535,7 @@ var Volume = class {
|
|
|
2676
2535
|
);
|
|
2677
2536
|
return;
|
|
2678
2537
|
}
|
|
2679
|
-
this.handle = CreateVolumeCylinder(
|
|
2680
|
-
coord.x,
|
|
2681
|
-
coord.y,
|
|
2682
|
-
coord.z,
|
|
2683
|
-
rot.x,
|
|
2684
|
-
rot.y,
|
|
2685
|
-
rot.z,
|
|
2686
|
-
scale.x,
|
|
2687
|
-
scale.y,
|
|
2688
|
-
scale.z
|
|
2689
|
-
);
|
|
2538
|
+
this.handle = CreateVolumeCylinder(coord.x, coord.y, coord.z, rot.x, rot.y, rot.z, scale.x, scale.y, scale.z);
|
|
2690
2539
|
}
|
|
2691
2540
|
get Handle() {
|
|
2692
2541
|
return this.handle;
|
|
@@ -2893,17 +2742,9 @@ var RelationshipGroup = class {
|
|
|
2893
2742
|
* @param biDirectionally If target group should have same relationship towards this.
|
|
2894
2743
|
*/
|
|
2895
2744
|
setRelationshipBetweenGroups(targetGroup, relationship, biDirectionally = false) {
|
|
2896
|
-
SetRelationshipBetweenGroups(
|
|
2897
|
-
Number(relationship),
|
|
2898
|
-
this.Hash,
|
|
2899
|
-
targetGroup.Hash
|
|
2900
|
-
);
|
|
2745
|
+
SetRelationshipBetweenGroups(Number(relationship), this.Hash, targetGroup.Hash);
|
|
2901
2746
|
if (biDirectionally) {
|
|
2902
|
-
SetRelationshipBetweenGroups(
|
|
2903
|
-
Number(relationship),
|
|
2904
|
-
targetGroup.Hash,
|
|
2905
|
-
this.Hash
|
|
2906
|
-
);
|
|
2747
|
+
SetRelationshipBetweenGroups(Number(relationship), targetGroup.Hash, this.Hash);
|
|
2907
2748
|
}
|
|
2908
2749
|
}
|
|
2909
2750
|
/**
|
|
@@ -2914,17 +2755,9 @@ var RelationshipGroup = class {
|
|
|
2914
2755
|
* @param biDirectionally Whether the target group should also clear the relationship.
|
|
2915
2756
|
*/
|
|
2916
2757
|
clearRelationshipBetweenGroups(targetGroup, relationship, biDirectionally = false) {
|
|
2917
|
-
ClearRelationshipBetweenGroups(
|
|
2918
|
-
Number(relationship),
|
|
2919
|
-
this.Hash,
|
|
2920
|
-
targetGroup.Hash
|
|
2921
|
-
);
|
|
2758
|
+
ClearRelationshipBetweenGroups(Number(relationship), this.Hash, targetGroup.Hash);
|
|
2922
2759
|
if (biDirectionally) {
|
|
2923
|
-
ClearRelationshipBetweenGroups(
|
|
2924
|
-
Number(relationship),
|
|
2925
|
-
targetGroup.Hash,
|
|
2926
|
-
this.Hash
|
|
2927
|
-
);
|
|
2760
|
+
ClearRelationshipBetweenGroups(Number(relationship), targetGroup.Hash, this.Hash);
|
|
2928
2761
|
}
|
|
2929
2762
|
}
|
|
2930
2763
|
/**
|
|
@@ -2956,24 +2789,17 @@ var NetworkedMapEventManager = class {
|
|
|
2956
2789
|
#syncedCalls = /* @__PURE__ */ new Map();
|
|
2957
2790
|
constructor() {
|
|
2958
2791
|
$CLIENT: {
|
|
2959
|
-
RegisterResourceAsEventHandler(
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
(
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
const syncData = data[1];
|
|
2968
|
-
const map = this.#syncedCalls.get(syncName);
|
|
2969
|
-
if (!map) {
|
|
2970
|
-
throw new Error(
|
|
2971
|
-
`Tried to sync changes for a networked map but ${syncName} does't exist.`
|
|
2972
|
-
);
|
|
2973
|
-
}
|
|
2974
|
-
map.handleSync(syncData);
|
|
2792
|
+
RegisterResourceAsEventHandler(`${GlobalData.CurrentResource}:syncChanges`);
|
|
2793
|
+
addRawEventListener(`${GlobalData.CurrentResource}:syncChanges`, (msgpack_data) => {
|
|
2794
|
+
const data = msgpack_unpack(msgpack_data);
|
|
2795
|
+
const syncName = data[0];
|
|
2796
|
+
const syncData = data[1];
|
|
2797
|
+
const map = this.#syncedCalls.get(syncName);
|
|
2798
|
+
if (!map) {
|
|
2799
|
+
throw new Error(`Tried to sync changes for a networked map but ${syncName} does't exist.`);
|
|
2975
2800
|
}
|
|
2976
|
-
|
|
2801
|
+
map.handleSync(syncData);
|
|
2802
|
+
});
|
|
2977
2803
|
}
|
|
2978
2804
|
}
|
|
2979
2805
|
addNetworkedMap(map) {
|
|
@@ -3057,11 +2883,7 @@ var Command = class {
|
|
|
3057
2883
|
this.params = params;
|
|
3058
2884
|
this.#handler = handler;
|
|
3059
2885
|
this.name = `/${name}`;
|
|
3060
|
-
registerCommand(
|
|
3061
|
-
name,
|
|
3062
|
-
(source2, args, raw) => this.call(source2, args, raw),
|
|
3063
|
-
restricted
|
|
3064
|
-
);
|
|
2886
|
+
registerCommand(name, (source2, args, raw) => this.call(source2, args, raw), restricted);
|
|
3065
2887
|
if (params) {
|
|
3066
2888
|
for (const parameter of params) {
|
|
3067
2889
|
if (parameter.type) {
|
|
@@ -3098,8 +2920,7 @@ var Command = class {
|
|
|
3098
2920
|
case "playerId":
|
|
3099
2921
|
$CLIENT: {
|
|
3100
2922
|
value = arg === "me" ? GetPlayerServerId(PlayerId()) : +arg;
|
|
3101
|
-
if (!value || GetPlayerFromServerId(value) === -1)
|
|
3102
|
-
value = void 0;
|
|
2923
|
+
if (!value || GetPlayerFromServerId(value) === -1) value = void 0;
|
|
3103
2924
|
}
|
|
3104
2925
|
break;
|
|
3105
2926
|
case "longString":
|
|
@@ -3122,10 +2943,8 @@ var Command = class {
|
|
|
3122
2943
|
try {
|
|
3123
2944
|
await this.#handler(parsed);
|
|
3124
2945
|
} catch (err) {
|
|
3125
|
-
Citizen.trace(
|
|
3126
|
-
|
|
3127
|
-
${err.message}`
|
|
3128
|
-
);
|
|
2946
|
+
Citizen.trace(`^1command '${raw.split(" ")[0] || raw}' failed to execute!^0
|
|
2947
|
+
${err.message}`);
|
|
3129
2948
|
}
|
|
3130
2949
|
}
|
|
3131
2950
|
};
|