@nativewrappers/redm 0.0.80 → 0.0.82

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.
Files changed (82) hide show
  1. package/Attribute.js +143 -0
  2. package/Controls.js +22 -0
  3. package/Game.d.ts +2 -2
  4. package/Game.js +18 -0
  5. package/GameConstants.d.ts +1 -1
  6. package/GameConstants.js +24 -0
  7. package/Model.js +153 -0
  8. package/RawControls.d.ts +1 -1
  9. package/RawControls.js +22 -0
  10. package/RelationshipGroup.js +72 -0
  11. package/Volume.d.ts +1 -1
  12. package/Volume.js +32 -0
  13. package/common/Command.js +111 -0
  14. package/common/Convar.js +58 -0
  15. package/common/GlobalData.js +16 -0
  16. package/common/Kvp.js +137 -0
  17. package/common/Resource.js +54 -0
  18. package/common/decors/Events.js +170 -0
  19. package/common/net/NetworkedMap.js +225 -0
  20. package/common/utils/ClassTypes.js +15 -0
  21. package/common/utils/Color.js +33 -0
  22. package/common/utils/Delay.d.ts +1 -0
  23. package/common/utils/Delay.js +6 -0
  24. package/common/utils/Maths.js +18 -0
  25. package/common/utils/Point.d.ts +9 -0
  26. package/common/utils/Point.js +36 -0
  27. package/common/utils/PointF.d.ts +1 -1
  28. package/common/utils/PointF.js +18 -0
  29. package/common/utils/Quaternion.d.ts +1 -1
  30. package/common/utils/Quaternion.js +33 -0
  31. package/common/utils/Vector.js +589 -0
  32. package/common/utils/cleanPlayerName.js +17 -0
  33. package/common/utils/enumValues.js +20 -0
  34. package/common/utils/getStringFromUInt8Array.js +6 -0
  35. package/common/utils/getUInt32FromUint8Array.js +6 -0
  36. package/definitions/Citizen.d.js +0 -0
  37. package/definitions/index.d.js +0 -0
  38. package/definitions/redm.d.js +0 -0
  39. package/entities/BaseEntity.d.ts +1 -1
  40. package/entities/BaseEntity.js +99 -0
  41. package/entities/Entity.d.ts +1 -1
  42. package/entities/Entity.js +99 -0
  43. package/entities/Ped.d.ts +1 -1
  44. package/entities/Ped.js +336 -0
  45. package/entities/Pickup.d.ts +4 -0
  46. package/entities/Pickup.js +14 -0
  47. package/entities/Player.js +57 -0
  48. package/entities/Prop.js +11 -0
  49. package/entities/Vehicle.d.ts +1 -1
  50. package/entities/Vehicle.js +23 -0
  51. package/enums/Attributes.js +56 -0
  52. package/enums/Entity.js +20 -0
  53. package/enums/Keys.js +809 -0
  54. package/enums/Ped.js +31 -0
  55. package/enums/RawKeys.js +234 -0
  56. package/enums/Relationship.js +13 -0
  57. package/enums/VehicleSeat.js +17 -0
  58. package/index.js +52 -3762
  59. package/interfaces/Dimensions.d.ts +1 -1
  60. package/interfaces/Dimensions.js +0 -0
  61. package/package.json +2 -2
  62. package/types/Throwable.js +0 -0
  63. package/utils/Native.js +8 -0
  64. package/world/createDraftVehicle.d.ts +2 -2
  65. package/world/createDraftVehicle.js +32 -0
  66. package/world/createPed.d.ts +2 -2
  67. package/world/createPed.js +28 -0
  68. package/world/createProp.d.ts +1 -1
  69. package/world/createProp.js +28 -0
  70. package/world/createVehicle.d.ts +2 -2
  71. package/world/createVehicle.js +28 -0
  72. package/common/index.d.ts +0 -8
  73. package/common/utils/Vector2.d.ts +0 -1
  74. package/common/utils/Vector3.d.ts +0 -1
  75. package/common/utils/Vector4.d.ts +0 -1
  76. package/common/utils/index.d.ts +0 -12
  77. package/entities/index.d.ts +0 -4
  78. package/enums/index.d.ts +0 -6
  79. package/index.d.ts +0 -12
  80. package/utils/index.d.ts +0 -2
  81. package/world/index.d.ts +0 -4
  82. /package/{game/index.d.ts → common/types.js} +0 -0
