pma-locals 1.0.0

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/dist/client.js ADDED
@@ -0,0 +1,2903 @@
1
+ (() => {
2
+ var __defProp = Object.defineProperty;
3
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
6
+
7
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/common/utils/Delay.js
8
+ var __defProp2 = Object.defineProperty;
9
+ var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", { value, configurable: true }), "__name");
10
+ var Delay = /* @__PURE__ */ __name2((ms) => new Promise((res) => setTimeout(res, ms)), "Delay");
11
+
12
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/common/utils/ClassTypes.js
13
+ var ClassTypes = /* @__PURE__ */ ((ClassTypes2) => {
14
+ ClassTypes2[ClassTypes2["Ped"] = 0] = "Ped";
15
+ ClassTypes2[ClassTypes2["Prop"] = 1] = "Prop";
16
+ ClassTypes2[ClassTypes2["Vehicle"] = 2] = "Vehicle";
17
+ ClassTypes2[ClassTypes2["Entity"] = 3] = "Entity";
18
+ ClassTypes2[ClassTypes2["Player"] = 4] = "Player";
19
+ ClassTypes2[ClassTypes2["Vector2"] = 5] = "Vector2";
20
+ ClassTypes2[ClassTypes2["Vector3"] = 6] = "Vector3";
21
+ ClassTypes2[ClassTypes2["Vector4"] = 7] = "Vector4";
22
+ ClassTypes2[ClassTypes2["Quanterion"] = 8] = "Quanterion";
23
+ return ClassTypes2;
24
+ })(ClassTypes || {});
25
+
26
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/common/utils/Vector.js
27
+ var __defProp3 = Object.defineProperty;
28
+ var __name3 = /* @__PURE__ */ __name((target, value) => __defProp3(target, "name", { value, configurable: true }), "__name");
29
+ var EXT_VECTOR2 = 20;
30
+ var EXT_VECTOR3 = 21;
31
+ var EXT_VECTOR4 = 22;
32
+ var size = /* @__PURE__ */ Symbol("size");
33
+ var _a;
34
+ var _Vector = class _Vector {
35
+ /**
36
+ * Constructs a new vector.
37
+ * @param x The x-component of the vector.
38
+ * @param y The y-component of the vector (optional, defaults to x).
39
+ * @param z The z-component of the vector (optional).
40
+ * @param w The w-component of the vector (optional).
41
+ */
42
+ constructor(x, y = x, z, w) {
43
+ __publicField(this, "type");
44
+ __publicField(this, _a, 2);
45
+ __publicField(this, "x", 0);
46
+ __publicField(this, "y", 0);
47
+ __publicField(this, "z");
48
+ __publicField(this, "w");
49
+ for (let i = 0; i < arguments.length; i++) {
50
+ if (typeof arguments[i] !== "number") {
51
+ throw new TypeError(
52
+ `${this.constructor.name} argument at index ${i} must be a number, but got ${typeof arguments[i]}`
53
+ );
54
+ }
55
+ }
56
+ this.x = x;
57
+ this.y = y;
58
+ }
59
+ static create(x, y = x, z, w) {
60
+ if (typeof x === "object") ({ x, y, z, w } = x);
61
+ const size2 = this instanceof _Vector && this.size || [x, y, z, w].filter((arg) => arg !== void 0).length;
62
+ switch (size2) {
63
+ case 1:
64
+ case 2:
65
+ return new Vector2(x, y);
66
+ case 3:
67
+ return new Vector3(x, y, z);
68
+ case 4:
69
+ return new Vector4(x, y, z, w);
70
+ default:
71
+ throw new Error(`Cannot instantiate Vector with size of ${size2}.`);
72
+ }
73
+ }
74
+ /**
75
+ * Creates a deep copy of the provided vector.
76
+ * @param obj The vector to clone.
77
+ * @returns A new vector instance that is a copy of the provided vector.
78
+ */
79
+ static clone(obj) {
80
+ return this.create(obj);
81
+ }
82
+ /**
83
+ * Creates a vector from binary data in a MsgpackBuffer.
84
+ * @param msgpackBuffer The buffer containing binary data.
85
+ * @returns A new vector instance.
86
+ */
87
+ static fromBuffer({ buffer, type }) {
88
+ if (type !== EXT_VECTOR2 && type !== EXT_VECTOR3 && type !== EXT_VECTOR4)
89
+ throw new Error("Buffer type is not a valid Vector.");
90
+ const arr = new Array(buffer.length / 4);
91
+ for (let i = 0; i < arr.length; i++) arr[i] = Number(buffer.readFloatLE(i * 4).toPrecision(7));
92
+ return this.fromArray(arr);
93
+ }
94
+ /**
95
+ * Performs an operation between a vector and either another vector or scalar value.
96
+ * @param a - The first vector.
97
+ * @param b - The second vector or scalar value.
98
+ * @param operator - The function defining the operation to perform.
99
+ * @returns A new vector resulting from the operation.
100
+ */
101
+ static operate(a, b, operator) {
102
+ let { x, y, z, w } = a;
103
+ const isNumber = typeof b === "number";
104
+ x = operator(x, isNumber ? b : b.x ?? 0);
105
+ y = operator(y, isNumber ? b : b.y ?? 0);
106
+ if (z !== void 0) z = operator(z, isNumber ? b : b.z ?? 0);
107
+ if (w !== void 0) w = operator(w, isNumber ? b : b.w ?? 0);
108
+ return this.create(x, y, z, w);
109
+ }
110
+ /**
111
+ * Adds two vectors or a scalar value to a vector.
112
+ * @param a - The first vector or scalar value.
113
+ * @param b - The second vector or scalar value.
114
+ * @returns A new vector with incremented components.
115
+ */
116
+ static add(a, b) {
117
+ return this.operate(a, b, (x, y) => x + y);
118
+ }
119
+ /**
120
+ * Adds a scalar value to the x-component of a vector.
121
+ * @param obj - The vector.
122
+ * @param x - The value to add to the x-component.
123
+ * @returns A new vector with the x-component incremented.
124
+ */
125
+ static addX(obj, x) {
126
+ return this.create(obj.x + x, obj.y, obj.z, obj.w);
127
+ }
128
+ /**
129
+ * Adds a scalar value to the y-component of a vector.
130
+ * @param obj - The vector.
131
+ * @param y - The value to add to the y-component.
132
+ * @returns A new vector with the y-component incremented.
133
+ */
134
+ static addY(obj, y) {
135
+ return this.create(obj.x, obj.y + y, obj.z, obj.w);
136
+ }
137
+ /**
138
+ * Adds a scalar value to the z-component of a vector.
139
+ * @param obj - The vector.
140
+ * @param z - The value to add to the z-component.
141
+ * @returns A new vector with the z-component incremented.
142
+ */
143
+ static addZ(obj, z) {
144
+ return this.create(obj.x, obj.y, obj.z + z, obj.w);
145
+ }
146
+ /**
147
+ * Adds a scalar value to the w-component of a vector.
148
+ * @param obj - The vector.
149
+ * @param w - The value to add to the w-component.
150
+ * @returns A new vector with the w-component incremented.
151
+ */
152
+ static addW(obj, w) {
153
+ return this.create(obj.x, obj.y, obj.z, obj.w + w);
154
+ }
155
+ /**
156
+ * Subtracts one vector from another or subtracts a scalar value from a vector.
157
+ * @param a - The vector.
158
+ * @param b - The second vector or scalar value.
159
+ * @returns A new vector with subtracted components.
160
+ */
161
+ static subtract(a, b) {
162
+ return this.operate(a, b, (x, y) => x - y);
163
+ }
164
+ /**
165
+ * Multiplies two vectors by their components, or multiplies a vector by a scalar value.
166
+ * @param a - The vector.
167
+ * @param b - The second vector or scalar value.
168
+ * @returns A new vector with multiplied components.
169
+ */
170
+ static multiply(a, b) {
171
+ return this.operate(a, b, (x, y) => x * y);
172
+ }
173
+ /**
174
+ * Divides two vectors by their components, or divides a vector by a scalar value.
175
+ * @param a - The vector.
176
+ * @param b - The second vector or scalar vector.
177
+ * @returns A new vector with divided components.
178
+ */
179
+ static divide(a, b) {
180
+ return this.operate(a, b, (x, y) => x / y);
181
+ }
182
+ /**
183
+ * Performs an operation between a vector and either another vector or scalar value converting the vector into absolute values.
184
+ * @param a - The first vector.
185
+ * @param b - The second vector or scalar value.
186
+ * @param operator - The function defining the operation to perform.
187
+ * @returns A new vector resulting from the operation.
188
+ */
189
+ static operateAbsolute(a, b, operator) {
190
+ let { x, y, z, w } = a;
191
+ const isNumber = typeof b === "number";
192
+ x = operator(Math.abs(x), isNumber ? b : Math.abs(b.x ?? 0));
193
+ y = operator(Math.abs(y), isNumber ? b : Math.abs(b.y ?? 0));
194
+ if (z !== void 0) z = operator(Math.abs(z), isNumber ? b : Math.abs(b.z ?? 0));
195
+ if (w !== void 0) w = operator(Math.abs(w), isNumber ? b : Math.abs(b.w ?? 0));
196
+ return this.create(x, y, z, w);
197
+ }
198
+ /**
199
+ * Adds two vectors or a scalar value to a vector.
200
+ * @param a - The first vector or scalar value.
201
+ * @param b - The second vector or scalar value.
202
+ * @returns A new vector with incremented components.
203
+ */
204
+ static addAbsolute(a, b) {
205
+ return this.operateAbsolute(a, b, (x, y) => x + y);
206
+ }
207
+ /**
208
+ * Subtracts one vector from another or subtracts a scalar value from a vector.
209
+ * @param a - The vector.
210
+ * @param b - The second vector or scalar value.
211
+ * @returns A new vector with subtracted components.
212
+ */
213
+ static subtractAbsolute(a, b) {
214
+ return this.operateAbsolute(a, b, (x, y) => x - y);
215
+ }
216
+ /**
217
+ * Multiplies two vectors by their components, or multiplies a vector by a scalar value.
218
+ * @param a - The vector.
219
+ * @param b - The second vector or scalar value.
220
+ * @returns A new vector with multiplied components.
221
+ */
222
+ static multiplyAbsolute(a, b) {
223
+ return this.operateAbsolute(a, b, (x, y) => x * y);
224
+ }
225
+ /**
226
+ * Divides two vectors by their components, or divides a vector by a scalar value
227
+ * @param a - The vector.
228
+ * @param b - The second vector or scalar vector.
229
+ * @returns A new vector with divided components.
230
+ */
231
+ static divideAbsolute(a, b) {
232
+ return this.operateAbsolute(a, b, (x, y) => x / y);
233
+ }
234
+ /**
235
+ * Calculates the dot product of two vectors.
236
+ * @param a - The first vector.
237
+ * @param b - The second vector.
238
+ * @returns A scalar value representing the degree of alignment between the input vectors.
239
+ */
240
+ static dotProduct(a, b) {
241
+ let result = 0;
242
+ for (const key of ["x", "y", "z", "w"]) {
243
+ const x = a[key];
244
+ const y = b[key];
245
+ if (!!x && !!y) result += x * y;
246
+ else if (x || y) throw new Error("Vectors must have the same dimensions.");
247
+ }
248
+ return result;
249
+ }
250
+ /**
251
+ * Calculates the cross product of two vectors in three-dimensional space.
252
+ * @param a - The first vector.
253
+ * @param b - The second vector.
254
+ * @returns A new vector perpendicular to both input vectors.
255
+ */
256
+ static crossProduct(a, b) {
257
+ const { x: ax, y: ay, z: az, w: aw } = a;
258
+ const { x: bx, y: by, z: bz } = b;
259
+ if (ax === void 0 || ay === void 0 || az === void 0 || bx === void 0 || by === void 0 || bz === void 0)
260
+ throw new Error("Vector.crossProduct requires two three-dimensional vectors.");
261
+ return this.create(ay * bz - az * by, az * bx - ax * bz, ax * by - ay * bx, aw);
262
+ }
263
+ /**
264
+ * Normalizes a vector, producing a new vector with the same direction but with a magnitude of 1.
265
+ * @param vector - The vector to be normalized.
266
+ * @returns The new normalized vector.
267
+ */
268
+ static normalize(a) {
269
+ const length = a instanceof _Vector ? a.Length : this.Length(a);
270
+ return this.divide(a, length);
271
+ }
272
+ /**
273
+ * Creates a vector from an array of numbers.
274
+ * @param primitive An array of numbers (usually returned by a native).
275
+ */
276
+ static fromArray(primitive) {
277
+ const [x, y, z, w] = primitive;
278
+ return this.create(x, y, z, w);
279
+ }
280
+ /**
281
+ * Creates a vector from an array or object containing vector components.
282
+ * @param primitive The object to use as a vector.
283
+ */
284
+ static fromObject(primitive) {
285
+ if (Array.isArray(primitive)) return this.fromArray(primitive);
286
+ if ("buffer" in primitive) return this.fromBuffer(primitive);
287
+ const { x, y, z, w } = primitive;
288
+ return this.create(x, y, z, w);
289
+ }
290
+ /**
291
+ * Creates an array of vectors from an array of number arrays
292
+ * @param primitives A multi-dimensional array of number arrays
293
+ */
294
+ static fromArrays(primitives) {
295
+ return primitives.map(this.fromArray);
296
+ }
297
+ /**
298
+ * Calculates the length (magnitude) of a vector.
299
+ * @param obj - The vector for which to calculate the length.
300
+ * @returns The magnitude of the vector.
301
+ */
302
+ static Length(obj) {
303
+ let sum = 0;
304
+ for (const key of ["x", "y", "z", "w"]) {
305
+ if (key in obj) {
306
+ const value = obj[key];
307
+ sum += value * value;
308
+ }
309
+ }
310
+ return Math.sqrt(sum);
311
+ }
312
+ *[(_a = size, Symbol.iterator)]() {
313
+ yield this.x;
314
+ yield this.y;
315
+ if (this.z !== void 0) yield this.z;
316
+ if (this.w !== void 0) yield this.w;
317
+ }
318
+ get size() {
319
+ return this[size];
320
+ }
321
+ toString() {
322
+ return `vector${this.size}(${this.toArray().join(", ")})`;
323
+ }
324
+ /**
325
+ * @see Vector.clone
326
+ */
327
+ clone() {
328
+ return _Vector.clone(this);
329
+ }
330
+ /**
331
+ * The product of the Euclidean magnitudes of this and another Vector.
332
+ *
333
+ * @param v Vector to find Euclidean magnitude between.
334
+ * @returns Euclidean magnitude with another vector.
335
+ */
336
+ distanceSquared(v) {
337
+ const w = this.subtract(v);
338
+ return _Vector.dotProduct(w, w);
339
+ }
340
+ /**
341
+ * The distance between two Vectors.
342
+ *
343
+ * @param v Vector to find distance between.
344
+ * @returns Distance between this and another vector.
345
+ */
346
+ distance(v) {
347
+ return Math.sqrt(this.distanceSquared(v));
348
+ }
349
+ /**
350
+ * @see Vector.normalize
351
+ */
352
+ normalize() {
353
+ return _Vector.normalize(this);
354
+ }
355
+ /**
356
+ * @see Vector.dotProduct
357
+ */
358
+ dotProduct(v) {
359
+ return _Vector.dotProduct(this, v);
360
+ }
361
+ /**
362
+ * @see Vector.add
363
+ */
364
+ add(v) {
365
+ return _Vector.add(this, v);
366
+ }
367
+ /**
368
+ * @see Vector.addX
369
+ */
370
+ addX(x) {
371
+ return _Vector.addX(this, x);
372
+ }
373
+ /**
374
+ * @see Vector.addY
375
+ */
376
+ addY(y) {
377
+ return _Vector.addY(this, y);
378
+ }
379
+ /**
380
+ * @see Vector.subtract
381
+ */
382
+ subtract(v) {
383
+ return _Vector.subtract(this, v);
384
+ }
385
+ /**
386
+ * @see Vector.multiply
387
+ */
388
+ multiply(v) {
389
+ return _Vector.multiply(this, v);
390
+ }
391
+ /**
392
+ * @see Vector.divide
393
+ */
394
+ divide(v) {
395
+ return _Vector.divide(this, v);
396
+ }
397
+ /**
398
+ * @see Vector.addAbsolute
399
+ */
400
+ addAbsolute(v) {
401
+ return _Vector.addAbsolute(this, v);
402
+ }
403
+ /**
404
+ * @see Vector.subtractAbsolute
405
+ */
406
+ subtractAbsolute(v) {
407
+ return _Vector.subtractAbsolute(this, v);
408
+ }
409
+ /**
410
+ * @see Vector.multiply
411
+ */
412
+ multiplyAbsolute(v) {
413
+ return _Vector.multiplyAbsolute(this, v);
414
+ }
415
+ /**
416
+ * @see Vector.divide
417
+ */
418
+ divideAbsolute(v) {
419
+ return _Vector.divideAbsolute(this, v);
420
+ }
421
+ /**
422
+ * Converts the vector to an array of its components.
423
+ */
424
+ toArray() {
425
+ return [...this];
426
+ }
427
+ /**
428
+ * Replaces the components of the vector with the components of another vector object.
429
+ * @param v - The object whose components will replace the current vector's components.
430
+ */
431
+ replace(v) {
432
+ for (const key of ["x", "y", "z", "w"]) {
433
+ if (key in this && key in v) this[key] = v[key];
434
+ }
435
+ }
436
+ /**
437
+ * Calculates the length (magnitude) of a vector.
438
+ * @returns The magnitude of the vector.
439
+ */
440
+ get Length() {
441
+ let sum = 0;
442
+ for (const value of this) sum += value * value;
443
+ return Math.sqrt(sum);
444
+ }
445
+ swizzle(components) {
446
+ if (!/^[xyzw]+$/.test(components)) throw new Error(`Invalid key in swizzle components (${components}).`);
447
+ const arr = components.split("").map((char) => this[char] ?? 0);
448
+ return _Vector.create(...arr);
449
+ }
450
+ };
451
+ __name(_Vector, "Vector");
452
+ __name3(_Vector, "Vector");
453
+ var Vector = _Vector;
454
+ var _a2, _b;
455
+ var _Vector2 = class _Vector2 extends (_b = Vector, _a2 = size, _b) {
456
+ /**
457
+ * Constructs a new 2D vector.
458
+ * @param x The x-component of the vector.
459
+ * @param y The y-component of the vector (optional, defaults to x).
460
+ */
461
+ constructor(x, y = x) {
462
+ super(x, y);
463
+ // DO NOT USE, ONLY EXPOSED BECAUSE TS IS TRASH, THIS TYPE IS NOT GUARANTEED
464
+ // TO EXIST, CHANGING IT WILL BREAK STUFF
465
+ __publicField(this, "type", ClassTypes.Vector2);
466
+ __publicField(this, _a2, 2);
467
+ }
468
+ /**
469
+ * Creates a new vector based on the provided parameters.
470
+ * @param x The x-component of the vector.
471
+ * @param y The y-component of the vector (optional, defaults to the value of x).
472
+ * @returns A new vector instance.
473
+ */
474
+ static create(x, y = x) {
475
+ if (typeof x === "object") ({ x, y } = x);
476
+ return new this(x, y);
477
+ }
478
+ };
479
+ __name(_Vector2, "Vector2");
480
+ __name3(_Vector2, "Vector2");
481
+ __publicField(_Vector2, "Zero", new _Vector2(0, 0));
482
+ var Vector2 = _Vector2;
483
+ var _a3, _b2;
484
+ var _Vector3 = class _Vector3 extends (_b2 = Vector, _a3 = size, _b2) {
485
+ /**
486
+ * Constructs a new 3D vector.
487
+ * @param x The x-component of the vector.
488
+ * @param y The y-component of the vector (optional, defaults to x).
489
+ * @param z The z-component of the vector (optional, defaults to y).
490
+ */
491
+ constructor(x, y = x, z = y) {
492
+ super(x, y, z);
493
+ // DO NOT USE, ONLY EXPOSED BECAUSE TS IS TRASH, THIS TYPE IS NOT GUARANTEED
494
+ // TO EXIST, CHANGING IT WILL BREAK STUFF
495
+ __publicField(this, "type", ClassTypes.Vector3);
496
+ __publicField(this, _a3, 3);
497
+ __publicField(this, "z", 0);
498
+ this.z = z;
499
+ }
500
+ /**
501
+ * Creates a new vector based on the provided parameters.
502
+ * @param x The x-component of the vector.
503
+ * @param y The y-component of the vector (optional, defaults to the value of x).
504
+ * @param z The z-component of the vector (optional, defaults to the value of y).
505
+ * @returns A new vector instance.
506
+ */
507
+ static create(x, y = x, z = y) {
508
+ if (typeof x === "object") ({ x, y, z = y } = x);
509
+ return new this(x, y, z);
510
+ }
511
+ /**
512
+ * @see Vector.addZ
513
+ */
514
+ addZ(z) {
515
+ return Vector.addZ(this, z);
516
+ }
517
+ /**
518
+ * @see Vector.crossProduct
519
+ */
520
+ crossProduct(v) {
521
+ return Vector.crossProduct(this, v);
522
+ }
523
+ /**
524
+ * @returns the x and y values as Vec2
525
+ */
526
+ toVec2() {
527
+ return new Vector2(this.x, this.y);
528
+ }
529
+ };
530
+ __name(_Vector3, "Vector3");
531
+ __name3(_Vector3, "Vector3");
532
+ __publicField(_Vector3, "Zero", new _Vector3(0, 0, 0));
533
+ __publicField(_Vector3, "UnitX", new _Vector3(1, 0, 0));
534
+ __publicField(_Vector3, "UnitY", new _Vector3(0, 1, 0));
535
+ __publicField(_Vector3, "UnitZ", new _Vector3(0, 0, 1));
536
+ __publicField(_Vector3, "One", new _Vector3(1, 1, 1));
537
+ __publicField(_Vector3, "Up", new _Vector3(0, 0, 1));
538
+ __publicField(_Vector3, "Down", new _Vector3(0, 0, -1));
539
+ __publicField(_Vector3, "Left", new _Vector3(-1, 0, 0));
540
+ __publicField(_Vector3, "Right", new _Vector3(1, 0, 0));
541
+ __publicField(_Vector3, "ForwardRH", new _Vector3(0, 1, 0));
542
+ __publicField(_Vector3, "ForwardLH", new _Vector3(0, -1, 0));
543
+ __publicField(_Vector3, "BackwardRH", new _Vector3(0, -1, 0));
544
+ __publicField(_Vector3, "BackwardLH", new _Vector3(0, 1, 0));
545
+ __publicField(_Vector3, "Backward", _Vector3.BackwardRH);
546
+ var Vector3 = _Vector3;
547
+ var _a4, _b3;
548
+ var _Vector4 = class _Vector4 extends (_b3 = Vector, _a4 = size, _b3) {
549
+ /**
550
+ * Constructs a new 4D vector.
551
+ * @param x The x-component of the vector.
552
+ * @param y The y-component of the vector (optional, defaults to x).
553
+ * @param z The z-component of the vector (optional, defaults to y).
554
+ * @param w The w-component of the vector (optional, defaults to z).
555
+ */
556
+ constructor(x, y = x, z = y, w = z) {
557
+ super(x, y, z, w);
558
+ // DO NOT USE, ONLY EXPOSED BECAUSE TS IS TRASH, THIS TYPE IS NOT GUARANTEED
559
+ // TO EXIST, CHANGING IT WILL BREAK STUFF
560
+ __publicField(this, "type", ClassTypes.Vector4);
561
+ __publicField(this, _a4, 4);
562
+ __publicField(this, "z", 0);
563
+ __publicField(this, "w", 0);
564
+ this.z = z;
565
+ this.w = w;
566
+ }
567
+ /**
568
+ * Creates a new vector based on the provided parameters.
569
+ * @param x The x-component of the vector.
570
+ * @param y The y-component of the vector (optional, defaults to the value of x).
571
+ * @param z The z-component of the vector (optional, defaults to the value of y).
572
+ * @param w The w-component of the vector (optional, defaults to the value of z).
573
+ * @returns A new vector instance.
574
+ */
575
+ static create(x, y = x, z = y, w = z) {
576
+ if (typeof x === "object") ({ x, y, z = y, w = z } = x);
577
+ return new this(x, y, z, w);
578
+ }
579
+ /**
580
+ * @see Vector.addZ
581
+ */
582
+ addZ(z) {
583
+ return Vector.addZ(this, z);
584
+ }
585
+ /**
586
+ * @see Vector.addW
587
+ */
588
+ addW(w) {
589
+ return Vector.addW(this, w);
590
+ }
591
+ /**
592
+ * @see Vector.crossProduct
593
+ */
594
+ crossProduct(v) {
595
+ return Vector.crossProduct(this, v);
596
+ }
597
+ /**
598
+ * @returns the x and y values as Vec2
599
+ */
600
+ toVec2() {
601
+ return new Vector2(this.x, this.y);
602
+ }
603
+ /**
604
+ * @returns the x and y values as Vec3
605
+ */
606
+ toVec3() {
607
+ return new Vector3(this.x, this.y, this.z);
608
+ }
609
+ };
610
+ __name(_Vector4, "Vector4");
611
+ __name3(_Vector4, "Vector4");
612
+ __publicField(_Vector4, "Zero", new _Vector4(0, 0, 0, 0));
613
+ var Vector4 = _Vector4;
614
+
615
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/Model.js
616
+ var __defProp4 = Object.defineProperty;
617
+ var __name4 = /* @__PURE__ */ __name((target, value) => __defProp4(target, "name", { value, configurable: true }), "__name");
618
+ var _Model = class _Model {
619
+ /**
620
+ * Creates a model object based on the hash key or model string.
621
+ *
622
+ * @param hash A number or string of the model's hash. Example: "mp_m_freemode_01"
623
+ */
624
+ constructor(hash) {
625
+ /**
626
+ * Hash of this model.
627
+ */
628
+ __publicField(this, "hash");
629
+ __publicField(this, "requestCount", 0);
630
+ if (typeof hash === "string") {
631
+ this.hash = GetHashKey(hash);
632
+ } else {
633
+ this.hash = hash;
634
+ }
635
+ }
636
+ /**
637
+ * Returns the amount of times this model has been requested from the client, useful for finding situations where the client fails to release the ref
638
+ */
639
+ get RequestCount() {
640
+ return this.requestCount;
641
+ }
642
+ [Symbol.dispose]() {
643
+ if (this.requestCount > 0) {
644
+ this.markAsNoLongerNeeded();
645
+ }
646
+ }
647
+ /**
648
+ * Gets the hash of the model.
649
+ *
650
+ * @returns The hash key.
651
+ */
652
+ get Hash() {
653
+ return this.hash;
654
+ }
655
+ /**
656
+ * Gets if the model is valid or not.
657
+ *
658
+ * @returns Whether this model is valid.
659
+ */
660
+ get IsValid() {
661
+ return IsModelValid(this.hash);
662
+ }
663
+ /**
664
+ * Gets if the model is in cd image or not.
665
+ *
666
+ * @returns Whether this model is in cd image.
667
+ */
668
+ get IsInCdImage() {
669
+ return IsModelInCdimage(this.hash);
670
+ }
671
+ /**
672
+ * Gets if the model is loaded or not.
673
+ *
674
+ * @returns Whether this model is loaded.
675
+ */
676
+ get IsLoaded() {
677
+ if (this.IsWeapon) {
678
+ return Citizen.invokeNative("0xFF07CF465F48B830", this.hash);
679
+ }
680
+ return HasModelLoaded(this.hash);
681
+ }
682
+ /**
683
+ * Gets if the model collision is loaded or not.
684
+ *
685
+ * @returns Whether this model collision is loaded.
686
+ */
687
+ get IsCollisionLoaded() {
688
+ return HasCollisionForModelLoaded(this.hash);
689
+ }
690
+ /**
691
+ * Gets if the model is a boat or not.
692
+ *
693
+ * @returns Whether this model is a boat.
694
+ */
695
+ get IsBoat() {
696
+ return IsThisModelABoat(this.hash);
697
+ }
698
+ /**
699
+ * Gets if the model is a Ped or not.
700
+ *
701
+ * @returns Whether this model is a Ped.
702
+ */
703
+ get IsPed() {
704
+ return IsModelAPed(this.hash);
705
+ }
706
+ /**
707
+ * Gets if the model is a prop or not.
708
+ *
709
+ * @returns Whether this model is a prop.
710
+ */
711
+ get IsProp() {
712
+ return this.IsValid && !this.IsPed && !this.IsVehicle && !this.IsWeapon;
713
+ }
714
+ /**
715
+ * Gets if the model is a train or not.
716
+ *
717
+ * @returns Whether this model is a train.
718
+ */
719
+ get IsTrain() {
720
+ return IsThisModelATrain(this.hash);
721
+ }
722
+ /**
723
+ * Gets if the model is a Vehicle or not.
724
+ *
725
+ * @returns Whether this model is a Vehicle.
726
+ */
727
+ get IsVehicle() {
728
+ return IsModelAVehicle(this.hash);
729
+ }
730
+ get IsWeapon() {
731
+ return IsWeaponValid(this.hash);
732
+ }
733
+ /**
734
+ * Gets the model dimensions.
735
+ *
736
+ * @returns This model min & max dimensions.
737
+ */
738
+ get Dimensions() {
739
+ const [minArray, maxArray] = GetModelDimensions(this.hash);
740
+ const min = Vector3.fromArray(minArray);
741
+ const max = Vector3.fromArray(maxArray);
742
+ return { min, max };
743
+ }
744
+ // TODO: Metaped stuff too at some point
745
+ requestModel() {
746
+ RequestModel(this.hash, false);
747
+ this.requestCount++;
748
+ }
749
+ /**
750
+ * Request and load the model with a specified timeout. Default timeout is 1000 (recommended).
751
+ * This function will not automatically set the model as no longer needed when
752
+ * done.
753
+ *
754
+ * @param timeoutMs Maximum allowed time for model to load.
755
+ */
756
+ async request(timeoutMs = 1e3) {
757
+ if (!this.IsInCdImage && !this.IsValid && !this.IsWeapon) {
758
+ return false;
759
+ }
760
+ if (this.IsLoaded) {
761
+ return true;
762
+ }
763
+ this.requestModel();
764
+ const timeout = GetGameTimer() + timeoutMs;
765
+ while (!this.IsLoaded && GetGameTimer() < timeout) {
766
+ await Delay(0);
767
+ }
768
+ if (!this.IsLoaded) {
769
+ this.markAsNoLongerNeeded();
770
+ }
771
+ return this.IsLoaded;
772
+ }
773
+ /**
774
+ * Sets the model as no longer needed allowing the game engine to free memory.
775
+ */
776
+ markAsNoLongerNeeded() {
777
+ SetModelAsNoLongerNeeded(this.hash);
778
+ }
779
+ };
780
+ __name(_Model, "Model");
781
+ __name4(_Model, "Model");
782
+ var Model = _Model;
783
+
784
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/utils/Native.js
785
+ var __defProp5 = Object.defineProperty;
786
+ var __name5 = /* @__PURE__ */ __name((target, value) => __defProp5(target, "name", { value, configurable: true }), "__name");
787
+ var _N = /* @__PURE__ */ __name5((hash, ...args) => {
788
+ return Citizen.invokeNative(hash, ...args);
789
+ }, "_N");
790
+
791
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/Attribute.js
792
+ var __defProp6 = Object.defineProperty;
793
+ var __name6 = /* @__PURE__ */ __name((target, value) => __defProp6(target, "name", { value, configurable: true }), "__name");
794
+ var _CoreAttribute = class _CoreAttribute {
795
+ constructor(ped, attribute) {
796
+ __publicField(this, "handle");
797
+ __publicField(this, "attribute");
798
+ this.handle = ped.Handle;
799
+ this.attribute = attribute;
800
+ }
801
+ /**
802
+ * This doesn't seem to actually do anything
803
+ * @todo maybe remove unless theres a valid use case
804
+ * @param amount
805
+ * @param makeSound
806
+ */
807
+ enableOverpower(amount, makeSound = false) {
808
+ _N("0x4AF5A4C7B9157D14", this.handle, this.attribute, amount, makeSound);
809
+ }
810
+ get Overpowered() {
811
+ return _N("0x200373A8DF081F22", this.attribute, Citizen.resultAsInteger());
812
+ }
813
+ /**
814
+ * @returns the amount of overpower time left in seconds
815
+ */
816
+ get OverpoweredTimeLeft() {
817
+ return _N("0xB429F58803D285B1", this.handle, this.attribute, Citizen.resultAsInteger());
818
+ }
819
+ /**
820
+ * Returns how full the core is
821
+ */
822
+ get CoreValue() {
823
+ return GetAttributeCoreValue(this.handle, this.attribute);
824
+ }
825
+ set CoreValue(amount) {
826
+ _N("0xC6258F41D86676E0", this.handle, this.attribute, amount);
827
+ }
828
+ };
829
+ __name(_CoreAttribute, "CoreAttribute");
830
+ __name6(_CoreAttribute, "CoreAttribute");
831
+ var CoreAttribute = _CoreAttribute;
832
+ var _PedAttribute = class _PedAttribute {
833
+ constructor(ped, attribute) {
834
+ __publicField(this, "handle");
835
+ __publicField(this, "attribute");
836
+ this.handle = ped.Handle;
837
+ this.attribute = attribute;
838
+ }
839
+ /**
840
+ *
841
+ * @param amount the amount of points to add to the attribute
842
+ */
843
+ addPoints(amount) {
844
+ AddAttributePoints(this.handle, this.attribute, amount);
845
+ }
846
+ /**
847
+ * Disables the overpower state on this attribute, see {@link enableOverpower} on how to enable
848
+ */
849
+ disableOverpower() {
850
+ DisableAttributeOverpower(this.handle, this.attribute);
851
+ }
852
+ /**
853
+ *
854
+ * @param amount the amount to overpower this attribute by
855
+ * @param makeSound if activating the overpower should play sound
856
+ */
857
+ enableOverpower(amount, makeSound = false) {
858
+ _N("0xF6A7C08DF2E28B28", this.handle, this.attribute, amount, makeSound);
859
+ }
860
+ /**
861
+ * Gets the amount of attribute points the ped has
862
+ */
863
+ get Points() {
864
+ return GetAttributePoints(this.handle, this.attribute);
865
+ }
866
+ set Points(amount) {
867
+ SetAttributePoints(this.handle, this.attribute, amount);
868
+ }
869
+ get Rank() {
870
+ return GetAttributeRank(this.handle, this.attribute);
871
+ }
872
+ set BaseRank(amount) {
873
+ SetAttributeBaseRank(this.handle, this.attribute, amount);
874
+ }
875
+ get BaseRank() {
876
+ return GetAttributeBaseRank(this.handle, this.attribute);
877
+ }
878
+ set BonusRank(amount) {
879
+ SetAttributeBonusRank(this.handle, this.attribute, amount);
880
+ }
881
+ get BonusRank() {
882
+ return GetAttributeBonusRank(this.handle, this.attribute);
883
+ }
884
+ get MaxRank() {
885
+ return _N("0x704674A0535A471D", this.attribute, Citizen.resultAsInteger());
886
+ }
887
+ get Overpowered() {
888
+ return _N("0x103C2F885ABEB00B", this.attribute, Citizen.resultAsInteger());
889
+ }
890
+ };
891
+ __name(_PedAttribute, "PedAttribute");
892
+ __name6(_PedAttribute, "PedAttribute");
893
+ var PedAttribute = _PedAttribute;
894
+ var _Attributes = class _Attributes {
895
+ constructor(ped) {
896
+ __publicField(this, "pedAttributes", []);
897
+ __publicField(this, "coreAttributes", []);
898
+ for (let i = 0; i <= 21; i++) {
899
+ this.pedAttributes[i] = new PedAttribute(ped, i);
900
+ }
901
+ for (let i = 0; i <= 2; i++) {
902
+ this.coreAttributes[i] = new CoreAttribute(ped, i);
903
+ }
904
+ }
905
+ getCore(attribute) {
906
+ if (attribute > 2) throw new RangeError("The max enum for CoreAttribute is 2");
907
+ if (attribute < 0) throw new RangeError("The minimum enum for CoreAttribute is 0");
908
+ return this.coreAttributes[attribute];
909
+ }
910
+ get(attribute) {
911
+ if (attribute > 22) throw new RangeError("The max enum for PedAttribute is 22");
912
+ if (attribute < 0) throw new RangeError("The minimum enum for PedAttribute is 0");
913
+ return this.pedAttributes[attribute];
914
+ }
915
+ set CoreIcon(status) {
916
+ if (status > 15) throw new RangeError("The max enum for StatusEffect is 15");
917
+ if (status < 0) throw new RangeError("The minimum enum for StatusEffect is 0");
918
+ _N("0xA4D3A1C008F250DF", status);
919
+ }
920
+ set PeriodicIcon(status) {
921
+ if (status > 15) throw new RangeError("The max enum for StatusEffect is 15!");
922
+ if (status < 0) throw new RangeError("The minimum enum for StatusEffect is 0");
923
+ _N("0xFB6E111908502871", status);
924
+ }
925
+ };
926
+ __name(_Attributes, "Attributes");
927
+ __name6(_Attributes, "Attributes");
928
+ var Attributes = _Attributes;
929
+
930
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/common-game/cfx/cfx.js
931
+ var cfx_default = { Entity, Player };
932
+
933
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/common-game/CommonModel.js
934
+ var __defProp7 = Object.defineProperty;
935
+ var __name7 = /* @__PURE__ */ __name((target, value) => __defProp7(target, "name", { value, configurable: true }), "__name");
936
+ var _CommonModel = class _CommonModel {
937
+ /**
938
+ * Creates a model object based on the hash key or model string.
939
+ *
940
+ * @param hash A number or string of the model's hash. Example: "mp_m_freemode_01"
941
+ */
942
+ constructor(hash) {
943
+ /**
944
+ * Hash of this model.
945
+ */
946
+ __publicField(this, "hash");
947
+ __publicField(this, "requestCount", 0);
948
+ if (typeof hash === "string") {
949
+ this.hash = GetHashKey(hash);
950
+ } else {
951
+ this.hash = hash;
952
+ }
953
+ }
954
+ /**
955
+ * Returns the amount of times this model has been requested from the client, useful for finding situations where the client fails to release the ref
956
+ */
957
+ get RequestCount() {
958
+ return this.requestCount;
959
+ }
960
+ [Symbol.dispose]() {
961
+ if (this.requestCount > 0) {
962
+ this.markAsNoLongerNeeded();
963
+ }
964
+ }
965
+ /**
966
+ * Gets the hash of the model.
967
+ *
968
+ * @returns The hash key.
969
+ */
970
+ get Hash() {
971
+ return this.hash;
972
+ }
973
+ /**
974
+ * Gets if the model is valid or not.
975
+ *
976
+ * @returns Whether this model is valid.
977
+ */
978
+ get IsValid() {
979
+ return IsModelValid(this.hash);
980
+ }
981
+ /**
982
+ * Gets if the model is in cd image or not.
983
+ *
984
+ * @returns Whether this model is in cd image.
985
+ */
986
+ get IsInCdImage() {
987
+ return IsModelInCdimage(this.hash);
988
+ }
989
+ /**
990
+ * Gets if the model is loaded or not.
991
+ *
992
+ * @returns Whether this model is loaded.
993
+ */
994
+ get IsLoaded() {
995
+ if (this.IsWeapon) {
996
+ return Citizen.invokeNative("0xFF07CF465F48B830", this.hash);
997
+ }
998
+ return HasModelLoaded(this.hash);
999
+ }
1000
+ /**
1001
+ * Gets if the model collision is loaded or not.
1002
+ *
1003
+ * @returns Whether this model collision is loaded.
1004
+ */
1005
+ get IsCollisionLoaded() {
1006
+ return HasCollisionForModelLoaded(this.hash);
1007
+ }
1008
+ /**
1009
+ * Gets if the model is a boat or not.
1010
+ *
1011
+ * @returns Whether this model is a boat.
1012
+ */
1013
+ get IsBoat() {
1014
+ return IsThisModelABoat(this.hash);
1015
+ }
1016
+ /**
1017
+ * Gets if the model is a Ped or not.
1018
+ *
1019
+ * @returns Whether this model is a Ped.
1020
+ */
1021
+ get IsPed() {
1022
+ return IsModelAPed(this.hash);
1023
+ }
1024
+ /**
1025
+ * Gets if the model is a prop or not.
1026
+ *
1027
+ * @returns Whether this model is a prop.
1028
+ */
1029
+ get IsProp() {
1030
+ return this.IsValid && !this.IsPed && !this.IsVehicle && !this.IsWeapon;
1031
+ }
1032
+ /**
1033
+ * Gets if the model is a train or not.
1034
+ *
1035
+ * @returns Whether this model is a train.
1036
+ */
1037
+ get IsTrain() {
1038
+ return IsThisModelATrain(this.hash);
1039
+ }
1040
+ /**
1041
+ * Gets if the model is a Vehicle or not.
1042
+ *
1043
+ * @returns Whether this model is a Vehicle.
1044
+ */
1045
+ get IsVehicle() {
1046
+ return IsModelAVehicle(this.hash);
1047
+ }
1048
+ get IsWeapon() {
1049
+ return IsWeaponValid(this.hash);
1050
+ }
1051
+ /**
1052
+ * Gets the model dimensions.
1053
+ *
1054
+ * @returns This model min & max dimensions.
1055
+ */
1056
+ get Dimensions() {
1057
+ const [minArray, maxArray] = GetModelDimensions(this.hash);
1058
+ const min = Vector3.fromArray(minArray);
1059
+ const max = Vector3.fromArray(maxArray);
1060
+ return { min, max };
1061
+ }
1062
+ // TODO: Metaped stuff too at some point
1063
+ requestModel() {
1064
+ RequestModel(this.hash, false);
1065
+ this.requestCount++;
1066
+ }
1067
+ /**
1068
+ * Request and load the model with a specified timeout. Default timeout is 1000 (recommended).
1069
+ * This function will not automatically set the model as no longer needed when
1070
+ * done.
1071
+ *
1072
+ * @param timeoutMs Maximum allowed time for model to load.
1073
+ */
1074
+ async request(timeoutMs = 1e3) {
1075
+ if (!this.IsInCdImage && !this.IsValid && !this.IsWeapon) {
1076
+ return false;
1077
+ }
1078
+ if (this.IsLoaded) {
1079
+ return true;
1080
+ }
1081
+ this.requestModel();
1082
+ const timeout = GetGameTimer() + timeoutMs;
1083
+ while (!this.IsLoaded && GetGameTimer() < timeout) {
1084
+ await Delay(0);
1085
+ }
1086
+ if (!this.IsLoaded) {
1087
+ this.markAsNoLongerNeeded();
1088
+ }
1089
+ return this.IsLoaded;
1090
+ }
1091
+ /**
1092
+ * Sets the model as no longer needed allowing the game engine to free memory.
1093
+ */
1094
+ markAsNoLongerNeeded() {
1095
+ SetModelAsNoLongerNeeded(this.hash);
1096
+ }
1097
+ };
1098
+ __name(_CommonModel, "CommonModel");
1099
+ __name7(_CommonModel, "CommonModel");
1100
+ var CommonModel = _CommonModel;
1101
+
1102
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/common/GlobalData.js
1103
+ var __defProp8 = Object.defineProperty;
1104
+ var __name8 = /* @__PURE__ */ __name((target, value) => __defProp8(target, "name", { value, configurable: true }), "__name");
1105
+ globalThis.OnError = (type, err) => {
1106
+ };
1107
+ var _GlobalData = class _GlobalData {
1108
+ };
1109
+ __name(_GlobalData, "GlobalData");
1110
+ __name8(_GlobalData, "GlobalData");
1111
+ __publicField(_GlobalData, "CurrentResource", GetCurrentResourceName());
1112
+ __publicField(_GlobalData, "GameName", GetGameName());
1113
+ __publicField(_GlobalData, "GameBuild", GetGameBuildNumber());
1114
+ __publicField(_GlobalData, "IS_SERVER", IsDuplicityVersion());
1115
+ __publicField(_GlobalData, "IS_REDM", GetGameName() === "redm");
1116
+ __publicField(_GlobalData, "IS_FIVEM", GetGameName() === "fivem");
1117
+ __publicField(_GlobalData, "IS_CLIENT", !_GlobalData.IS_SERVER);
1118
+ __publicField(_GlobalData, "NetworkTick", null);
1119
+ __publicField(_GlobalData, "NetworkedTicks", []);
1120
+ __publicField(_GlobalData, "EnablePrettyPrint", true);
1121
+ /*
1122
+ * Called when one of the decors errors
1123
+ */
1124
+ __publicField(_GlobalData, "OnError", /* @__PURE__ */ __name8((type, err) => {
1125
+ globalThis.OnError(type, err);
1126
+ }, "OnError"));
1127
+ var GlobalData = _GlobalData;
1128
+
1129
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/common-game/entities/IHandle.js
1130
+ var __defProp9 = Object.defineProperty;
1131
+ var __name9 = /* @__PURE__ */ __name((target, value) => __defProp9(target, "name", { value, configurable: true }), "__name");
1132
+ var _IHandle = class _IHandle {
1133
+ constructor(handle) {
1134
+ __publicField(this, "handle");
1135
+ this.handle = handle;
1136
+ }
1137
+ exists() {
1138
+ return DoesEntityExist(this.handle);
1139
+ }
1140
+ get Handle() {
1141
+ return this.handle;
1142
+ }
1143
+ };
1144
+ __name(_IHandle, "IHandle");
1145
+ __name9(_IHandle, "IHandle");
1146
+ var IHandle = _IHandle;
1147
+
1148
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/common-game/entities/CommonBaseEntity.js
1149
+ var __defProp10 = Object.defineProperty;
1150
+ var __name10 = /* @__PURE__ */ __name((target, value) => __defProp10(target, "name", { value, configurable: true }), "__name");
1151
+ var _CommonBaseEntity = class _CommonBaseEntity extends IHandle {
1152
+ constructor(handle) {
1153
+ super(handle);
1154
+ __publicField(this, "stateBagCookies", []);
1155
+ __publicField(this, "netId", null);
1156
+ }
1157
+ /**
1158
+ * Replaces the current handle for the entity used on, this should be used sparringly, mainly
1159
+ * in situations where you're going to reuse an entity over and over and don't want to make a
1160
+ * new entity every time.
1161
+ *
1162
+ * **WARNING**: This does no checks, if you provide it an invalid entity it will use it
1163
+ *
1164
+ * ```ts
1165
+ * const REUSABLE_ENTITY = new Entity(entityHandle);
1166
+ *
1167
+ * onNet("entityHandler", (entNetId: number) => {
1168
+ * // if no net entity we should ignore
1169
+ * if (!NetworkDoesEntityExistWithNetworkId(entNetId)) return;
1170
+ *
1171
+ * // Reuse our entity so we don't have to initialize a new one
1172
+ * REUSABLE_ENTITY.replaceHandle(NetworkGetEntityFromNetworkId(entNetId));
1173
+ * // Do something with REUSABLE_ENTITY entity
1174
+ * })
1175
+ ```
1176
+ */
1177
+ replaceHandle(newHandle) {
1178
+ this.handle = newHandle;
1179
+ }
1180
+ /*
1181
+ * @returns `true` if the entity exists, `false` otherwise.
1182
+ */
1183
+ get Exists() {
1184
+ return DoesEntityExist(this.handle);
1185
+ }
1186
+ /*
1187
+ * @returns the handle of the specified entity
1188
+ */
1189
+ get Handle() {
1190
+ return this.handle;
1191
+ }
1192
+ /**
1193
+ * This will return a warning if the the entity is not networked, you should always use {@link IsNetworked} prior to calling thisl
1194
+ * @returns the network for the specified entity
1195
+ */
1196
+ get NetworkId() {
1197
+ return NetworkGetNetworkIdFromEntity(this.handle);
1198
+ }
1199
+ /**
1200
+ * @returns `true` if the current entity is networked, false otherwise
1201
+ */
1202
+ get IsNetworked() {
1203
+ return NetworkGetEntityIsNetworked(this.handle);
1204
+ }
1205
+ set IsNetworked(networked) {
1206
+ if (networked) {
1207
+ NetworkRegisterEntityAsNetworked(this.handle);
1208
+ } else {
1209
+ if (GlobalData.IS_REDM) {
1210
+ Citizen.invokeNative("0xE31A04513237DC89", this.handle);
1211
+ } else {
1212
+ NetworkUnregisterNetworkedEntity(this.handle);
1213
+ }
1214
+ }
1215
+ }
1216
+ get State() {
1217
+ return cfx_default.Entity(this.handle).state;
1218
+ }
1219
+ AddStateBagChangeHandler(keyFilter, handler) {
1220
+ const stateBagName = this.IsNetworked ? `entity:${this.NetworkId}` : `localEntity:${this.handle}`;
1221
+ const cookie = AddStateBagChangeHandler(keyFilter, stateBagName, handler);
1222
+ this.stateBagCookies.push(cookie);
1223
+ return cookie;
1224
+ }
1225
+ /**
1226
+ * A short hand function for AddStateBagChangeHandler, this gets automatically cleaned up on entity deletion.
1227
+ * @param keyFilter the key to filter for or null
1228
+ * @param handler the function to handle the change
1229
+ * @returns a cookie to be used in RemoveStateBagChangeHandler
1230
+ */
1231
+ listenForStateChange(keyFilter, handler) {
1232
+ return this.AddStateBagChangeHandler(keyFilter, handler);
1233
+ }
1234
+ removeStateListener(tgtCookie) {
1235
+ this.stateBagCookies = this.stateBagCookies.filter((cookie) => {
1236
+ const isCookie = cookie === tgtCookie;
1237
+ if (isCookie) RemoveStateBagChangeHandler(cookie);
1238
+ return isCookie;
1239
+ });
1240
+ }
1241
+ get Owner() {
1242
+ return NetworkGetEntityOwner(this.handle);
1243
+ }
1244
+ get Speed() {
1245
+ return GetEntitySpeed(this.handle);
1246
+ }
1247
+ getSpeedVector(isRelative = false) {
1248
+ return Vector3.fromArray(GetEntitySpeedVector(this.handle, isRelative));
1249
+ }
1250
+ get ForwardVector() {
1251
+ return Vector3.fromArray(GetEntityForwardVector(this.handle));
1252
+ }
1253
+ get Matrix() {
1254
+ return Vector3.fromArrays(GetEntityMatrix(this.handle));
1255
+ }
1256
+ get MaxHealth() {
1257
+ return GetEntityMaxHealth(this.handle);
1258
+ }
1259
+ set MaxHealth(amount) {
1260
+ SetEntityMaxHealth(this.handle, amount);
1261
+ }
1262
+ set IsDead(value) {
1263
+ if (value) {
1264
+ SetEntityHealth(this.handle, 0);
1265
+ } else {
1266
+ SetEntityHealth(this.handle, 200);
1267
+ }
1268
+ }
1269
+ /**
1270
+ * @returns Returns true if the entity is dead
1271
+ */
1272
+ get IsDead() {
1273
+ return IsEntityDead(this.handle);
1274
+ }
1275
+ get IsAlive() {
1276
+ return !IsEntityDead(this.handle);
1277
+ }
1278
+ get Model() {
1279
+ return new CommonModel(GetEntityModel(this.handle));
1280
+ }
1281
+ /**
1282
+ * Returns if the entity is set as a mission entity and will not be cleaned up by the engine
1283
+ */
1284
+ get IsMissionEntity() {
1285
+ return IsEntityAMissionEntity(this.handle);
1286
+ }
1287
+ /**
1288
+ * Sets if the entity is a mission entity and will not be cleaned up by the engine
1289
+ */
1290
+ set IsMissionEntity(value) {
1291
+ if (value) {
1292
+ SetEntityAsMissionEntity(this.handle, false, false);
1293
+ } else {
1294
+ SetEntityAsNoLongerNeeded(this.handle);
1295
+ }
1296
+ }
1297
+ set PositionNoOffset(position) {
1298
+ SetEntityCoordsNoOffset(this.handle, position.x, position.y, position.z, true, true, true);
1299
+ }
1300
+ get Rotation() {
1301
+ return Vector3.fromArray(GetEntityRotation(this.handle, 2));
1302
+ }
1303
+ set Rotation(rotation) {
1304
+ SetEntityRotation(this.handle, rotation.x, rotation.y, rotation.z, 2, true);
1305
+ }
1306
+ set Quaternion(quaternion) {
1307
+ SetEntityQuaternion(this.handle, quaternion.x, quaternion.y, quaternion.z, quaternion.w);
1308
+ }
1309
+ get IsPositionFrozen() {
1310
+ return IsEntityPositionFrozen(this.handle);
1311
+ }
1312
+ set IsPositionFrozen(value) {
1313
+ FreezeEntityPosition(this.handle, value);
1314
+ }
1315
+ get Velocity() {
1316
+ return Vector3.fromArray(GetEntityVelocity(this.handle));
1317
+ }
1318
+ set Velocity(velocity) {
1319
+ SetEntityVelocity(this.handle, velocity.x, velocity.y, velocity.z);
1320
+ }
1321
+ get IsVisible() {
1322
+ return IsEntityVisible(this.handle);
1323
+ }
1324
+ /**
1325
+ * @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.
1326
+ */
1327
+ set Health(amount) {
1328
+ SetEntityHealth(this.handle, amount, 0);
1329
+ }
1330
+ /**
1331
+ * @returns the amount of health the current {@link BaseEntity} has
1332
+ */
1333
+ get Health() {
1334
+ return GetEntityHealth(this.handle);
1335
+ }
1336
+ /**
1337
+ * @returns the heading of the current {@link BaseEntity}
1338
+ */
1339
+ get Heading() {
1340
+ return GetEntityHeading(this.handle);
1341
+ }
1342
+ /**
1343
+ * @param heading sets the entitys heading to the specified heading, this can be in the range of 0..360
1344
+ */
1345
+ set Heading(heading) {
1346
+ SetEntityHeading(this.handle, heading);
1347
+ }
1348
+ /**
1349
+ * @returns the position of the current Entity
1350
+ */
1351
+ get Position() {
1352
+ return Vector3.fromArray(GetEntityCoords(this.handle, true, true));
1353
+ }
1354
+ /**
1355
+ * You should always try to load the collisions before setting the entitys position if going a long distance.
1356
+ * @param pos sets the position for the current ped
1357
+ */
1358
+ set Position(pos) {
1359
+ SetEntityCoords(this.handle, pos.x, pos.y, pos.z, false, false, false, false);
1360
+ }
1361
+ delete() {
1362
+ this.IsMissionEntity = true;
1363
+ DeleteEntity(this.handle);
1364
+ for (const cookie of this.stateBagCookies) {
1365
+ RemoveStateBagChangeHandler(cookie);
1366
+ }
1367
+ }
1368
+ /*
1369
+ * Attaches an entity to another entity via a bone
1370
+ * @example
1371
+ * ```typescript
1372
+ * const ply = Game.PlayerPed;
1373
+ * const bag = await World.createProp(new Model('ba_prop_battle_bag_01b'), ply.Position, true, true, true);
1374
+ * bag.attachToBone(
1375
+ * ply.Bones.getBone(64113),
1376
+ * new Vector3(0.12, -0.25, 0.0),
1377
+ * new Vector3(105.0, 50.0, 190.0)
1378
+ * )
1379
+ * ```
1380
+ */
1381
+ attachToBone(entityBone, position, rotation, collisions = false, unk9 = true, useSoftPinning = true, rotationOrder = 1) {
1382
+ if (this.handle === entityBone.Owner.Handle) {
1383
+ throw new Error("You cannot attach an entity to the same entity this will result in a crash!");
1384
+ }
1385
+ AttachEntityToEntity(
1386
+ this.handle,
1387
+ entityBone.Owner.Handle,
1388
+ entityBone.Index,
1389
+ position.x,
1390
+ position.y,
1391
+ position.z,
1392
+ rotation.x,
1393
+ rotation.y,
1394
+ rotation.z,
1395
+ unk9,
1396
+ useSoftPinning,
1397
+ collisions,
1398
+ IsEntityAPed(entityBone.Owner.Handle),
1399
+ rotationOrder,
1400
+ true
1401
+ );
1402
+ }
1403
+ };
1404
+ __name(_CommonBaseEntity, "CommonBaseEntity");
1405
+ __name10(_CommonBaseEntity, "CommonBaseEntity");
1406
+ var CommonBaseEntity = _CommonBaseEntity;
1407
+
1408
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/common-game/entities/CommonBaseEntityBoneCollection.js
1409
+ var __defProp11 = Object.defineProperty;
1410
+ var __name11 = /* @__PURE__ */ __name((target, value) => __defProp11(target, "name", { value, configurable: true }), "__name");
1411
+ var _CommonBaseEntityBoneCollection = class _CommonBaseEntityBoneCollection {
1412
+ constructor(owner) {
1413
+ __publicField(this, "owner");
1414
+ this.owner = owner;
1415
+ }
1416
+ hasBone(name) {
1417
+ return GetEntityBoneIndexByName(this.owner.Handle, name) !== -1;
1418
+ }
1419
+ };
1420
+ __name(_CommonBaseEntityBoneCollection, "CommonBaseEntityBoneCollection");
1421
+ __name11(_CommonBaseEntityBoneCollection, "CommonBaseEntityBoneCollection");
1422
+ var CommonBaseEntityBoneCollection = _CommonBaseEntityBoneCollection;
1423
+
1424
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/common-game/entities/CommonBaseEntityBone.js
1425
+ var __defProp12 = Object.defineProperty;
1426
+ var __name12 = /* @__PURE__ */ __name((target, value) => __defProp12(target, "name", { value, configurable: true }), "__name");
1427
+ var _CommonBaseEntityBone = class _CommonBaseEntityBone extends IHandle {
1428
+ constructor(owner, boneInfo) {
1429
+ super(typeof boneInfo === "number" ? boneInfo : GetEntityBoneIndexByName(owner.Handle, boneInfo));
1430
+ __publicField(this, "owner");
1431
+ this.owner = owner;
1432
+ }
1433
+ // overwrite the `IHandle` exists function call
1434
+ exists() {
1435
+ return this.handle !== -1;
1436
+ }
1437
+ get Index() {
1438
+ return this.handle;
1439
+ }
1440
+ get Owner() {
1441
+ return this.owner;
1442
+ }
1443
+ get Position() {
1444
+ return Vector3.fromArray(GetWorldPositionOfEntityBone(this.owner.Handle, this.handle));
1445
+ }
1446
+ // public get Rotation(): Vector3 {
1447
+ // return Vector3.fromArray(GetEntityBoneRotation(this.owner.Handle, this.index));
1448
+ // }
1449
+ get IsValid() {
1450
+ return this.owner.exists() && this.handle !== -1;
1451
+ }
1452
+ };
1453
+ __name(_CommonBaseEntityBone, "CommonBaseEntityBone");
1454
+ __name12(_CommonBaseEntityBone, "CommonBaseEntityBone");
1455
+ var CommonBaseEntityBone = _CommonBaseEntityBone;
1456
+
1457
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/common-game/entities/CommonEntityBone.js
1458
+ var __defProp13 = Object.defineProperty;
1459
+ var __name13 = /* @__PURE__ */ __name((target, value) => __defProp13(target, "name", { value, configurable: true }), "__name");
1460
+ var _CommonEntityBone = class _CommonEntityBone extends CommonBaseEntityBone {
1461
+ constructor(owner, boneIndexOrBoneName) {
1462
+ super(owner, boneIndexOrBoneName);
1463
+ }
1464
+ };
1465
+ __name(_CommonEntityBone, "CommonEntityBone");
1466
+ __name13(_CommonEntityBone, "CommonEntityBone");
1467
+ var CommonEntityBone = _CommonEntityBone;
1468
+
1469
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/common-game/entities/CommonEntityBoneCollection.js
1470
+ var __defProp14 = Object.defineProperty;
1471
+ var __name14 = /* @__PURE__ */ __name((target, value) => __defProp14(target, "name", { value, configurable: true }), "__name");
1472
+ var _CommonEntityBoneCollection = class _CommonEntityBoneCollection extends CommonBaseEntityBoneCollection {
1473
+ constructor(owner) {
1474
+ super(owner);
1475
+ }
1476
+ getBoneFromName(boneName) {
1477
+ return new CommonEntityBone(this.owner, GetEntityBoneIndexByName(this.owner.Handle, boneName));
1478
+ }
1479
+ getBoneFromIndex(boneIndex) {
1480
+ return new CommonEntityBone(this.owner, boneIndex);
1481
+ }
1482
+ getBone(bone) {
1483
+ return new CommonEntityBone(
1484
+ this.owner,
1485
+ typeof bone === "number" ? bone : GetEntityBoneIndexByName(this.owner.Handle, bone ?? "")
1486
+ );
1487
+ }
1488
+ get Core() {
1489
+ return new CommonEntityBone(this.owner, -1);
1490
+ }
1491
+ };
1492
+ __name(_CommonEntityBoneCollection, "CommonEntityBoneCollection");
1493
+ __name14(_CommonEntityBoneCollection, "CommonEntityBoneCollection");
1494
+ var CommonEntityBoneCollection = _CommonEntityBoneCollection;
1495
+
1496
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/common-game/entities/CommonVehicle.js
1497
+ var __defProp15 = Object.defineProperty;
1498
+ var __name15 = /* @__PURE__ */ __name((target, value) => __defProp15(target, "name", { value, configurable: true }), "__name");
1499
+ var _CommonVehicle = class _CommonVehicle extends CommonBaseEntity {
1500
+ constructor(handle) {
1501
+ super(handle);
1502
+ __publicField(this, "type", ClassTypes.Vehicle);
1503
+ __publicField(this, "bones");
1504
+ }
1505
+ static fromHandle(handle) {
1506
+ if (handle === 0 || !DoesEntityExist(handle)) {
1507
+ return null;
1508
+ }
1509
+ return new this(handle);
1510
+ }
1511
+ static fromNetworkId(networkId) {
1512
+ if (!NetworkDoesEntityExistWithNetworkId(networkId)) {
1513
+ return null;
1514
+ }
1515
+ return new this(NetworkGetEntityFromNetworkId(networkId));
1516
+ }
1517
+ get Bones() {
1518
+ if (!this.bones) {
1519
+ this.bones = new CommonEntityBoneCollection(this);
1520
+ }
1521
+ return this.bones;
1522
+ }
1523
+ };
1524
+ __name(_CommonVehicle, "CommonVehicle");
1525
+ __name15(_CommonVehicle, "CommonVehicle");
1526
+ var CommonVehicle = _CommonVehicle;
1527
+
1528
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/common-game/entities/CommonPedBone.js
1529
+ var __defProp16 = Object.defineProperty;
1530
+ var __name16 = /* @__PURE__ */ __name((target, value) => __defProp16(target, "name", { value, configurable: true }), "__name");
1531
+ var _CommonPedBone = class _CommonPedBone extends CommonBaseEntityBone {
1532
+ constructor(owner, boneIndex) {
1533
+ super(owner, boneIndex);
1534
+ }
1535
+ get IsValid() {
1536
+ return this.Owner.exists() && this.Index !== -1;
1537
+ }
1538
+ };
1539
+ __name(_CommonPedBone, "CommonPedBone");
1540
+ __name16(_CommonPedBone, "CommonPedBone");
1541
+ var CommonPedBone = _CommonPedBone;
1542
+
1543
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/common-game/entities/CommonPedBoneCollection.js
1544
+ var __defProp17 = Object.defineProperty;
1545
+ var __name17 = /* @__PURE__ */ __name((target, value) => __defProp17(target, "name", { value, configurable: true }), "__name");
1546
+ var _CommonPedBoneCollection = class _CommonPedBoneCollection extends CommonBaseEntityBoneCollection {
1547
+ constructor(owner) {
1548
+ super(owner);
1549
+ }
1550
+ get Core() {
1551
+ return new CommonPedBone(this.owner, -1);
1552
+ }
1553
+ get LastDamaged() {
1554
+ const [, outBone] = GetPedLastDamageBone(this.owner.Handle, 0);
1555
+ return CommonPedBone[outBone];
1556
+ }
1557
+ clearLastDamaged() {
1558
+ ClearPedLastDamageBone(this.owner.Handle);
1559
+ }
1560
+ getBoneFromId(boneId) {
1561
+ return new CommonPedBone(this.owner, GetPedBoneIndex(this.owner.Handle, boneId));
1562
+ }
1563
+ getBoneFromName(boneName) {
1564
+ return new CommonPedBone(this.owner, GetEntityBoneIndexByName(this.owner.Handle, boneName));
1565
+ }
1566
+ getBone(bone) {
1567
+ return new CommonPedBone(
1568
+ this.owner,
1569
+ typeof bone === "number" ? bone : GetEntityBoneIndexByName(this.owner.Handle, bone ?? "")
1570
+ );
1571
+ }
1572
+ };
1573
+ __name(_CommonPedBoneCollection, "CommonPedBoneCollection");
1574
+ __name17(_CommonPedBoneCollection, "CommonPedBoneCollection");
1575
+ var CommonPedBoneCollection = _CommonPedBoneCollection;
1576
+
1577
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/entities/BaseEntity.js
1578
+ var __defProp18 = Object.defineProperty;
1579
+ var __name18 = /* @__PURE__ */ __name((target, value) => __defProp18(target, "name", { value, configurable: true }), "__name");
1580
+ var _BaseEntity = class _BaseEntity extends CommonBaseEntity {
1581
+ };
1582
+ __name(_BaseEntity, "BaseEntity");
1583
+ __name18(_BaseEntity, "BaseEntity");
1584
+ var BaseEntity = _BaseEntity;
1585
+
1586
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/enums/Driving.js
1587
+ var DrivingStyle = /* @__PURE__ */ ((DrivingStyle2) => {
1588
+ DrivingStyle2[DrivingStyle2["None"] = 0] = "None";
1589
+ return DrivingStyle2;
1590
+ })(DrivingStyle || {});
1591
+
1592
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/enums/FiringPatterns.js
1593
+ var FiringPatterns = /* @__PURE__ */ ((FiringPatterns2) => {
1594
+ FiringPatterns2[FiringPatterns2["None"] = 0] = "None";
1595
+ FiringPatterns2[FiringPatterns2["BurstFire"] = -687903391] = "BurstFire";
1596
+ FiringPatterns2[FiringPatterns2["UNK1"] = -753768974] = "UNK1";
1597
+ FiringPatterns2[FiringPatterns2["UNK2"] = 1857128337] = "UNK2";
1598
+ FiringPatterns2[FiringPatterns2["BurstFireInCover"] = 40051185] = "BurstFireInCover";
1599
+ FiringPatterns2[FiringPatterns2["BurstFireMG"] = 432416687] = "BurstFireMG";
1600
+ FiringPatterns2[FiringPatterns2["BurstFirePistol"] = -651807432] = "BurstFirePistol";
1601
+ FiringPatterns2[FiringPatterns2["BurstFirePumpShotgun"] = 12239771] = "BurstFirePumpShotgun";
1602
+ FiringPatterns2[FiringPatterns2["BurstFireRifle"] = -1670073338] = "BurstFireRifle";
1603
+ FiringPatterns2[FiringPatterns2["BurstFireSmg"] = -787632658] = "BurstFireSmg";
1604
+ FiringPatterns2[FiringPatterns2["UNK3"] = 1575766855] = "UNK3";
1605
+ FiringPatterns2[FiringPatterns2["BurstSingleShot"] = -1413485146] = "BurstSingleShot";
1606
+ FiringPatterns2[FiringPatterns2["CompanionBill"] = -667771326] = "CompanionBill";
1607
+ FiringPatterns2[FiringPatterns2["CompanionDutch"] = -921847361] = "CompanionDutch";
1608
+ FiringPatterns2[FiringPatterns2["CompanionHosea"] = 1173361664] = "CompanionHosea";
1609
+ FiringPatterns2[FiringPatterns2["CompanionJohn"] = 1026597428] = "CompanionJohn";
1610
+ FiringPatterns2[FiringPatterns2["CompanionMicah"] = -2017692654] = "CompanionMicah";
1611
+ FiringPatterns2[FiringPatterns2["UNK4"] = 2055493265] = "UNK4";
1612
+ FiringPatterns2[FiringPatterns2["UNK5"] = -1725067907] = "UNK5";
1613
+ FiringPatterns2[FiringPatterns2["UNK6"] = -2056883078] = "UNK6";
1614
+ FiringPatterns2[FiringPatterns2["ExConfederatesCombat"] = 517186037] = "ExConfederatesCombat";
1615
+ FiringPatterns2[FiringPatterns2["ExplosivesInCover"] = 365231505] = "ExplosivesInCover";
1616
+ FiringPatterns2[FiringPatterns2["UNK7"] = 577037782] = "UNK7";
1617
+ FiringPatterns2[FiringPatterns2["FullAuto"] = -957453492] = "FullAuto";
1618
+ FiringPatterns2[FiringPatterns2["InCoverCompanionBill"] = 2047104079] = "InCoverCompanionBill";
1619
+ FiringPatterns2[FiringPatterns2["InCoverCompanionDutch"] = -887696719] = "InCoverCompanionDutch";
1620
+ FiringPatterns2[FiringPatterns2["InCoverCompanionHosea"] = -938698330] = "InCoverCompanionHosea";
1621
+ FiringPatterns2[FiringPatterns2["InCoverCompanionJohn"] = -451565453] = "InCoverCompanionJohn";
1622
+ FiringPatterns2[FiringPatterns2["InCoverCompanionMicah"] = -1946394022] = "InCoverCompanionMicah";
1623
+ FiringPatterns2[FiringPatterns2["UNK8"] = 1836430378] = "UNK8";
1624
+ FiringPatterns2[FiringPatterns2["SingleShot"] = 1566631136] = "SingleShot";
1625
+ FiringPatterns2[FiringPatterns2["SlowShot"] = -1422700276] = "SlowShot";
1626
+ FiringPatterns2[FiringPatterns2["UNK9"] = 1521641709] = "UNK9";
1627
+ FiringPatterns2[FiringPatterns2["ThrowInCover"] = -1795196902] = "ThrowInCover";
1628
+ return FiringPatterns2;
1629
+ })(FiringPatterns || {});
1630
+
1631
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/enums/VehicleSeat.js
1632
+ var VehicleSeat = /* @__PURE__ */ ((VehicleSeat2) => {
1633
+ VehicleSeat2[VehicleSeat2["AnyPassenger"] = -2] = "AnyPassenger";
1634
+ VehicleSeat2[VehicleSeat2["Driver"] = -1] = "Driver";
1635
+ VehicleSeat2[VehicleSeat2["FrontRight"] = 0] = "FrontRight";
1636
+ VehicleSeat2[VehicleSeat2["BackLeft"] = 1] = "BackLeft";
1637
+ VehicleSeat2[VehicleSeat2["BackRight"] = 2] = "BackRight";
1638
+ VehicleSeat2[VehicleSeat2["ExtraLeft1"] = 3] = "ExtraLeft1";
1639
+ VehicleSeat2[VehicleSeat2["ExtraRight1"] = 4] = "ExtraRight1";
1640
+ VehicleSeat2[VehicleSeat2["ExtraLeft2"] = 5] = "ExtraLeft2";
1641
+ VehicleSeat2[VehicleSeat2["ExtraRight2"] = 6] = "ExtraRight2";
1642
+ VehicleSeat2[VehicleSeat2["ExtraLeft3"] = 7] = "ExtraLeft3";
1643
+ VehicleSeat2[VehicleSeat2["ExtraRight3"] = 8] = "ExtraRight3";
1644
+ return VehicleSeat2;
1645
+ })(VehicleSeat || {});
1646
+
1647
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/utils/Animations.js
1648
+ var __defProp19 = Object.defineProperty;
1649
+ var __name19 = /* @__PURE__ */ __name((target, value) => __defProp19(target, "name", { value, configurable: true }), "__name");
1650
+ var LoadAnimDict = /* @__PURE__ */ __name19(async (animDict, waitTime = 1e3) => {
1651
+ const start = GetGameTimer();
1652
+ if (!HasAnimDictLoaded(animDict)) {
1653
+ RequestAnimDict(animDict);
1654
+ }
1655
+ while (!HasAnimDictLoaded(animDict)) {
1656
+ if (GetGameTimer() - start >= waitTime) return false;
1657
+ await Delay(0);
1658
+ }
1659
+ return true;
1660
+ }, "LoadAnimDict");
1661
+
1662
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/Task.js
1663
+ var __defProp20 = Object.defineProperty;
1664
+ var __name20 = /* @__PURE__ */ __name((target, value) => __defProp20(target, "name", { value, configurable: true }), "__name");
1665
+ var _Tasks = class _Tasks {
1666
+ // we take null because sequences have a null ped, if you pass null to this
1667
+ // you betterk now what you're doing.
1668
+ constructor(ped) {
1669
+ __publicField(this, "ped");
1670
+ const actualPed = ped ?? { handle: null };
1671
+ this.ped = ped;
1672
+ }
1673
+ achieveHeading(heading, timeout = 0) {
1674
+ TaskAchieveHeading(this.ped.Handle, heading, timeout);
1675
+ }
1676
+ blockTemporaryEvents(block = true) {
1677
+ TaskSetBlockingOfNonTemporaryEvents(this.ped.Handle, block);
1678
+ }
1679
+ aimAt(target, duration) {
1680
+ if (target instanceof BaseEntity)
1681
+ TaskAimGunAtEntity(this.ped.Handle, target.Handle, duration, false, false);
1682
+ else TaskAimGunAtCoord(this.ped.Handle, target.x, target.y, target.z, duration, false, false);
1683
+ }
1684
+ arrest(ped) {
1685
+ TaskArrestPed(this.ped.Handle, ped.Handle);
1686
+ }
1687
+ jump() {
1688
+ TaskJump(this.ped.Handle, true);
1689
+ }
1690
+ climb() {
1691
+ TaskClimb(this.ped.Handle, true);
1692
+ }
1693
+ // TODO: test and verify
1694
+ // public climbLadder(): void {
1695
+ // TaskClimbLadder(this.ped.Handle, 0.0 1);
1696
+ // }
1697
+ //
1698
+ // public cower(duration: number): void {
1699
+ // TaskCower(this.ped.Handle, duration);
1700
+ // }
1701
+ cruiseWithVehicle(vehicle, speed, drivingStyle = DrivingStyle.None) {
1702
+ TaskVehicleDriveWander(this.ped.Handle, vehicle.Handle, speed, drivingStyle);
1703
+ }
1704
+ // public driveTo(
1705
+ // vehicle: Vehicle,
1706
+ // target: Vector3,
1707
+ // radius: number,
1708
+ // speed: number,
1709
+ // drivingstyle = DrivingStyle.None,
1710
+ // ): void {
1711
+ // // Swap to TaskVehicleDriveToCoord
1712
+ // TaskVehicleDriveToCoordLongrange(
1713
+ // this.ped.Handle,
1714
+ // vehicle.Handle,
1715
+ // target.x,
1716
+ // target.y,
1717
+ // target.z,
1718
+ // speed,
1719
+ // drivingstyle,
1720
+ // radius,
1721
+ // );
1722
+ // }
1723
+ enterAnyVehicle(seat = VehicleSeat.AnyPassenger, timeout = -1, speed = 0, flag = 0) {
1724
+ TaskEnterVehicle(this.ped.Handle, 0, timeout, seat, speed, flag, 0);
1725
+ }
1726
+ static everyoneLeaveVehicle(vehicle) {
1727
+ TaskEveryoneLeaveVehicle(vehicle.Handle, 0);
1728
+ }
1729
+ fightAgainst(target, duration) {
1730
+ if (duration) {
1731
+ TaskCombatPedTimed(this.ped.Handle, target.Handle, duration, 0);
1732
+ } else {
1733
+ TaskCombatPed(this.ped.Handle, target.Handle, 0, 16);
1734
+ }
1735
+ }
1736
+ fightAgainstHatedTargets(radius, duration) {
1737
+ if (duration) {
1738
+ TaskCombatHatedTargetsAroundPedTimed(this.ped.Handle, radius, duration, 0);
1739
+ } else {
1740
+ TaskCombatHatedTargetsAroundPed(this.ped.Handle, radius, 0, 0);
1741
+ }
1742
+ }
1743
+ fleeFrom(pedOrPosition, distance = 100, duration = -1, fleeType = 0, fleeSpeed = 3, fleeFrom) {
1744
+ if (pedOrPosition instanceof Ped) {
1745
+ TaskSmartFleePed(
1746
+ this.ped.Handle,
1747
+ pedOrPosition.Handle,
1748
+ distance,
1749
+ duration,
1750
+ fleeType,
1751
+ fleeSpeed,
1752
+ fleeFrom ? fleeFrom.Handle : 0
1753
+ );
1754
+ } else {
1755
+ TaskSmartFleeCoord(
1756
+ this.ped.Handle,
1757
+ pedOrPosition.x,
1758
+ pedOrPosition.y,
1759
+ pedOrPosition.z,
1760
+ distance,
1761
+ duration,
1762
+ fleeType,
1763
+ fleeSpeed
1764
+ );
1765
+ }
1766
+ }
1767
+ goTo(position, ignorePaths = false, timeout = -1, speed = 1, targetHeading = 0, distanceToSlide = 0, flags = 0) {
1768
+ if (ignorePaths) {
1769
+ TaskGoStraightToCoord(
1770
+ this.ped.Handle,
1771
+ position.x,
1772
+ position.y,
1773
+ position.z,
1774
+ speed,
1775
+ timeout,
1776
+ targetHeading,
1777
+ distanceToSlide,
1778
+ 0
1779
+ );
1780
+ } else {
1781
+ TaskFollowNavMeshToCoord(
1782
+ this.ped.Handle,
1783
+ position.x,
1784
+ position.y,
1785
+ position.z,
1786
+ speed,
1787
+ timeout,
1788
+ 0,
1789
+ flags,
1790
+ targetHeading
1791
+ );
1792
+ }
1793
+ }
1794
+ goToEntity(target, offset = null, timeout = -1) {
1795
+ if (offset === null) {
1796
+ offset = new Vector3(0, 0, 0);
1797
+ }
1798
+ TaskGotoEntityOffsetXy(this.ped.Handle, target.Handle, timeout, offset.x, offset.y, offset.z, 1, true);
1799
+ }
1800
+ guardCurrentPosition() {
1801
+ TaskGuardCurrentPosition(this.ped.Handle, 15, 10, true);
1802
+ }
1803
+ handsUp(duration) {
1804
+ TaskHandsUp(this.ped.Handle, duration, 0, -1, false);
1805
+ }
1806
+ lookAt(targetOrPosition, duration = -1) {
1807
+ if (targetOrPosition instanceof BaseEntity) {
1808
+ TaskLookAtEntity(this.ped.Handle, targetOrPosition.Handle, duration, 2048, 31, 0);
1809
+ } else {
1810
+ TaskLookAtCoord(this.ped.Handle, targetOrPosition.x, targetOrPosition.y, targetOrPosition.z, duration, 0, 51, 0);
1811
+ }
1812
+ }
1813
+ async playAnimation(animDict, animName, blendInSpeed, blendOutSpeed, duration, playbackRate, animFlags, ikFlags) {
1814
+ await LoadAnimDict(animDict);
1815
+ TaskPlayAnim(
1816
+ this.ped.Handle,
1817
+ animDict,
1818
+ animName,
1819
+ blendInSpeed,
1820
+ blendOutSpeed,
1821
+ duration,
1822
+ animFlags,
1823
+ playbackRate,
1824
+ false,
1825
+ ikFlags,
1826
+ false,
1827
+ 0,
1828
+ false
1829
+ );
1830
+ RemoveAnimDict(animDict);
1831
+ }
1832
+ reloadWeapon() {
1833
+ TaskReloadWeapon(this.ped.Handle, true);
1834
+ }
1835
+ shootAt(targetOrPosition, duration = -1, pattern = FiringPatterns.None, affectCockedState = false) {
1836
+ if (targetOrPosition instanceof Ped) {
1837
+ TaskShootAtEntity(this.ped.Handle, targetOrPosition.Handle, duration, pattern, affectCockedState);
1838
+ } else {
1839
+ TaskShootAtCoord(
1840
+ this.ped.Handle,
1841
+ targetOrPosition.x,
1842
+ targetOrPosition.y,
1843
+ targetOrPosition.z,
1844
+ duration,
1845
+ pattern,
1846
+ 0
1847
+ );
1848
+ }
1849
+ }
1850
+ shuffleToNextVehicleSeat(vehicle) {
1851
+ TaskShuffleToNextVehicleSeat(this.ped.Handle, vehicle.Handle);
1852
+ }
1853
+ slideTo(position, heading, duration = 0.7) {
1854
+ TaskPedSlideToCoord(this.ped.Handle, position.x, position.y, position.z, heading, duration);
1855
+ }
1856
+ standStill(duration) {
1857
+ TaskStandStill(this.ped.Handle, duration);
1858
+ }
1859
+ vehicleShootAtPed(target) {
1860
+ TaskVehicleShootAtPed(this.ped.Handle, target.Handle, 20);
1861
+ }
1862
+ wait(duration) {
1863
+ TaskPause(this.ped.Handle, duration);
1864
+ }
1865
+ wanderAround(position, radius) {
1866
+ if (position && radius) {
1867
+ TaskWanderInArea(this.ped.Handle, position.x, position.y, position.z, radius, 0, 0, 0);
1868
+ } else {
1869
+ TaskWanderStandard(this.ped.Handle, 0, 0);
1870
+ }
1871
+ }
1872
+ warpIntoVehicle(vehicle, seat) {
1873
+ TaskWarpPedIntoVehicle(this.ped.Handle, vehicle.Handle, seat);
1874
+ }
1875
+ warpOutOfVehicle(vehicle, flags) {
1876
+ TaskLeaveVehicle(this.ped.Handle, vehicle.Handle, flags, 0);
1877
+ }
1878
+ isPlayingAnim(dict, anim, taskFlag = 3) {
1879
+ return IsEntityPlayingAnim(this.ped.Handle, dict, anim, taskFlag);
1880
+ }
1881
+ clearAll() {
1882
+ ClearPedTasks(this.ped.Handle, true, false);
1883
+ }
1884
+ clearAllImmediately() {
1885
+ ClearPedTasksImmediately(this.ped.Handle, true, false);
1886
+ }
1887
+ clearLookAt() {
1888
+ TaskClearLookAt(this.ped.Handle);
1889
+ }
1890
+ clearSecondary() {
1891
+ ClearPedSecondaryTask(this.ped.Handle);
1892
+ }
1893
+ clearAnimation(animDict, animName) {
1894
+ StopAnimTask(this.ped.Handle, animDict, animName, -4);
1895
+ }
1896
+ };
1897
+ __name(_Tasks, "Tasks");
1898
+ __name20(_Tasks, "Tasks");
1899
+ var Tasks = _Tasks;
1900
+
1901
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/enums/WeaponAttachPoints.js
1902
+ var WeaponAttachPoints = /* @__PURE__ */ ((WeaponAttachPoints2) => {
1903
+ WeaponAttachPoints2[WeaponAttachPoints2["HandPrimary"] = 0] = "HandPrimary";
1904
+ WeaponAttachPoints2[WeaponAttachPoints2["HandSecondary"] = 1] = "HandSecondary";
1905
+ WeaponAttachPoints2[WeaponAttachPoints2["PistolR"] = 2] = "PistolR";
1906
+ WeaponAttachPoints2[WeaponAttachPoints2["MAX_HAND_ATTACH_POINTS"] = 2] = "MAX_HAND_ATTACH_POINTS";
1907
+ WeaponAttachPoints2[WeaponAttachPoints2["PistolLeft"] = 3] = "PistolLeft";
1908
+ WeaponAttachPoints2[WeaponAttachPoints2["Knife"] = 4] = "Knife";
1909
+ WeaponAttachPoints2[WeaponAttachPoints2["Lasso"] = 5] = "Lasso";
1910
+ WeaponAttachPoints2[WeaponAttachPoints2["Thrower"] = 6] = "Thrower";
1911
+ WeaponAttachPoints2[WeaponAttachPoints2["Bow"] = 7] = "Bow";
1912
+ WeaponAttachPoints2[WeaponAttachPoints2["BowAlternative"] = 8] = "BowAlternative";
1913
+ WeaponAttachPoints2[WeaponAttachPoints2["Rifle"] = 9] = "Rifle";
1914
+ WeaponAttachPoints2[WeaponAttachPoints2["RifleAlternative"] = 10] = "RifleAlternative";
1915
+ WeaponAttachPoints2[WeaponAttachPoints2["Lantern"] = 11] = "Lantern";
1916
+ WeaponAttachPoints2[WeaponAttachPoints2["TempLantern"] = 12] = "TempLantern";
1917
+ WeaponAttachPoints2[WeaponAttachPoints2["Melee"] = 13] = "Melee";
1918
+ WeaponAttachPoints2[WeaponAttachPoints2["MAX_SYNCED_WEAPON_ATTACH_POINTS"] = 13] = "MAX_SYNCED_WEAPON_ATTACH_POINTS";
1919
+ WeaponAttachPoints2[WeaponAttachPoints2["Hip"] = 14] = "Hip";
1920
+ WeaponAttachPoints2[WeaponAttachPoints2["Boot"] = 15] = "Boot";
1921
+ WeaponAttachPoints2[WeaponAttachPoints2["Back"] = 16] = "Back";
1922
+ WeaponAttachPoints2[WeaponAttachPoints2["Front"] = 18] = "Front";
1923
+ WeaponAttachPoints2[WeaponAttachPoints2["ShoulderSling"] = 19] = "ShoulderSling";
1924
+ WeaponAttachPoints2[WeaponAttachPoints2["LeftBreast"] = 20] = "LeftBreast";
1925
+ WeaponAttachPoints2[WeaponAttachPoints2["RightBreast"] = 21] = "RightBreast";
1926
+ WeaponAttachPoints2[WeaponAttachPoints2["LeftArmpit"] = 22] = "LeftArmpit";
1927
+ WeaponAttachPoints2[WeaponAttachPoints2["RightArmpit"] = 23] = "RightArmpit";
1928
+ WeaponAttachPoints2[WeaponAttachPoints2["LeftArmpitRifle"] = 24] = "LeftArmpitRifle";
1929
+ WeaponAttachPoints2[WeaponAttachPoints2["Satchel"] = 25] = "Satchel";
1930
+ WeaponAttachPoints2[WeaponAttachPoints2["LeftArmPitBow"] = 26] = "LeftArmPitBow";
1931
+ WeaponAttachPoints2[WeaponAttachPoints2["RightHandExtra"] = 27] = "RightHandExtra";
1932
+ WeaponAttachPoints2[WeaponAttachPoints2["LeftHandExtra"] = 28] = "LeftHandExtra";
1933
+ WeaponAttachPoints2[WeaponAttachPoints2["RightHandAux"] = 29] = "RightHandAux";
1934
+ WeaponAttachPoints2[WeaponAttachPoints2["MAX_WEAPON_ATTACH_POINTS"] = 29] = "MAX_WEAPON_ATTACH_POINTS";
1935
+ WeaponAttachPoints2[WeaponAttachPoints2["WEAPON_ATTACH_POINT_INVALID"] = -1] = "WEAPON_ATTACH_POINT_INVALID";
1936
+ return WeaponAttachPoints2;
1937
+ })(WeaponAttachPoints || {});
1938
+
1939
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/inventory/InventoryTypes.js
1940
+ var ItemAddReason = /* @__PURE__ */ ((ItemAddReason2) => {
1941
+ ItemAddReason2[ItemAddReason2["Default"] = 752097756] = "Default";
1942
+ ItemAddReason2[ItemAddReason2["Incentive"] = -1965281643] = "Incentive";
1943
+ ItemAddReason2[ItemAddReason2["Syncing"] = -1924444172] = "Syncing";
1944
+ ItemAddReason2[ItemAddReason2["Awards"] = -1216041698] = "Awards";
1945
+ ItemAddReason2[ItemAddReason2["Notification"] = -983395630] = "Notification";
1946
+ ItemAddReason2[ItemAddReason2["Loadout"] = -902540058] = "Loadout";
1947
+ ItemAddReason2[ItemAddReason2["Looted"] = -897553835] = "Looted";
1948
+ ItemAddReason2[ItemAddReason2["UseFailed"] = -746211728] = "UseFailed";
1949
+ ItemAddReason2[ItemAddReason2["GetInventory"] = -669481339] = "GetInventory";
1950
+ ItemAddReason2[ItemAddReason2["CreateCharacter"] = -490406031] = "CreateCharacter";
1951
+ ItemAddReason2[ItemAddReason2["MpMission"] = -334626412] = "MpMission";
1952
+ ItemAddReason2[ItemAddReason2["Pickup"] = 444010018] = "Pickup";
1953
+ ItemAddReason2[ItemAddReason2["SetAmount"] = 1157919518] = "SetAmount";
1954
+ ItemAddReason2[ItemAddReason2["Purchased"] = 1248274121] = "Purchased";
1955
+ ItemAddReason2[ItemAddReason2["LoadSaveGame"] = 1445013766] = "LoadSaveGame";
1956
+ ItemAddReason2[ItemAddReason2["Debug"] = 1543882317] = "Debug";
1957
+ ItemAddReason2[ItemAddReason2["Melee"] = 2073812199] = "Melee";
1958
+ return ItemAddReason2;
1959
+ })(ItemAddReason || {});
1960
+
1961
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/models/WeaponModel.js
1962
+ var __defProp21 = Object.defineProperty;
1963
+ var __name21 = /* @__PURE__ */ __name((target, value) => __defProp21(target, "name", { value, configurable: true }), "__name");
1964
+ var _WeaponModel = class _WeaponModel extends Model {
1965
+ requestModel() {
1966
+ Citizen.invokeNative("0x72D4CB5DB927009C", this.hash, 0, true);
1967
+ this.requestCount++;
1968
+ }
1969
+ markAsNoLongerNeeded() {
1970
+ Citizen.invokeNative("0xC3896D03E2852236", this.hash);
1971
+ this.requestCount--;
1972
+ }
1973
+ get DefaultAttachPoint() {
1974
+ return Citizen.invokeNative("0x65DC4AC5B96614CB", this.hash, Citizen.resultAsInteger());
1975
+ }
1976
+ };
1977
+ __name(_WeaponModel, "WeaponModel");
1978
+ __name21(_WeaponModel, "WeaponModel");
1979
+ var WeaponModel = _WeaponModel;
1980
+
1981
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/entities/Vehicle.js
1982
+ var __defProp22 = Object.defineProperty;
1983
+ var __name22 = /* @__PURE__ */ __name((target, value) => __defProp22(target, "name", { value, configurable: true }), "__name");
1984
+ var _Vehicle = class _Vehicle extends CommonVehicle {
1985
+ constructor(handle) {
1986
+ super(handle);
1987
+ __publicField(this, "type", ClassTypes.Vehicle);
1988
+ }
1989
+ /**
1990
+ * Gets the entity from the handle given, if the entity doesn't exist it will return
1991
+ * null.
1992
+ */
1993
+ static fromHandle(handle) {
1994
+ if (handle === 0 || !DoesEntityExist(handle)) {
1995
+ return null;
1996
+ }
1997
+ return new _Vehicle(handle);
1998
+ }
1999
+ /**
2000
+ * Gets the ped from the current network id, this doesn't check that
2001
+ * the entity is actually a ped
2002
+ */
2003
+ static fromNetworkId(netId) {
2004
+ if (netId === 0 || !NetworkDoesEntityExistWithNetworkId(netId)) {
2005
+ return null;
2006
+ }
2007
+ return new _Vehicle(NetToPed(netId));
2008
+ }
2009
+ static fromStateBagName(bagName) {
2010
+ const ent = GetEntityFromStateBagName(bagName);
2011
+ if (ent === 0) {
2012
+ return null;
2013
+ }
2014
+ return new _Vehicle(ent);
2015
+ }
2016
+ /**
2017
+ *
2018
+ * @param seatIndex the seat index to check
2019
+ * @returns true of the specified seat is free on the mount
2020
+ */
2021
+ isSeatFree(seatIndex) {
2022
+ return _N("0xAAB0FE202E9FC9F0", this.Handle, seatIndex, Citizen.resultAsInteger());
2023
+ }
2024
+ };
2025
+ __name(_Vehicle, "Vehicle");
2026
+ __name22(_Vehicle, "Vehicle");
2027
+ var Vehicle = _Vehicle;
2028
+
2029
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/entities/bones/PedBoneCollection.js
2030
+ var __defProp23 = Object.defineProperty;
2031
+ var __name23 = /* @__PURE__ */ __name((target, value) => __defProp23(target, "name", { value, configurable: true }), "__name");
2032
+ var _PedBoneCollection = class _PedBoneCollection extends CommonPedBoneCollection {
2033
+ getBoneFromId(boneId) {
2034
+ return new CommonPedBone(this.owner, GetPedBoneIndex(this.owner.Handle, boneId));
2035
+ }
2036
+ };
2037
+ __name(_PedBoneCollection, "PedBoneCollection");
2038
+ __name23(_PedBoneCollection, "PedBoneCollection");
2039
+ var PedBoneCollection = _PedBoneCollection;
2040
+
2041
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/entities/Ped.js
2042
+ var __defProp24 = Object.defineProperty;
2043
+ var __name24 = /* @__PURE__ */ __name((target, value) => __defProp24(target, "name", { value, configurable: true }), "__name");
2044
+ var _Ped = class _Ped extends BaseEntity {
2045
+ constructor(handle) {
2046
+ super(handle);
2047
+ __publicField(this, "type", ClassTypes.Ped);
2048
+ __publicField(this, "bones");
2049
+ __publicField(this, "attributes");
2050
+ __publicField(this, "tasks");
2051
+ }
2052
+ /**
2053
+ * Gets the entity from the handle given, if the entity doesn't exist it will return
2054
+ * null.
2055
+ */
2056
+ static fromHandle(handle) {
2057
+ if (handle === 0 || !DoesEntityExist(handle)) {
2058
+ return null;
2059
+ }
2060
+ return new _Ped(handle);
2061
+ }
2062
+ /**
2063
+ * Gets the ped from the current network id, this doesn't check that
2064
+ * the entity is actually a ped
2065
+ */
2066
+ static fromNetworkId(netId) {
2067
+ if (netId === 0 || !NetworkDoesEntityExistWithNetworkId(netId)) {
2068
+ return null;
2069
+ }
2070
+ return new _Ped(NetToPed(netId));
2071
+ }
2072
+ static fromStateBagName(bagName) {
2073
+ const ent = GetEntityFromStateBagName(bagName);
2074
+ if (ent === 0) {
2075
+ return null;
2076
+ }
2077
+ return new _Ped(ent);
2078
+ }
2079
+ get Player() {
2080
+ const playerId = NetworkGetPlayerIndexFromPed(this.handle);
2081
+ if (playerId !== 255) {
2082
+ return new Player2(playerId);
2083
+ }
2084
+ return null;
2085
+ }
2086
+ /**
2087
+ * @returns the current horse or vehicle the ped is on, or null if they're not on either
2088
+ */
2089
+ get MountedEntity() {
2090
+ const veh = this.CurrentVehicle;
2091
+ if (veh !== null) {
2092
+ return veh;
2093
+ }
2094
+ const horse = this.Mount;
2095
+ return horse;
2096
+ }
2097
+ /**
2098
+ * Blocks scenarios inbetween the specified vectors
2099
+ * @todo Move to Game
2100
+ * @param vec1
2101
+ * @param vec2
2102
+ * @param blockingFlags you can find blocking flags [here](https://github.com/Halen84/RDR3-Native-Flags-And-Enums/blob/main/ADD_SCENARIO_BLOCKING_AREA/README.md)
2103
+ * @returns the scenarioId that can be used in {@link removeScenarioBlock} to unblock
2104
+ */
2105
+ static blockScenariosInArea(vec1, vec2, blockingFlags) {
2106
+ return AddScenarioBlockingArea(
2107
+ vec1.x,
2108
+ vec1.y,
2109
+ vec1.z,
2110
+ vec2.x,
2111
+ vec2.y,
2112
+ vec2.z,
2113
+ true,
2114
+ blockingFlags
2115
+ );
2116
+ }
2117
+ /**
2118
+ * Removes the blocking of scenarios in the specified area
2119
+ * @param scenarioId the number returned from {@link blockScenariosInArea}
2120
+ */
2121
+ static removeScenarioBlock(scenarioId) {
2122
+ RemoveScenarioBlockingArea(scenarioId, false);
2123
+ }
2124
+ get Tasks() {
2125
+ if (this.tasks) {
2126
+ return this.tasks;
2127
+ }
2128
+ this.tasks = new Tasks(this);
2129
+ return this.tasks;
2130
+ }
2131
+ get Bones() {
2132
+ this.bones = this.bones ?? new PedBoneCollection(this);
2133
+ return this.bones;
2134
+ }
2135
+ /**
2136
+ * While this increases the peds max health, if used on a player it wont increase the max core value on the hud
2137
+ */
2138
+ set MaxHealth(amount) {
2139
+ SetPedMaxHealth(this.handle, amount);
2140
+ }
2141
+ /**
2142
+ * @returns the maximum health of the ped
2143
+ */
2144
+ get MaxHealth() {
2145
+ return GetPedMaxHealth(this.handle);
2146
+ }
2147
+ /**
2148
+ * @returns the {@link Attributes} for the current ped
2149
+ */
2150
+ get Attributes() {
2151
+ if (this.attributes) return this.attributes;
2152
+ return this.attributes = new Attributes(this);
2153
+ }
2154
+ get InVehicle() {
2155
+ return IsPedInAnyVehicle(this.handle, true);
2156
+ }
2157
+ get IsInjured() {
2158
+ return IsPedInjured(this.handle);
2159
+ }
2160
+ get IsFatallyInjured() {
2161
+ return IsPedFatallyInjured(this.handle);
2162
+ }
2163
+ get IsPlayer() {
2164
+ return IsPedAPlayer(this.handle);
2165
+ }
2166
+ get IsShooting() {
2167
+ return IsPedShooting(this.handle);
2168
+ }
2169
+ get Accuracy() {
2170
+ return GetPedAccuracy(this.handle);
2171
+ }
2172
+ set Accuracy(accuracy) {
2173
+ SetPedAccuracy(this.handle, accuracy);
2174
+ }
2175
+ get CanBeKnockedOffVehicle() {
2176
+ return CanKnockPedOffVehicle(this.handle);
2177
+ }
2178
+ get IsMale() {
2179
+ return IsPedMale(this.handle);
2180
+ }
2181
+ get IsHuman() {
2182
+ return IsPedHuman(this.handle);
2183
+ }
2184
+ get IsOnTopOfVehicle() {
2185
+ return IsPedOnVehicle(this.handle, false);
2186
+ }
2187
+ get Vehicle() {
2188
+ return Vehicle.fromHandle(GetVehiclePedIsIn(this.handle, false));
2189
+ }
2190
+ /**
2191
+ * @returns the last mount that this ped was on, or null if it doesn't exist
2192
+ */
2193
+ get LastMount() {
2194
+ const pedId = _N("0x4C8B59171957BCF7", this.handle, Citizen.resultAsInteger());
2195
+ return _Ped.fromHandle(pedId);
2196
+ }
2197
+ /**
2198
+ * @returns the the current mount that the ped is on, or null if there isn't one
2199
+ */
2200
+ get Mount() {
2201
+ return _Ped.fromHandle(GetMount(this.handle));
2202
+ }
2203
+ /**
2204
+ * returns the horse that this ped is leading
2205
+ */
2206
+ get LeadingHorse() {
2207
+ const pedId = _N("0x693126B5D0457D0D", this.handle, Citizen.resultAsInteger());
2208
+ return _Ped.fromHandle(pedId);
2209
+ }
2210
+ /**
2211
+ * returns the owner of the current animal
2212
+ */
2213
+ get AnimalOwner() {
2214
+ const pedId = _N("0xF103823FFE72BB49", this.handle, Citizen.resultAsInteger());
2215
+ return _Ped.fromHandle(pedId);
2216
+ }
2217
+ get TamingState() {
2218
+ return _N("0x454AD4DA6C41B5BD", this.handle, Citizen.resultAsInteger());
2219
+ }
2220
+ get IsInteractingWithAnimal() {
2221
+ return _N("0x7FC84E85D98F063D", this.handle, Citizen.resultAsInteger());
2222
+ }
2223
+ get IsSittingInAnyVehicle() {
2224
+ return IsPedSittingInAnyVehicle(this.handle);
2225
+ }
2226
+ get IsPlantingBomb() {
2227
+ return IsPedPlantingBomb(this.handle);
2228
+ }
2229
+ get IsInAnyBoat() {
2230
+ return IsPedInAnyBoat(this.handle);
2231
+ }
2232
+ get IsInAnyHeli() {
2233
+ return IsPedInAnyHeli(this.handle);
2234
+ }
2235
+ get IsInAnyPlane() {
2236
+ return IsPedInAnyPlane(this.handle);
2237
+ }
2238
+ get IsInFlyingVehicle() {
2239
+ return IsPedInFlyingVehicle(this.handle);
2240
+ }
2241
+ get IsFalling() {
2242
+ return IsPedFalling(this.handle);
2243
+ }
2244
+ get IsSliding() {
2245
+ return _N("0xD6740E14E4CEFC0B", this.handle, Citizen.resultAsInteger());
2246
+ }
2247
+ get IsJumping() {
2248
+ return IsPedJumping(this.handle);
2249
+ }
2250
+ get IsClimbing() {
2251
+ return IsPedClimbing(this.handle);
2252
+ }
2253
+ get IsClimbingLadder() {
2254
+ return _N("0x59643424B68D52B5", this.handle, Citizen.resultAsInteger());
2255
+ }
2256
+ get IsVaulting() {
2257
+ return IsPedVaulting(this.handle);
2258
+ }
2259
+ get IsDiving() {
2260
+ return IsPedDiving(this.handle);
2261
+ }
2262
+ get IsOpeningADoor() {
2263
+ return IsPedOpeningADoor(this.handle);
2264
+ }
2265
+ set SeeingRange(value) {
2266
+ SetPedSeeingRange(this.handle, value);
2267
+ }
2268
+ set HearingRange(value) {
2269
+ SetPedHearingRange(this.handle, value);
2270
+ }
2271
+ get IsStealthed() {
2272
+ return GetPedStealthMovement(this.handle);
2273
+ }
2274
+ get IsJacking() {
2275
+ return IsPedJacking(this.handle);
2276
+ }
2277
+ get IsStunned() {
2278
+ return IsPedBeingStunned(this.handle, 0);
2279
+ }
2280
+ get IsBeingJacked() {
2281
+ return IsPedBeingJacked(this.handle);
2282
+ }
2283
+ get IsInCombatRoll() {
2284
+ return _N("0xC48A9EB0D499B3E5", this.handle, Citizen.resultAsInteger());
2285
+ }
2286
+ get CrouchMovement() {
2287
+ return _N("0xD5FE956C70FF370B", this.handle, Citizen.resultAsInteger());
2288
+ }
2289
+ /**
2290
+ * returns true if {@link DamageCleanliness} was ever lower than {@link eDamageCleanliness.Good}
2291
+ */
2292
+ get IsDamaged() {
2293
+ return _N("0x6CFC373008A1EDAF", this.handle, Citizen.resultAsInteger());
2294
+ }
2295
+ set IsDamaged(damaged) {
2296
+ _N("0xDACE03C65C6666DB", this.handle, damaged);
2297
+ }
2298
+ get DamageCleanliness() {
2299
+ return _N("0x88EFFED5FE8B0B4A", this.handle, Citizen.resultAsInteger());
2300
+ }
2301
+ set DamageCleanliness(cleanliness) {
2302
+ _N("0x7528720101A807A5", this.handle, cleanliness);
2303
+ }
2304
+ set DefenseModifier(amount) {
2305
+ _N("0x9B6808EC46BE849B", this.handle, amount);
2306
+ }
2307
+ set CanBeTargeted(toggle) {
2308
+ SetPedCanBeTargetted(this.handle, toggle);
2309
+ }
2310
+ // TODO: Team class wrapper
2311
+ // TODO: Bone wrapper `GET_PED_LAST_DAMAGE_BONE`
2312
+ /**
2313
+ * returns the ped who jacked this ped
2314
+ */
2315
+ getJacker() {
2316
+ return new _Ped(GetPedsJacker(this.handle));
2317
+ }
2318
+ setCrouchMovement(state, immediately = false) {
2319
+ _N("0x7DE9692C6F64CFE8", this.handle, state, 0, immediately);
2320
+ }
2321
+ canBeTargetedByPlayer(player, toggle) {
2322
+ SetPedCanBeTargettedByPlayer(this.handle, player.Handle, toggle);
2323
+ }
2324
+ clearLastBoneDamage() {
2325
+ ClearPedLastDamageBone(this.handle);
2326
+ }
2327
+ set OwnsAnimal(animal) {
2328
+ _N("0x931B241409216C1F", this.handle, animal.Handle, false);
2329
+ }
2330
+ isInteractionPossible(animal) {
2331
+ return _N("0xD543D3A8FDE4F185", this.handle, animal.Handle, Citizen.resultAsInteger());
2332
+ }
2333
+ isOnVehicle(vehicle) {
2334
+ return IsPedOnSpecificVehicle(this.handle, vehicle.Handle);
2335
+ }
2336
+ isSittingInVehicle(vehicle) {
2337
+ return IsPedSittingInVehicle(this.handle, vehicle.Handle);
2338
+ }
2339
+ warpOutOfVehicle() {
2340
+ _N("0xE0B61ED8BB37712F", this.handle);
2341
+ }
2342
+ /**
2343
+ * puts the ped onto the specified mount
2344
+ * @param targetPed the horse to put the ped on
2345
+ * @param seatIndex the seat index to put the ped on
2346
+ */
2347
+ setOntoMount(targetPed, seatIndex) {
2348
+ _N("0x028F76B6E78246EB", this.handle, targetPed.Handle, seatIndex, true);
2349
+ }
2350
+ removeFromMount() {
2351
+ _N("0x5337B721C51883A9", this.handle, true, true);
2352
+ }
2353
+ /**
2354
+ * Sets the ped into the specified vehicle
2355
+ * @param vehicle the vehicle to put the ped into
2356
+ * @param seatIndex the seat index to put the ped into
2357
+ */
2358
+ setIntoVehicle(vehicle, seatIndex) {
2359
+ SetPedIntoVehicle(this.handle, vehicle.Handle, seatIndex);
2360
+ }
2361
+ /**
2362
+ * kills the ped and optionally sets the killer
2363
+ * @param killer the entity that killed the ped
2364
+ */
2365
+ killPed(killer) {
2366
+ SetEntityHealth(this.handle, 0, killer ? killer.Handle : 0);
2367
+ }
2368
+ damage(amount, boneId = 0, killer) {
2369
+ ApplyDamageToPed(this.handle, amount, 0, boneId, killer ? killer.Handle : 0);
2370
+ }
2371
+ /**
2372
+ * this returns a different type then the getter so we can't use set, maybe ts will fix soon (tm)
2373
+ * @param state how hard it will be to knock a ped off their vehicle
2374
+ */
2375
+ setCanBeKnockedOffVehicle(state) {
2376
+ SetPedCanBeKnockedOffVehicle(this.handle, state);
2377
+ }
2378
+ /**
2379
+ * Removes the specified ped if its not a player entity
2380
+ */
2381
+ delete() {
2382
+ SetEntityAsMissionEntity(this.handle, true, true);
2383
+ DeletePed(this.handle);
2384
+ }
2385
+ /**
2386
+ * creates a clone of the ped
2387
+ * @param network if the ped should be a networked entity
2388
+ * @param bScriptHostPed whether to register the ped as pinned to the script host in the R* network model.
2389
+ * @param copyHeadBlend whether to copy the peds head blend
2390
+ * @returns the cloned ped
2391
+ */
2392
+ clone(network, bScriptHostPed, copyHeadBlend) {
2393
+ return new _Ped(ClonePed(this.handle, network, bScriptHostPed, copyHeadBlend));
2394
+ }
2395
+ /**
2396
+ * clones the ped onto the target ped
2397
+ * @param targetPed the ped to clone onto
2398
+ */
2399
+ cloneTo(targetPed) {
2400
+ ClonePedToTarget(this.handle, targetPed.Handle);
2401
+ }
2402
+ /**
2403
+ * @param amount - the amount of armour to add to the ped
2404
+ */
2405
+ addArmour(amount) {
2406
+ AddArmourToPed(this.handle, amount);
2407
+ }
2408
+ applyDamage(damageAmount, boneId = 0, pedKiller = null) {
2409
+ ApplyDamageToPed(this.handle, damageAmount, 0, boneId, pedKiller ? pedKiller.Handle : 0);
2410
+ }
2411
+ /**
2412
+ * @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
2413
+ * @param damage - the damage to apply
2414
+ * @param mult - the multiplier?
2415
+ */
2416
+ applyDamagePack(damagePack, damage, mult) {
2417
+ ApplyPedDamagePack(this.handle, damagePack, damage, mult);
2418
+ }
2419
+ get CurrentVehicle() {
2420
+ const veh = GetVehiclePedIsIn(this.handle, false);
2421
+ if (veh === 0) return null;
2422
+ return new Vehicle(veh);
2423
+ }
2424
+ // No documentation
2425
+ // applyBloodSpecific() {
2426
+ // ApplyPedBloodSpecific
2427
+ // }
2428
+ giveHashCommand(commandHash, activationDuration) {
2429
+ Citizen.invokeNative("0xD65FDC686A031C83", this.handle, commandHash, activationDuration);
2430
+ }
2431
+ /**
2432
+ * Adds or removes the ped stamina, depending on of the amount is positive or negative.
2433
+ * @param amount the amount of stamina to add/remove
2434
+ */
2435
+ changeStamina(amount) {
2436
+ _N("0xC3D4B754C0E86B9E", this.handle, amount);
2437
+ }
2438
+ get MaxStamina() {
2439
+ return _N("0xCB42AFE2B613EE55", this.handle);
2440
+ }
2441
+ /**
2442
+ * Returns the amount of stamina the ped has
2443
+ */
2444
+ get Stamina() {
2445
+ return _N("0x775A1CA7893AA8B5", this.handle);
2446
+ }
2447
+ /**
2448
+ * returns the normalized stamina for the player, taking into account their unlocked stamina
2449
+ */
2450
+ get StaminaNormalized() {
2451
+ return _N("0x22F2A386D43048A9", this.handle);
2452
+ }
2453
+ resetStamina() {
2454
+ _N("0x36513AFFC703C60D", this.handle);
2455
+ }
2456
+ setOwnsAnimal(ped, p2 = 0) {
2457
+ _N("0x931B241409216C1F", this.handle, ped.Handle, p2);
2458
+ }
2459
+ // WEAPON NAMESPACE
2460
+ addAmmo(weapon, amount, addReason = ItemAddReason.Default) {
2461
+ Citizen.invokeNative("0xB190BCA3F4042F95", this.handle, weapon.Hash, amount, addReason);
2462
+ }
2463
+ clearLastDamage() {
2464
+ Citizen.invokeNative("0x087D8F4BC65F68E4", this.handle);
2465
+ }
2466
+ disableAmmoType(ammo) {
2467
+ Citizen.invokeNative("0xAA5A52204E077883", this.handle, ammo.Hash);
2468
+ }
2469
+ disableAmmoForWeapon(weapon, ammo) {
2470
+ Citizen.invokeNative("0xF0D728EEA3C99775", this.handle, weapon.Hash, ammo.Hash);
2471
+ }
2472
+ get HasPistol() {
2473
+ return Citizen.invokeNative("0xBFCA7AFABF9D7967", this.handle);
2474
+ }
2475
+ get HasRepeater() {
2476
+ return Citizen.invokeNative("0x495A04CAEC263AF8", this.handle);
2477
+ }
2478
+ get CurrentWeapon() {
2479
+ const weapon = Citizen.invokeNative("0x8425C5F057012DAB", this.handle);
2480
+ return new WeaponModel(weapon);
2481
+ }
2482
+ async giveWeapon(weapon, ammoCount, forceInHand = true, forceInHolster = false, attachPoint = void 0, allowMultipleCopies = false, p7 = 0.5, p8 = 1, addReason = ItemAddReason.Default, ignoreUnlocks = true, permanentDegradation = 0.5, p12 = false) {
2483
+ if (!await weapon.request()) {
2484
+ return false;
2485
+ }
2486
+ attachPoint = attachPoint ?? weapon.DefaultAttachPoint;
2487
+ Citizen.invokeNative(
2488
+ "0x5E3BDDBCB83F3D84",
2489
+ this.handle,
2490
+ weapon.Hash,
2491
+ ammoCount,
2492
+ forceInHand,
2493
+ forceInHolster,
2494
+ attachPoint,
2495
+ allowMultipleCopies,
2496
+ p7,
2497
+ p8,
2498
+ addReason,
2499
+ ignoreUnlocks,
2500
+ permanentDegradation,
2501
+ p12
2502
+ );
2503
+ return true;
2504
+ }
2505
+ setCurrentWeapon(weapon, equipNow = true, attachPoint = WeaponAttachPoints.HandPrimary, p4 = false, p5 = false) {
2506
+ Citizen.invokeNative("0xADF692B254977C0C", this.handle, weapon.Hash, equipNow, attachPoint, p4, p5);
2507
+ }
2508
+ holsterWeapon() {
2509
+ Citizen.invokeNative("0x94A3C1B804D291EC", this.handle, true, true, true, true);
2510
+ }
2511
+ setWeaponOnBack(disableAnim = false) {
2512
+ Citizen.invokeNative("0x4820A6939D7CEF28", this.handle, disableAnim);
2513
+ }
2514
+ isHoldingWeapon(weapon) {
2515
+ return Citizen.invokeNative("0x07E1C35F0078C3F9", this.handle, weapon.Hash);
2516
+ }
2517
+ isHolsterStateChanging() {
2518
+ return Citizen.invokeNative("0x2387D6E9C6B478AA", this.handle);
2519
+ }
2520
+ };
2521
+ __name(_Ped, "Ped");
2522
+ __name24(_Ped, "Ped");
2523
+ var Ped = _Ped;
2524
+
2525
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/entities/Player.js
2526
+ var __defProp25 = Object.defineProperty;
2527
+ var __name25 = /* @__PURE__ */ __name((target, value) => __defProp25(target, "name", { value, configurable: true }), "__name");
2528
+ var handleUpgrade = /* @__PURE__ */ __name25((name, amount) => {
2529
+ const b1 = new ArrayBuffer(8 * 24);
2530
+ const a2 = new DataView(b1);
2531
+ const b2 = new ArrayBuffer(8 * 12);
2532
+ const a3 = new DataView(b2);
2533
+ _N("0xCB5D11F9508A928D", 1, a2, a3, GetHashKey(name), 1084182731, amount, 752097756);
2534
+ }, "handleUpgrade");
2535
+ var _Player = class _Player {
2536
+ /**
2537
+ * @param handle the player handle
2538
+ */
2539
+ constructor(handle) {
2540
+ __publicField(this, "handle");
2541
+ this.handle = handle;
2542
+ }
2543
+ static *AllPlayers(excludeLocalPlayer = true) {
2544
+ for (const ply of GetActivePlayers()) {
2545
+ if (excludeLocalPlayer && ply === GameConstants.PlayerId) {
2546
+ continue;
2547
+ }
2548
+ yield new _Player(ply);
2549
+ }
2550
+ }
2551
+ static fromPedHandle(handle) {
2552
+ return new _Player(NetworkGetPlayerIndexFromPed(handle));
2553
+ }
2554
+ /**
2555
+ * Gets the player from the specified {@param serverId}
2556
+ * @returns the player object, or null if the player didn't exist
2557
+ */
2558
+ static fromServerId(serverId) {
2559
+ if (serverId === GameConstants.ServerId) {
2560
+ return GameConstants.Player;
2561
+ }
2562
+ const player = GetPlayerFromServerId(serverId);
2563
+ if (player === -1) return null;
2564
+ return new _Player(player);
2565
+ }
2566
+ /**
2567
+ * @param [minimumDistance=Number.MAX_VALUE] the minimum distance this should check
2568
+ * @param [fromPlayer=GameConstants.Player] the player to get the distance from
2569
+ * @returns the closest player from {@param fromPlayer} and the distance the player was
2570
+ */
2571
+ static getClosestPlayerWithDistance(minimumDistance = Number.MAX_VALUE, fromPlayer = GameConstants.Player) {
2572
+ const ped = fromPlayer.Ped;
2573
+ const pos = ped.Position;
2574
+ const data = [null, Number.MAX_VALUE];
2575
+ for (const ply of _Player.AllPlayers(true)) {
2576
+ const tgtPed = ply.Ped;
2577
+ const dist = pos.distance(tgtPed.Position);
2578
+ if (dist < data[1] && dist < minimumDistance) {
2579
+ data[0] = ply;
2580
+ data[1] = dist;
2581
+ }
2582
+ }
2583
+ return data;
2584
+ }
2585
+ /**
2586
+ * @param [minimumDistance=Number.MAX_VALUE] the minimum distance this should check
2587
+ * @param [fromPlayer=GameConstants.Player] the player to get the distance from
2588
+ * @returns the closest player from {@param fromPlayer} and the distance the player was
2589
+ */
2590
+ static getClosestPlayer(minimumDistance = Number.MAX_VALUE, fromPlayer = GameConstants.Player) {
2591
+ const data = this.getClosestPlayerWithDistance(minimumDistance, fromPlayer);
2592
+ return data[0];
2593
+ }
2594
+ get Handle() {
2595
+ return this.handle;
2596
+ }
2597
+ get Ped() {
2598
+ return new Ped(GetPlayerPed(this.handle));
2599
+ }
2600
+ get ServerId() {
2601
+ return GetPlayerServerId(this.handle);
2602
+ }
2603
+ /**
2604
+ * Adds the amount of stamina player has on the hud
2605
+ * @param amount the amount of upgrade to give 6 is half the bar while 12 is the full bar
2606
+ */
2607
+ addStaminaUpgrade(amount) {
2608
+ handleUpgrade("UPGRADE_STAMINA_TANK_1", amount);
2609
+ }
2610
+ addHealthUpgrade(amount) {
2611
+ handleUpgrade("UPGRADE_HEALTH_TANK_1", amount);
2612
+ }
2613
+ addDeadeyeUpgrade(amount) {
2614
+ handleUpgrade("UPGRADE_DEADEYE_TANK_1", amount);
2615
+ }
2616
+ setOwnsMount(mount) {
2617
+ _N("0xE6D4E435B56D5BD0", this.handle, mount.Handle);
2618
+ }
2619
+ };
2620
+ __name(_Player, "Player");
2621
+ __name25(_Player, "Player");
2622
+ var Player2 = _Player;
2623
+
2624
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/GameConstants.js
2625
+ var __defProp26 = Object.defineProperty;
2626
+ var __name26 = /* @__PURE__ */ __name((target, value) => __defProp26(target, "name", { value, configurable: true }), "__name");
2627
+ var _GameConstants = class _GameConstants {
2628
+ // The player class of the local object
2629
+ static get Player() {
2630
+ if (_GameConstants.player === null) {
2631
+ _GameConstants.player = new Player2(_GameConstants.PlayerId);
2632
+ }
2633
+ return _GameConstants.player;
2634
+ }
2635
+ };
2636
+ __name(_GameConstants, "GameConstants");
2637
+ __name26(_GameConstants, "GameConstants");
2638
+ // the actual player object that will get initialized on the first call to the `get Player()`
2639
+ __publicField(_GameConstants, "player", null);
2640
+ // The player id of the local client
2641
+ __publicField(_GameConstants, "PlayerId", PlayerId());
2642
+ // The server id of the local client.
2643
+ __publicField(_GameConstants, "ServerId", GetPlayerServerId(_GameConstants.PlayerId));
2644
+ var GameConstants = _GameConstants;
2645
+
2646
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/world/createPed.js
2647
+ var __defProp27 = Object.defineProperty;
2648
+ var __name27 = /* @__PURE__ */ __name((target, value) => __defProp27(target, "name", { value, configurable: true }), "__name");
2649
+ async function createPed(model, spawnPos, heading, isNetwork = false, bScriptHostPed = true, p7 = true, p8 = true) {
2650
+ if (!model.IsPed || !model.request(1e3)) {
2651
+ return null;
2652
+ }
2653
+ const pedHandle = CreatePed(
2654
+ model.Hash,
2655
+ spawnPos.x,
2656
+ spawnPos.y,
2657
+ spawnPos.z,
2658
+ heading,
2659
+ isNetwork,
2660
+ bScriptHostPed,
2661
+ p7,
2662
+ p8
2663
+ );
2664
+ if (pedHandle !== 0) {
2665
+ model.markAsNoLongerNeeded();
2666
+ return new Ped(pedHandle);
2667
+ }
2668
+ return null;
2669
+ }
2670
+ __name(createPed, "createPed");
2671
+ __name27(createPed, "createPed");
2672
+
2673
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/entities/Prop.js
2674
+ var __defProp28 = Object.defineProperty;
2675
+ var __name28 = /* @__PURE__ */ __name((target, value) => __defProp28(target, "name", { value, configurable: true }), "__name");
2676
+ var _Prop = class _Prop extends BaseEntity {
2677
+ constructor() {
2678
+ super(...arguments);
2679
+ __publicField(this, "type", ClassTypes.Prop);
2680
+ __publicField(this, "bones");
2681
+ }
2682
+ get Bones() {
2683
+ this.bones = this.bones ?? new CommonEntityBoneCollection(this);
2684
+ return this.bones;
2685
+ }
2686
+ };
2687
+ __name(_Prop, "Prop");
2688
+ __name28(_Prop, "Prop");
2689
+ var Prop = _Prop;
2690
+
2691
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/world/createProp.js
2692
+ var __defProp29 = Object.defineProperty;
2693
+ var __name29 = /* @__PURE__ */ __name((target, value) => __defProp29(target, "name", { value, configurable: true }), "__name");
2694
+ async function createProp(model, spawnPos, heading, isNetwork = false, bScriptHostProp = true, dynamic = true, p7 = true, p8 = true) {
2695
+ if (!model.IsProp || !model.request(1e3)) {
2696
+ return null;
2697
+ }
2698
+ const propHandle = CreateObject(
2699
+ model.Hash,
2700
+ spawnPos.x,
2701
+ spawnPos.y,
2702
+ spawnPos.z,
2703
+ isNetwork,
2704
+ bScriptHostProp,
2705
+ dynamic,
2706
+ p7,
2707
+ p8
2708
+ );
2709
+ if (propHandle !== 0) {
2710
+ model.markAsNoLongerNeeded();
2711
+ return new Prop(propHandle);
2712
+ }
2713
+ return null;
2714
+ }
2715
+ __name(createProp, "createProp");
2716
+ __name29(createProp, "createProp");
2717
+
2718
+ // node_modules/.pnpm/@nativewrappers+redm@0.0.141/node_modules/@nativewrappers/redm/enums/AnimationFlags.js
2719
+ var AnimationFlags = /* @__PURE__ */ ((AnimationFlags2) => {
2720
+ AnimationFlags2[AnimationFlags2["Looping"] = 1] = "Looping";
2721
+ AnimationFlags2[AnimationFlags2["HoldLastFrame"] = 2] = "HoldLastFrame";
2722
+ AnimationFlags2[AnimationFlags2["NotInterruptable"] = 4] = "NotInterruptable";
2723
+ AnimationFlags2[AnimationFlags2["UpperBody"] = 8] = "UpperBody";
2724
+ AnimationFlags2[AnimationFlags2["Secondary"] = 16] = "Secondary";
2725
+ AnimationFlags2[AnimationFlags2["AbortOnPedMovement"] = 32] = "AbortOnPedMovement";
2726
+ AnimationFlags2[AnimationFlags2["Additive"] = 64] = "Additive";
2727
+ AnimationFlags2[AnimationFlags2["OverridePhysics"] = 128] = "OverridePhysics";
2728
+ AnimationFlags2[AnimationFlags2["ExtractInitialOffset"] = 256] = "ExtractInitialOffset";
2729
+ AnimationFlags2[AnimationFlags2["ExitAfterInterrupted"] = 512] = "ExitAfterInterrupted";
2730
+ AnimationFlags2[AnimationFlags2["TagSyncIn"] = 1024] = "TagSyncIn";
2731
+ AnimationFlags2[AnimationFlags2["TagSyncOut"] = 2048] = "TagSyncOut";
2732
+ AnimationFlags2[AnimationFlags2["TagSyncContinuous"] = 4096] = "TagSyncContinuous";
2733
+ AnimationFlags2[AnimationFlags2["ForceStart"] = 8192] = "ForceStart";
2734
+ AnimationFlags2[AnimationFlags2["UseKinematicPhysic"] = 16384] = "UseKinematicPhysic";
2735
+ AnimationFlags2[AnimationFlags2["UseMoverExtractions"] = 32768] = "UseMoverExtractions";
2736
+ AnimationFlags2[AnimationFlags2["DontSuppressLoco"] = 65536] = "DontSuppressLoco";
2737
+ AnimationFlags2[AnimationFlags2["EndsInDeadPose"] = 131072] = "EndsInDeadPose";
2738
+ AnimationFlags2[AnimationFlags2["ActivateRagdollOnCollision"] = 262144] = "ActivateRagdollOnCollision";
2739
+ AnimationFlags2[AnimationFlags2["DontExitOnDeath"] = 524288] = "DontExitOnDeath";
2740
+ AnimationFlags2[AnimationFlags2["AbortOnWeaponDamage"] = 1048576] = "AbortOnWeaponDamage";
2741
+ AnimationFlags2[AnimationFlags2["DisableForcedPhysicsUpdate"] = 2097152] = "DisableForcedPhysicsUpdate";
2742
+ AnimationFlags2[AnimationFlags2["Gesture"] = 4194304] = "Gesture";
2743
+ AnimationFlags2[AnimationFlags2["SkipIfBlockedByHigherPriorityTask"] = 8388608] = "SkipIfBlockedByHigherPriorityTask";
2744
+ AnimationFlags2[AnimationFlags2["UseAbsoluteMover"] = 16777216] = "UseAbsoluteMover";
2745
+ AnimationFlags2[AnimationFlags2["_0xC57F16E7"] = 33554432] = "_0xC57F16E7";
2746
+ AnimationFlags2[AnimationFlags2["UpperBodyTags"] = 67108864] = "UpperBodyTags";
2747
+ AnimationFlags2[AnimationFlags2["ProcessAttachmentOnStart"] = 134217728] = "ProcessAttachmentOnStart";
2748
+ AnimationFlags2[AnimationFlags2["ExpandPedCapsuleFromSkeleton"] = 268435456] = "ExpandPedCapsuleFromSkeleton";
2749
+ AnimationFlags2[AnimationFlags2["BlendoutWrtLastFrame"] = 536870912] = "BlendoutWrtLastFrame";
2750
+ AnimationFlags2[AnimationFlags2["DisablePhysicalActivation"] = 1073741824] = "DisablePhysicalActivation";
2751
+ AnimationFlags2[AnimationFlags2["DisableReleaseEvents"] = -2147483648] = "DisableReleaseEvents";
2752
+ return AnimationFlags2;
2753
+ })(AnimationFlags || {});
2754
+ var IkControlFlags = /* @__PURE__ */ ((IkControlFlags2) => {
2755
+ IkControlFlags2[IkControlFlags2["DisableLegIK"] = 1] = "DisableLegIK";
2756
+ IkControlFlags2[IkControlFlags2["DisableArmIK"] = 2] = "DisableArmIK";
2757
+ IkControlFlags2[IkControlFlags2["DisableHeadIK"] = 4] = "DisableHeadIK";
2758
+ IkControlFlags2[IkControlFlags2["DisableTorsoIK"] = 8] = "DisableTorsoIK";
2759
+ IkControlFlags2[IkControlFlags2["DisableTorsoReact"] = 16] = "DisableTorsoReact";
2760
+ IkControlFlags2[IkControlFlags2["UseLegAllowTags"] = 32] = "UseLegAllowTags";
2761
+ IkControlFlags2[IkControlFlags2["UseLegBlockTags"] = 64] = "UseLegBlockTags";
2762
+ IkControlFlags2[IkControlFlags2["UseArmAllowTags"] = 128] = "UseArmAllowTags";
2763
+ IkControlFlags2[IkControlFlags2["UseArmBlockTags"] = 256] = "UseArmBlockTags";
2764
+ IkControlFlags2[IkControlFlags2["ProcessWeaponHandGrip"] = 512] = "ProcessWeaponHandGrip";
2765
+ IkControlFlags2[IkControlFlags2["UseFPArmLeft"] = 1024] = "UseFPArmLeft";
2766
+ IkControlFlags2[IkControlFlags2["UseFPArmRight"] = 2048] = "UseFPArmRight";
2767
+ IkControlFlags2[IkControlFlags2["_0x88FF50BE"] = 4096] = "_0x88FF50BE";
2768
+ IkControlFlags2[IkControlFlags2["DisableTorsoVehicleIK"] = 8192] = "DisableTorsoVehicleIK";
2769
+ IkControlFlags2[IkControlFlags2["DisableProneIK"] = 16384] = "DisableProneIK";
2770
+ IkControlFlags2[IkControlFlags2["UpperBody"] = 32768] = "UpperBody";
2771
+ IkControlFlags2[IkControlFlags2["UpperBodyTags"] = 65536] = "UpperBodyTags";
2772
+ IkControlFlags2[IkControlFlags2["_0xFCDC149B"] = 131072] = "_0xFCDC149B";
2773
+ IkControlFlags2[IkControlFlags2["_0x5465E64A"] = 262144] = "_0x5465E64A";
2774
+ IkControlFlags2[IkControlFlags2["DisableLegPostureIK"] = 524288] = "DisableLegPostureIK";
2775
+ IkControlFlags2[IkControlFlags2["_0x32939A0E"] = 1048576] = "_0x32939A0E";
2776
+ IkControlFlags2[IkControlFlags2["BlockNonAnimSceneLooks"] = 2097152] = "BlockNonAnimSceneLooks";
2777
+ IkControlFlags2[IkControlFlags2["_0x3CC5DD38"] = 4194304] = "_0x3CC5DD38";
2778
+ IkControlFlags2[IkControlFlags2["_0xB819088C"] = 8388608] = "_0xB819088C";
2779
+ IkControlFlags2[IkControlFlags2["DisableContourIk"] = 16777216] = "DisableContourIk";
2780
+ IkControlFlags2[IkControlFlags2["_0xF9E28A5F"] = 33554432] = "_0xF9E28A5F";
2781
+ IkControlFlags2[IkControlFlags2["_0x983AE6C1"] = 67108864] = "_0x983AE6C1";
2782
+ IkControlFlags2[IkControlFlags2["_0x5B5D2BEF"] = 134217728] = "_0x5B5D2BEF";
2783
+ IkControlFlags2[IkControlFlags2["_0xA4F64B54"] = 268435456] = "_0xA4F64B54";
2784
+ IkControlFlags2[IkControlFlags2["DisableTwoBokeIK"] = 536870912] = "DisableTwoBokeIK";
2785
+ IkControlFlags2[IkControlFlags2["_0x0C1380EC"] = 1073741824] = "_0x0C1380EC";
2786
+ return IkControlFlags2;
2787
+ })(IkControlFlags || {});
2788
+
2789
+ // client/ped-handler.ts
2790
+ var pedConfigs = [];
2791
+ var activePeds = /* @__PURE__ */ new Map();
2792
+ function getConfigKey(config) {
2793
+ return `${config.coords.x}_${config.coords.y}_${config.coords.z}`;
2794
+ }
2795
+ __name(getConfigKey, "getConfigKey");
2796
+ function isPlayerNearCoords(playerPos, targetPos, distance) {
2797
+ const dx = playerPos.x - targetPos.x;
2798
+ const dy = playerPos.y - targetPos.y;
2799
+ const dz = playerPos.z - targetPos.z;
2800
+ return Math.sqrt(dx * dx + dy * dy + dz * dz) <= distance;
2801
+ }
2802
+ __name(isPlayerNearCoords, "isPlayerNearCoords");
2803
+ async function processSpawning(playerPos) {
2804
+ for (const config of pedConfigs) {
2805
+ const key = getConfigKey(config);
2806
+ const isNear = isPlayerNearCoords(playerPos, config.coords, config.spawnDistance);
2807
+ const isSpawned = activePeds.has(key);
2808
+ if (isNear && !isSpawned) {
2809
+ await spawnPed(config, key);
2810
+ } else if (!isNear && isSpawned) {
2811
+ despawnPed(key);
2812
+ }
2813
+ }
2814
+ }
2815
+ __name(processSpawning, "processSpawning");
2816
+ async function spawnPed(config, key) {
2817
+ const ped = await createPed(new Model(config.modelName), config.coords, 0, false, true);
2818
+ if (!ped) return;
2819
+ SetRandomOutfitVariation(ped.Handle, true);
2820
+ if (config.heading) {
2821
+ ped.Heading = config.heading;
2822
+ }
2823
+ if (config.animation) {
2824
+ await ped.Tasks.playAnimation(
2825
+ config.animation.dict,
2826
+ config.animation.anim,
2827
+ 8,
2828
+ 8,
2829
+ -1,
2830
+ 1,
2831
+ AnimationFlags.Looping,
2832
+ IkControlFlags.UpperBody
2833
+ );
2834
+ }
2835
+ let prop = null;
2836
+ if (config.propData) {
2837
+ prop = await createProp(new Model(config.propData.model), ped.Position, 0, true, true);
2838
+ if (prop) {
2839
+ AttachEntityToEntity(
2840
+ prop.Handle,
2841
+ ped.Handle,
2842
+ config.propData.boneId,
2843
+ config.propData.offset[0],
2844
+ config.propData.offset[1],
2845
+ config.propData.offset[2],
2846
+ config.propData.rotation[0],
2847
+ config.propData.rotation[1],
2848
+ config.propData.rotation[2],
2849
+ true,
2850
+ false,
2851
+ false,
2852
+ true,
2853
+ 1,
2854
+ true
2855
+ );
2856
+ }
2857
+ }
2858
+ activePeds.set(key, { ped, config, prop });
2859
+ }
2860
+ __name(spawnPed, "spawnPed");
2861
+ function despawnPed(key) {
2862
+ const activePed = activePeds.get(key);
2863
+ if (!activePed) return;
2864
+ if (activePed.prop) {
2865
+ activePed.prop.delete();
2866
+ }
2867
+ if (activePed.ped) {
2868
+ activePed.ped.delete();
2869
+ }
2870
+ activePeds.delete(key);
2871
+ }
2872
+ __name(despawnPed, "despawnPed");
2873
+ function cleanupPeds() {
2874
+ for (const [key, activePed] of activePeds) {
2875
+ if (activePed.prop) {
2876
+ activePed.prop.delete();
2877
+ }
2878
+ if (activePed.ped) {
2879
+ activePed.ped.delete();
2880
+ }
2881
+ activePeds.delete(key);
2882
+ }
2883
+ }
2884
+ __name(cleanupPeds, "cleanupPeds");
2885
+
2886
+ // client/main.ts
2887
+ setTick(async () => {
2888
+ const playerPed = PlayerPedId();
2889
+ if (!playerPed) {
2890
+ await Delay(500);
2891
+ return;
2892
+ }
2893
+ const coords = GetEntityCoords(playerPed, true, true);
2894
+ const playerPos = new Vector3(coords[0], coords[1], coords[2]);
2895
+ await processSpawning(playerPos);
2896
+ await Delay(500);
2897
+ });
2898
+ on("onResourceStop", (resourceName) => {
2899
+ if (resourceName !== GetCurrentResourceName()) return;
2900
+ console.log(`Restarting ${resourceName}`);
2901
+ cleanupPeds();
2902
+ });
2903
+ })();