@@ -0,0 +1,20 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ function* enumValues(enumObj) {
4
+ let isStringEnum = true;
5
+ for (const property in enumObj) {
6
+ if (typeof enumObj[property] === "number") {
7
+ isStringEnum = false;
8
+ break;
9
+ }
10
+ }
11
+ for (const property in enumObj) {
12
+ if (isStringEnum || typeof enumObj[property] === "number") {
13
+ yield enumObj[property];
14
+ }
15
+ }
16
+ }
17
+ __name(enumValues, "enumValues");
18
+ export {
19
+ enumValues
20
+ };
@@ -0,0 +1,6 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ const getStringFromUInt8Array = /* @__PURE__ */ __name((buffer, start, end) => String.fromCharCode(...buffer.slice(start, end)).replace(/\u0000/g, ""), "getStringFromUInt8Array");
4
+ export {
5
+ getStringFromUInt8Array
6
+ };
@@ -0,0 +1,6 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ const getUInt32FromUint8Array = /* @__PURE__ */ __name((buffer, start, end) => new Uint32Array(buffer.slice(start, end).buffer)[0], "getUInt32FromUint8Array");
4
+ export {
5
+ getUInt32FromUint8Array
6
+ };
File without changes
File without changes
File without changes
@@ -1,4 +1,4 @@
1
- import { Vector3 } from "../common/utils";
1
+ import { Vector3 } from "../common/utils/Vector";
2
2
  export declare class BaseEntity {
3
3
  private handle;
4
4
  constructor(entHandle: number);
@@ -0,0 +1,99 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { Vector3 } from "../common/utils/Vector";
4
+ class BaseEntity {
5
+ static {
6
+ __name(this, "BaseEntity");
7
+ }
8
+ handle;
9
+ constructor(entHandle) {
10
+ this.handle = entHandle;
11
+ }
12
+ /**
13
+ * Replaces the current handle for the entity used on, this hsould be used sparringly, mainly
14
+ * in situations where you're going to reuse an entity over and over and don't want to make a
15
+ * new entity every time.
16
+ *
17
+ * **WARNING**: This does no checks, if you provide it an invalid entity it will use it
18
+ *
19
+ * ```ts
20
+ * const REUSABLE_ENTITY = new Entity(entityHandle);
21
+ *
22
+ * onNet("entityHandler", (entNetId: number) => {
23
+ * // if no net entity we should ignore
24
+ * if (!NetworkDoesEntityExistWithNetworkId(entNetId)) return;
25
+ *
26
+ * // Reuse our entity so we don't have to initialize a new one
27
+ * REUSABLE_ENTITY.replaceHandle(NetworkGetEntityFromNetworkId(entNetId));
28
+ * // Do something with REUSABLE_ENTITY entity
29
+ * })
30
+ ```
31
+ */
32
+ replaceHandle(newHandle) {
33
+ this.handle = newHandle;
34
+ }
35
+ /**
36
+ * @returns the network for the specified entity, this doesn't check if the entity is networked, you should use {@link BaseEntity.IsNetworked}
37
+ */
38
+ get NetworkId() {
39
+ return NetworkGetNetworkIdFromEntity(this.Handle);
40
+ }
41
+ /**
42
+ * @returns `true` if the current entity is networked, false otherwise
43
+ */
44
+ get IsNetworked() {
45
+ return NetworkGetEntityIsNetworked(this.Handle);
46
+ }
47
+ /**
48
+ * @returns Returns true if the entity handle is not 0 and exists in the game engine
49
+ */
50
+ get Exists() {
51
+ return this.handle !== 0 && DoesEntityExist(this.Handle);
52
+ }
53
+ /**
54
+ * @returns The entitys current handle.
55
+ */
56
+ get Handle() {
57
+ return this.handle;
58
+ }
59
+ /**
60
+ * @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.
61
+ */
62
+ set Health(amount) {
63
+ SetEntityHealth(this.Handle, amount, 0);
64
+ }
65
+ /**
66
+ * @returns the amount of health the current {@link BaseEntity} has
67
+ */
68
+ get Health() {
69
+ return GetEntityHealth(this.Handle);
70
+ }
71
+ /**
72
+ * @returns the heading of the current {@link BaseEntity}
73
+ */
74
+ get Heading() {
75
+ return GetEntityHeading(this.Handle);
76
+ }
77
+ /**
78
+ * @param heading sets the entitys heading to the specified heading, this can be in the range of 0..360
79
+ */
80
+ set Heading(heading) {
81
+ SetEntityHeading(this.Handle, heading);
82
+ }
83
+ /**
84
+ * @returns the position of the current Entity
85
+ */
86
+ get Position() {
87
+ return Vector3.fromArray(GetEntityCoords(this.handle, true, true));
88
+ }
89
+ /**
90
+ * You should (almost) always try to load the collisions before setting the entitys position if going a long distance.
91
+ * @param pos sets the position for the current ped
92
+ */
93
+ set Position(pos) {
94
+ SetEntityCoords(this.handle, pos.x, pos.y, pos.z, false, false, false, false);
95
+ }
96
+ }
97
+ export {
98
+ BaseEntity
99
+ };
@@ -1,6 +1,6 @@
1
+ import type { Vector3 } from "../common/utils/Vector";
1
2
  import { type BoneIndex, EntityType, ForceType } from "../enums/Entity";
2
3
  import type { Throwable } from "../types/Throwable";
3
- import { type Vector3 } from "../utils";
4
4
  import { BaseEntity } from "./BaseEntity";
5
5
  export declare class Entity extends BaseEntity {
6
6
  constructor(handle: number);
@@ -0,0 +1,99 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { _N } from "redm/utils/Native";
4
+ import { EntityType, ForceType } from "../enums/Entity";
5
+ import { BaseEntity } from "./BaseEntity";
6
+ class Entity extends BaseEntity {
7
+ static {
8
+ __name(this, "Entity");
9
+ }
10
+ // NOTE: There is nothing stopping you from using creating an invalid entity, you should do your own due-diligence
11
+ constructor(handle) {
12
+ super(handle);
13
+ }
14
+ addTrackingTrails() {
15
+ _N("0x1AD922AB5038DEF3", this.Handle);
16
+ }
17
+ get EntityType() {
18
+ return GetEntityType(this.Handle);
19
+ }
20
+ /**
21
+ * @param direction - the direction to apply the force towards
22
+ * @param offset - the offset to apply the force to
23
+ * @param forceType - the force type to apply
24
+ * @param boneIndex - the boneIndex to apply the force to, or 0
25
+ * @param isDirectional - whether the direction is relational?
26
+ * @param ignoreUpVec - ?
27
+ * @param isForceRel - whether to multiply the force by the object mass & acceleration
28
+ */
29
+ applyForce(direction, offset, forceType = ForceType.MinForce, boneIndex = 0, isDirectional = false, ignoreUpVec = true, isForceRel = true) {
30
+ const d = direction;
31
+ const o = offset;
32
+ ApplyForceToEntity(
33
+ this.Handle,
34
+ forceType,
35
+ d.x,
36
+ d.y,
37
+ d.z,
38
+ o.x,
39
+ o.y,
40
+ o.z,
41
+ boneIndex,
42
+ isDirectional,
43
+ ignoreUpVec,
44
+ isForceRel,
45
+ false,
46
+ true
47
+ );
48
+ }
49
+ /**
50
+ * @param direction - the direction to apply the force towards
51
+ * @param forceType - the force type to use
52
+ * @param isDirectional - whether the direction is local?
53
+ * @param isForceRel - whether to multiply the force by the object mass & acceleration
54
+ */
55
+ applyForceToCenter(direction, forceType = ForceType.MinForce, isDirectional = false, isForceRel = true) {
56
+ const d = direction;
57
+ ApplyForceToEntityCenterOfMass(this.Handle, forceType, d.x, d.y, d.z, false, isDirectional, isForceRel, false);
58
+ }
59
+ /**
60
+ * @param tgtEntity - the entity to attach to the {@Entity}
61
+ * @param pos - the position offset
62
+ * @param rot - the rotation to apply to the entity
63
+ * @param boneIndex - the bone to attach the entity to, or 0 for the center of the entity
64
+ * @param enableCollision - whether the entity should have collision enabled
65
+ * @param useSoftPinning - when false the entity will not detach from the {@Entity}
66
+ * @param vertexIndex - ?
67
+ * @param fixedRot - ?
68
+ * @throws Error if tgtEntity and {@Entity} are the same entity
69
+ */
70
+ attachTo(tgtEntity, pos, rot, boneIndex = 0, enableCollision = true, useSoftPinning = false, vertexIndex = 0, fixedRot = true) {
71
+ if (tgtEntity.Handle === this.Handle) {
72
+ throw new Error("tgtEntity had the same handle as the current entity, attaching an entity to itself will crash");
73
+ }
74
+ const p = pos;
75
+ const r = rot;
76
+ AttachEntityToEntity(
77
+ tgtEntity.Handle,
78
+ this.Handle,
79
+ boneIndex,
80
+ p.x,
81
+ p.y,
82
+ p.z,
83
+ r.x,
84
+ r.y,
85
+ r.z,
86
+ false,
87
+ useSoftPinning,
88
+ enableCollision,
89
+ this.EntityType === EntityType.Ped,
90
+ vertexIndex,
91
+ fixedRot,
92
+ false,
93
+ false
94
+ );
95
+ }
96
+ }
97
+ export {
98
+ Entity
99
+ };
package/entities/Ped.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { Attributes } from "../Attribute";
2
2
  import type { eDamageCleanliness, KnockOffVehicle, TamingState } from "../enums/Ped";
3
3
  import type { VehicleSeat } from "../enums/VehicleSeat";
4
- import { type Vector3 } from "../utils";
5
4
  import { BaseEntity } from "./BaseEntity";
6
5
  import { Vehicle } from "./Vehicle";
7
6
  import type { Player } from "./Player";
7
+ import type { Vector3 } from "../common/utils/Vector";
8
8
  export declare class Ped extends BaseEntity {
9
9
  private attributes;
10
10
  constructor(handle: number);
@@ -0,0 +1,336 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { Attributes } from "../Attribute";
4
+ import { BaseEntity } from "./BaseEntity";
5
+ import { Vehicle } from "./Vehicle";
6
+ import { _N } from "redm/utils/Native";
7
+ class Ped extends BaseEntity {
8
+ static {
9
+ __name(this, "Ped");
10
+ }
11
+ attributes;
12
+ constructor(handle) {
13
+ super(handle);
14
+ }
15
+ /**
16
+ * Blocks scenarios inbetween the specified vectors
17
+ * @todo Move to Game
18
+ * @param vec1
19
+ * @param vec2
20
+ * @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)
21
+ * @returns the scenarioId that can be used in {@link removeScenarioBlock} to unblock
22
+ */
23
+ static blockScenariosInArea(vec1, vec2, blockingFlags) {
24
+ return AddScenarioBlockingArea(
25
+ vec1.x,
26
+ vec1.y,
27
+ vec1.z,
28
+ vec2.x,
29
+ vec2.y,
30
+ vec2.z,
31
+ true,
32
+ blockingFlags
33
+ );
34
+ }
35
+ /**
36
+ * Removes the blocking of scenarios in the specified area
37
+ * @param scenarioId the number returned from {@link blockScenariosInArea}
38
+ */
39
+ static removeScenarioBlock(scenarioId) {
40
+ RemoveScenarioBlockingArea(scenarioId, false);
41
+ }
42
+ /**
43
+ * While this increases the peds max health, if used on a player it wont increase the max core value on the hud
44
+ */
45
+ set MaxHealth(amount) {
46
+ SetPedMaxHealth(this.Handle, amount);
47
+ }
48
+ /**
49
+ * @returns the maximum health of the ped
50
+ */
51
+ get MaxHealth() {
52
+ return GetPedMaxHealth(this.Handle);
53
+ }
54
+ /**
55
+ * @returns the {@link Attributes} for the current ped
56
+ */
57
+ get Attributes() {
58
+ if (this.attributes) return this.attributes;
59
+ return this.attributes = new Attributes(this);
60
+ }
61
+ get InVehicle() {
62
+ return IsPedInAnyVehicle(this.Handle, true);
63
+ }
64
+ get IsInjured() {
65
+ return IsPedInjured(this.Handle);
66
+ }
67
+ get IsFatallyInjured() {
68
+ return IsPedFatallyInjured(this.Handle);
69
+ }
70
+ get IsPlayer() {
71
+ return IsPedAPlayer(this.Handle);
72
+ }
73
+ get IsShooting() {
74
+ return IsPedShooting(this.Handle);
75
+ }
76
+ get Accuracy() {
77
+ return GetPedAccuracy(this.Handle);
78
+ }
79
+ set Accuracy(accuracy) {
80
+ SetPedAccuracy(this.Handle, accuracy);
81
+ }
82
+ get CanBeKnockedOffVehicle() {
83
+ return CanKnockPedOffVehicle(this.Handle);
84
+ }
85
+ get IsMale() {
86
+ return IsPedMale(this.Handle);
87
+ }
88
+ get IsHuman() {
89
+ return IsPedHuman(this.Handle);
90
+ }
91
+ get IsOnTopOfVehicle() {
92
+ return IsPedOnVehicle(this.Handle, false);
93
+ }
94
+ get Vehicle() {
95
+ const vehicle = GetVehiclePedIsIn(this.Handle, false);
96
+ if (vehicle === 0) {
97
+ return null;
98
+ }
99
+ return new Vehicle(vehicle);
100
+ }
101
+ /**
102
+ * @returns the last mount that this ped was on, or null if it doesn't exist
103
+ */
104
+ get Mount() {
105
+ const pedId = _N("0x4C8B59171957BCF7", this.Handle, Citizen.resultAsInteger());
106
+ return pedId ? new Ped(pedId) : null;
107
+ }
108
+ /**
109
+ * returns the horse that this ped is leading
110
+ */
111
+ get LeadingHorse() {
112
+ const pedId = _N("0x693126B5D0457D0D", this.Handle, Citizen.resultAsInteger());
113
+ return pedId ? new Ped(pedId) : null;
114
+ }
115
+ /**
116
+ * returns the owner of the current animal
117
+ */
118
+ get Owner() {
119
+ const pedId = _N("0xF103823FFE72BB49", this.Handle, Citizen.resultAsInteger());
120
+ return pedId ? new Ped(pedId) : null;
121
+ }
122
+ get TamingState() {
123
+ return _N("0x454AD4DA6C41B5BD", this.Handle, Citizen.resultAsInteger());
124
+ }
125
+ get IsInteractingWithAnimal() {
126
+ return _N("0x7FC84E85D98F063D", this.Handle, Citizen.resultAsInteger());
127
+ }
128
+ get IsSittingInAnyVehicle() {
129
+ return IsPedSittingInAnyVehicle(this.Handle);
130
+ }
131
+ get IsPlantingBomb() {
132
+ return IsPedPlantingBomb(this.Handle);
133
+ }
134
+ get IsInAnyBoat() {
135
+ return IsPedInAnyBoat(this.Handle);
136
+ }
137
+ get IsInAnyHeli() {
138
+ return IsPedInAnyHeli(this.Handle);
139
+ }
140
+ get IsInAnyPlane() {
141
+ return IsPedInAnyPlane(this.Handle);
142
+ }
143
+ get IsInFlyingVehicle() {
144
+ return IsPedInFlyingVehicle(this.Handle);
145
+ }
146
+ get IsFalling() {
147
+ return IsPedFalling(this.Handle);
148
+ }
149
+ get IsSliding() {
150
+ return _N("0xD6740E14E4CEFC0B", this.Handle, Citizen.resultAsInteger());
151
+ }
152
+ get IsJumping() {
153
+ return IsPedJumping(this.Handle);
154
+ }
155
+ get IsClimbing() {
156
+ return IsPedClimbing(this.Handle);
157
+ }
158
+ get IsClimbingLadder() {
159
+ return _N("0x59643424B68D52B5", this.Handle, Citizen.resultAsInteger());
160
+ }
161
+ get IsVaulting() {
162
+ return IsPedVaulting(this.Handle);
163
+ }
164
+ get IsDiving() {
165
+ return IsPedDiving(this.Handle);
166
+ }
167
+ get IsOpeningADoor() {
168
+ return IsPedOpeningADoor(this.Handle);
169
+ }
170
+ set SeeingRange(value) {
171
+ SetPedSeeingRange(this.Handle, value);
172
+ }
173
+ set HearingRange(value) {
174
+ SetPedHearingRange(this.Handle, value);
175
+ }
176
+ get IsStealthed() {
177
+ return GetPedStealthMovement(this.Handle);
178
+ }
179
+ get IsJacking() {
180
+ return IsPedJacking(this.Handle);
181
+ }
182
+ get IsStunned() {
183
+ return IsPedBeingStunned(this.Handle, 0);
184
+ }
185
+ get IsBeingJacked() {
186
+ return IsPedBeingJacked(this.Handle);
187
+ }
188
+ get IsInCombatRoll() {
189
+ return _N("0xC48A9EB0D499B3E5", this.Handle, Citizen.resultAsInteger());
190
+ }
191
+ get CrouchMovement() {
192
+ return _N("0xD5FE956C70FF370B", this.Handle, Citizen.resultAsInteger());
193
+ }
194
+ /**
195
+ * returns true if {@link DamageCleanliness} was ever lower than {@link eDamageCleanliness.Good}
196
+ */
197
+ get IsDamaged() {
198
+ return _N("0x6CFC373008A1EDAF", this.Handle, Citizen.resultAsInteger());
199
+ }
200
+ set IsDamaged(damaged) {
201
+ _N("0xDACE03C65C6666DB", this.Handle, damaged);
202
+ }
203
+ get DamageCleanliness() {
204
+ return _N("0x88EFFED5FE8B0B4A", this.Handle, Citizen.resultAsInteger());
205
+ }
206
+ set DamageCleanliness(cleanliness) {
207
+ _N("0x7528720101A807A5", this.Handle, cleanliness);
208
+ }
209
+ set DefenseModifier(amount) {
210
+ _N("0x9B6808EC46BE849B", this.Handle, amount);
211
+ }
212
+ set CanBeTargeted(toggle) {
213
+ SetPedCanBeTargetted(this.Handle, toggle);
214
+ }
215
+ // TODO: Team class wrapper
216
+ // TODO: Bone wrapper `GET_PED_LAST_DAMAGE_BONE`
217
+ /**
218
+ * returns the ped who jacked this ped
219
+ */
220
+ getJacker() {
221
+ return new Ped(GetPedsJacker(this.Handle));
222
+ }
223
+ setCrouchMovement(state, immediately = false) {
224
+ _N("0x7DE9692C6F64CFE8", this.Handle, state, 0, immediately);
225
+ }
226
+ canBeTargetedByPlayer(player, toggle) {
227
+ SetPedCanBeTargettedByPlayer(this.Handle, player.Handle, toggle);
228
+ }
229
+ clearLastBoneDamage() {
230
+ ClearPedLastDamageBone(this.Handle);
231
+ }
232
+ set OwnsAnimal(animal) {
233
+ _N("0x931B241409216C1F", this.Handle, animal.Handle, false);
234
+ }
235
+ isInteractionPossible(animal) {
236
+ return _N("0xD543D3A8FDE4F185", this.Handle, animal.Handle, Citizen.resultAsInteger());
237
+ }
238
+ isOnVehicle(vehicle) {
239
+ return IsPedOnSpecificVehicle(this.Handle, vehicle.Handle);
240
+ }
241
+ isSittingInVehicle(vehicle) {
242
+ return IsPedSittingInVehicle(this.Handle, vehicle.Handle);
243
+ }
244
+ warpOutOfVehicle() {
245
+ _N("0xE0B61ED8BB37712F", this.Handle);
246
+ }
247
+ /**
248
+ * puts the ped onto the specified mount
249
+ * @param targetPed the horse to put the ped on
250
+ * @param seatIndex the seat index to put the ped on
251
+ */
252
+ setOntoMount(targetPed, seatIndex) {
253
+ _N("0x028F76B6E78246EB", this.Handle, targetPed.Handle, seatIndex, true);
254
+ }
255
+ removeFromMount() {
256
+ _N("0x5337B721C51883A9", this.Handle, true, true);
257
+ }
258
+ /**
259
+ * Sets the ped into the specified vehicle
260
+ * @param vehicle the vehicle to put the ped into
261
+ * @param seatIndex the seat index to put the ped into
262
+ */
263
+ setIntoVehicle(vehicle, seatIndex) {
264
+ SetPedIntoVehicle(this.Handle, vehicle.Handle, seatIndex);
265
+ }
266
+ /**
267
+ * kills the ped and optionally sets the killer
268
+ * @param killer the entity that killed the ped
269
+ */
270
+ killPed(killer) {
271
+ SetEntityHealth(this.Handle, 0, killer ? killer.Handle : 0);
272
+ }
273
+ damage(amount, boneId = 0, killer) {
274
+ ApplyDamageToPed(this.Handle, amount, 0, boneId, killer ? killer.Handle : 0);
275
+ }
276
+ /**
277
+ * this returns a different type then the getter so we can't use set, maybe ts will fix soon (tm)
278
+ * @param state how hard it will be to knock a ped off their vehicle
279
+ */
280
+ setCanBeKnockedOffVehicle(state) {
281
+ SetPedCanBeKnockedOffVehicle(this.Handle, state);
282
+ }
283
+ /**
284
+ * Removes the specified ped if its not a player entity
285
+ */
286
+ delete() {
287
+ SetEntityAsMissionEntity(this.Handle, true, true);
288
+ DeletePed(this.Handle);
289
+ }
290
+ /**
291
+ * creates a clone of the ped
292
+ * @param network if the ped should be a networked entity
293
+ * @param bScriptHostPed whether to register the ped as pinned to the script host in the R* network model.
294
+ * @param copyHeadBlend whether to copy the peds head blend
295
+ * @returns the cloned ped
296
+ */
297
+ clone(network, bScriptHostPed, copyHeadBlend) {
298
+ return new Ped(ClonePed(this.Handle, network, bScriptHostPed, copyHeadBlend));
299
+ }
300
+ /**
301
+ * clones the ped onto the target ped
302
+ * @param targetPed the ped to clone onto
303
+ */
304
+ cloneTo(targetPed) {
305
+ ClonePedToTarget(this.Handle, targetPed.Handle);
306
+ }
307
+ /**
308
+ * @param amount - the amount of armour to add to the ped
309
+ */
310
+ addArmour(amount) {
311
+ AddArmourToPed(this.Handle, amount);
312
+ }
313
+ applyDamage(damageAmount, boneId = 0, pedKiller = null) {
314
+ ApplyDamageToPed(this.Handle, damageAmount, 0, boneId, pedKiller ? pedKiller.Handle : 0);
315
+ }
316
+ /**
317
+ * @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
318
+ * @param damage - the damage to apply
319
+ * @param mult - the multiplier?
320
+ */
321
+ applyDamagePack(damagePack, damage, mult) {
322
+ ApplyPedDamagePack(this.Handle, damagePack, damage, mult);
323
+ }
324
+ get CurrentVehicle() {
325
+ const veh = GetVehiclePedIsIn(this.Handle, false);
326
+ if (veh === 0) return null;
327
+ return new Vehicle(veh);
328
+ }
329
+ // No documentation
330
+ // applyBloodSpecific() {
331
+ // ApplyPedBloodSpecific
332
+ // }
333
+ }
334
+ export {
335
+ Ped
336
+ };
@@ -0,0 +1,4 @@
1
+ export declare class Pickup {
2
+ handle: number;
3
+ constructor(handle: number);
4
+ }
@@ -0,0 +1,14 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ class Pickup {
4
+ static {
5
+ __name(this, "Pickup");
6
+ }
7
+ handle;
8
+ constructor(handle) {
9
+ this.handle = handle;
10
+ }
11
+ }
12
+ export {
13
+ Pickup
14
+ };
@@ -0,0 +1,57 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { GameConstants } from "redm/GameConstants";
4
+ import { _N } from "../utils/Native";
5
+ const handleUpgrade = /* @__PURE__ */ __name((name, amount) => {
6
+ const b1 = new ArrayBuffer(8 * 24);
7
+ const a2 = new DataView(b1);
8
+ const b2 = new ArrayBuffer(8 * 12);
9
+ const a3 = new DataView(b2);
10
+ _N("0xCB5D11F9508A928D", 1, a2, a3, GetHashKey(name), 1084182731, amount, 752097756);
11
+ }, "handleUpgrade");
12
+ class Player {
13
+ static {
14
+ __name(this, "Player");
15
+ }
16
+ handle;
17
+ static fromPedHandle(handle) {
18
+ return new Player(NetworkGetPlayerIndexFromPed(handle));
19
+ }
20
+ /**
21
+ * Gets the player from the specified {@param serverId}
22
+ * @returns the player object, or null if the player didn't exist
23
+ */
24
+ static fromServerId(serverId) {
25
+ if (serverId === GameConstants.ServerId) {
26
+ return GameConstants.Player;
27
+ }
28
+ const player = GetPlayerFromServerId(serverId);
29
+ if (player === -1) return null;
30
+ return new Player(player);
31
+ }
32
+ /**
33
+ * @param handle the player handle
34
+ */
35
+ constructor(handle) {
36
+ this.handle = handle;
37
+ }
38
+ get Handle() {
39
+ return this.handle;
40
+ }
41
+ /**
42
+ * Adds the amount of stamina player has on the hud
43
+ * @param amount the amount of upgrade to give 6 is half the bar while 12 is the full bar
44
+ */
45
+ addStaminaUpgrade(amount) {
46
+ handleUpgrade("UPGRADE_STAMINA_TANK_1", amount);
47
+ }
48
+ addHealthUpgrade(amount) {
49
+ handleUpgrade("UPGRADE_HEALTH_TANK_1", amount);
50
+ }
51
+ addDeadeyeUpgrade(amount) {
52
+ handleUpgrade("UPGRADE_DEADEYE_TANK_1", amount);
53
+ }
54
+ }
55
+ export {
56
+ Player
57
+ };
@@ -0,0 +1,11 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { BaseEntity } from "./BaseEntity";
4
+ class Prop extends BaseEntity {
5
+ static {
6
+ __name(this, "Prop");
7
+ }
8
+ }
9
+ export {
10
+ Prop
11
+ };