@nativewrappers/redm 0.0.44
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/Attribute.d.ts +65 -0
- package/Attribute.js +143 -0
- package/RelationshipGroup.d.ts +49 -0
- package/RelationshipGroup.js +67 -0
- package/Volume.d.ts +6 -0
- package/Volume.js +13 -0
- package/entities/BaseEntity.d.ts +7 -0
- package/entities/BaseEntity.js +15 -0
- package/entities/Entity.d.ts +38 -0
- package/entities/Entity.js +58 -0
- package/entities/Ped.d.ts +167 -0
- package/entities/Ped.js +334 -0
- package/entities/Player.d.ts +21 -0
- package/entities/Player.js +43 -0
- package/entities/Vehicle.d.ts +4 -0
- package/entities/Vehicle.js +6 -0
- package/entities/index.d.ts +4 -0
- package/entities/index.js +4 -0
- package/enums/Attributes.d.ts +48 -0
- package/enums/Attributes.js +51 -0
- package/enums/Entity.d.ts +15 -0
- package/enums/Entity.js +16 -0
- package/enums/Keys.d.ts +8 -0
- package/enums/Keys.js +9 -0
- package/enums/Ped.d.ts +23 -0
- package/enums/Ped.js +26 -0
- package/enums/Relationship.d.ts +9 -0
- package/enums/Relationship.js +10 -0
- package/enums/VehicleSeat.d.ts +13 -0
- package/enums/VehicleSeat.js +14 -0
- package/enums/index.d.ts +4 -0
- package/enums/index.js +4 -0
- package/index.d.ts +5 -0
- package/index.js +5 -0
- package/package.json +33 -0
- package/types/Throwable.d.ts +4 -0
- package/types/Throwable.js +4 -0
- package/utils/Native.d.ts +7 -0
- package/utils/Native.js +9 -0
- package/utils/index.d.ts +2 -0
- package/utils/index.js +2 -0
package/Attribute.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { eAttributeCore, ePedAttribute, eHudStatusEffect } from "./enums/Attributes";
|
|
2
|
+
import { Ped } from "./entities/Ped";
|
|
3
|
+
export declare class CoreAttribute {
|
|
4
|
+
private handle;
|
|
5
|
+
private attribute;
|
|
6
|
+
constructor(ped: Ped, attribute: eAttributeCore);
|
|
7
|
+
/**
|
|
8
|
+
* This doesn't seem to actually do anything
|
|
9
|
+
* @todo maybe remove unless theres a valid use case
|
|
10
|
+
* @param amount
|
|
11
|
+
* @param makeSound
|
|
12
|
+
*/
|
|
13
|
+
enableOverpower(amount: number, makeSound?: boolean): void;
|
|
14
|
+
get Overpowered(): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* @returns the amount of overpower time left in seconds
|
|
17
|
+
*/
|
|
18
|
+
get OverpoweredTimeLeft(): number;
|
|
19
|
+
/**
|
|
20
|
+
* Returns how full the core is
|
|
21
|
+
*/
|
|
22
|
+
get CoreValue(): number;
|
|
23
|
+
set CoreValue(amount: number);
|
|
24
|
+
}
|
|
25
|
+
export declare class PedAttribute {
|
|
26
|
+
private handle;
|
|
27
|
+
private attribute;
|
|
28
|
+
constructor(ped: Ped, attribute: ePedAttribute);
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
* @param amount the amount of points to add to the attribute
|
|
32
|
+
*/
|
|
33
|
+
addPoints(amount: number): void;
|
|
34
|
+
/**
|
|
35
|
+
* Disables the overpower state on this attribute, see {@link enableOverpower} on how to enable
|
|
36
|
+
*/
|
|
37
|
+
disableOverpower(): void;
|
|
38
|
+
/**
|
|
39
|
+
*
|
|
40
|
+
* @param amount the amount to overpower this attribute by
|
|
41
|
+
* @param makeSound if activating the overpower should play sound
|
|
42
|
+
*/
|
|
43
|
+
enableOverpower(amount: number, makeSound?: boolean): void;
|
|
44
|
+
/**
|
|
45
|
+
* Gets the amount of attribute points the ped has
|
|
46
|
+
*/
|
|
47
|
+
get Points(): number;
|
|
48
|
+
set Points(amount: number);
|
|
49
|
+
get Rank(): number;
|
|
50
|
+
set BaseRank(amount: number);
|
|
51
|
+
get BaseRank(): number;
|
|
52
|
+
set BonusRank(amount: number);
|
|
53
|
+
get BonusRank(): number;
|
|
54
|
+
get MaxRank(): number;
|
|
55
|
+
get Overpowered(): boolean;
|
|
56
|
+
}
|
|
57
|
+
export declare class Attributes {
|
|
58
|
+
private pedAttributes;
|
|
59
|
+
private coreAttributes;
|
|
60
|
+
constructor(ped: Ped);
|
|
61
|
+
getCore(attribute: eAttributeCore): CoreAttribute;
|
|
62
|
+
get(attribute: ePedAttribute): PedAttribute;
|
|
63
|
+
set CoreIcon(status: eHudStatusEffect);
|
|
64
|
+
set PeriodicIcon(status: eHudStatusEffect);
|
|
65
|
+
}
|
package/Attribute.js
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { _N } from "./utils/Native";
|
|
2
|
+
export class CoreAttribute {
|
|
3
|
+
handle;
|
|
4
|
+
attribute;
|
|
5
|
+
constructor(ped, attribute) {
|
|
6
|
+
this.handle = ped.Handle;
|
|
7
|
+
this.attribute = attribute;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* This doesn't seem to actually do anything
|
|
11
|
+
* @todo maybe remove unless theres a valid use case
|
|
12
|
+
* @param amount
|
|
13
|
+
* @param makeSound
|
|
14
|
+
*/
|
|
15
|
+
enableOverpower(amount, makeSound = false) {
|
|
16
|
+
// EnableAttributeCoreOverpower
|
|
17
|
+
_N("0x4AF5A4C7B9157D14", this.handle, this.attribute, amount, makeSound);
|
|
18
|
+
}
|
|
19
|
+
get Overpowered() {
|
|
20
|
+
return _N("0x200373A8DF081F22", this.attribute, Citizen.resultAsInteger());
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @returns the amount of overpower time left in seconds
|
|
24
|
+
*/
|
|
25
|
+
get OverpoweredTimeLeft() {
|
|
26
|
+
// GetAttributeCoreOverpowerSecondsLeft
|
|
27
|
+
return _N("0xB429F58803D285B1", this.handle, this.attribute, Citizen.resultAsInteger());
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Returns how full the core is
|
|
31
|
+
*/
|
|
32
|
+
get CoreValue() {
|
|
33
|
+
return GetAttributeCoreValue(this.handle, this.attribute);
|
|
34
|
+
}
|
|
35
|
+
set CoreValue(amount) {
|
|
36
|
+
// SetAttributeCoreValue
|
|
37
|
+
_N("0xC6258F41D86676E0", this.handle, this.attribute, amount);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export class PedAttribute {
|
|
41
|
+
handle;
|
|
42
|
+
attribute;
|
|
43
|
+
constructor(ped, attribute) {
|
|
44
|
+
this.handle = ped.Handle;
|
|
45
|
+
this.attribute = attribute;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
*
|
|
49
|
+
* @param amount the amount of points to add to the attribute
|
|
50
|
+
*/
|
|
51
|
+
addPoints(amount) {
|
|
52
|
+
AddAttributePoints(this.handle, this.attribute, amount);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Disables the overpower state on this attribute, see {@link enableOverpower} on how to enable
|
|
56
|
+
*/
|
|
57
|
+
disableOverpower() {
|
|
58
|
+
DisableAttributeOverpower(this.handle, this.attribute);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
*
|
|
62
|
+
* @param amount the amount to overpower this attribute by
|
|
63
|
+
* @param makeSound if activating the overpower should play sound
|
|
64
|
+
*/
|
|
65
|
+
enableOverpower(amount, makeSound = false) {
|
|
66
|
+
// EnableAttributeOverpower
|
|
67
|
+
_N("0xF6A7C08DF2E28B28", this.handle, this.attribute, amount, makeSound);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Gets the amount of attribute points the ped has
|
|
71
|
+
*/
|
|
72
|
+
get Points() {
|
|
73
|
+
return GetAttributePoints(this.handle, this.attribute);
|
|
74
|
+
}
|
|
75
|
+
set Points(amount) {
|
|
76
|
+
SetAttributePoints(this.handle, this.attribute, amount);
|
|
77
|
+
}
|
|
78
|
+
get Rank() {
|
|
79
|
+
return GetAttributeRank(this.handle, this.attribute);
|
|
80
|
+
}
|
|
81
|
+
set BaseRank(amount) {
|
|
82
|
+
SetAttributeBaseRank(this.handle, this.attribute, amount);
|
|
83
|
+
}
|
|
84
|
+
get BaseRank() {
|
|
85
|
+
return GetAttributeBaseRank(this.handle, this.attribute);
|
|
86
|
+
}
|
|
87
|
+
set BonusRank(amount) {
|
|
88
|
+
SetAttributeBonusRank(this.handle, this.attribute, amount);
|
|
89
|
+
}
|
|
90
|
+
get BonusRank() {
|
|
91
|
+
return GetAttributeBonusRank(this.handle, this.attribute);
|
|
92
|
+
}
|
|
93
|
+
get MaxRank() {
|
|
94
|
+
// GetMaxAttributeRank
|
|
95
|
+
return _N("0x704674A0535A471D", this.attribute, Citizen.resultAsInteger());
|
|
96
|
+
}
|
|
97
|
+
get Overpowered() {
|
|
98
|
+
// IsAttributeOverpowered
|
|
99
|
+
return _N("0x103C2F885ABEB00B", this.attribute, Citizen.resultAsInteger());
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
// There's probably a better way to do this but this will do for now as it reduces repetition
|
|
103
|
+
export class Attributes {
|
|
104
|
+
pedAttributes = [];
|
|
105
|
+
coreAttributes = [];
|
|
106
|
+
constructor(ped) {
|
|
107
|
+
for (let i = 0; i <= 21; i++) {
|
|
108
|
+
this.pedAttributes[i] = new PedAttribute(ped, i);
|
|
109
|
+
}
|
|
110
|
+
for (let i = 0; i <= 2; i++) {
|
|
111
|
+
this.coreAttributes[i] = new CoreAttribute(ped, i);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
getCore(attribute) {
|
|
115
|
+
if (attribute > 2)
|
|
116
|
+
throw new RangeError("The max enum for CoreAttribute is 2");
|
|
117
|
+
if (attribute < 0)
|
|
118
|
+
throw new RangeError("The minimum enum for CoreAttribute is 0");
|
|
119
|
+
// This should always be valid
|
|
120
|
+
return this.coreAttributes[attribute];
|
|
121
|
+
}
|
|
122
|
+
get(attribute) {
|
|
123
|
+
if (attribute > 22)
|
|
124
|
+
throw new RangeError("The max enum for PedAttribute is 22");
|
|
125
|
+
if (attribute < 0)
|
|
126
|
+
throw new RangeError("The minimum enum for PedAttribute is 0");
|
|
127
|
+
return this.pedAttributes[attribute];
|
|
128
|
+
}
|
|
129
|
+
set CoreIcon(status) {
|
|
130
|
+
if (status > 15)
|
|
131
|
+
throw new RangeError("The max enum for StatusEffect is 15");
|
|
132
|
+
if (status < 0)
|
|
133
|
+
throw new RangeError("The minimum enum for StatusEffect is 0");
|
|
134
|
+
_N("0xA4D3A1C008F250DF", status);
|
|
135
|
+
}
|
|
136
|
+
set PeriodicIcon(status) {
|
|
137
|
+
if (status > 15)
|
|
138
|
+
throw new RangeError("The max enum for StatusEffect is 15!");
|
|
139
|
+
if (status < 0)
|
|
140
|
+
throw new RangeError("The minimum enum for StatusEffect is 0");
|
|
141
|
+
_N("0xFB6E111908502871", status);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Relationship } from "./enums/Relationship";
|
|
2
|
+
/**
|
|
3
|
+
* Class to create and manage a relationship group. Useful to manage behavior between Peds.
|
|
4
|
+
*/
|
|
5
|
+
export declare class RelationshipGroup {
|
|
6
|
+
/**
|
|
7
|
+
* The hash of the relationship group
|
|
8
|
+
*/
|
|
9
|
+
private hash;
|
|
10
|
+
/**
|
|
11
|
+
* Create a relationship group. Optionally pass a group hash.
|
|
12
|
+
*
|
|
13
|
+
* @param name Name of the relationship group.
|
|
14
|
+
*/
|
|
15
|
+
constructor(name: string);
|
|
16
|
+
/**
|
|
17
|
+
* Gets the hash of the relationship group.
|
|
18
|
+
*
|
|
19
|
+
* @returns The hash of this object.
|
|
20
|
+
*/
|
|
21
|
+
get Hash(): number;
|
|
22
|
+
/**
|
|
23
|
+
* Get the relationship between two relationship groups.
|
|
24
|
+
*
|
|
25
|
+
* @param targetGroup The other relationship group.
|
|
26
|
+
* @returns The relationship
|
|
27
|
+
*/
|
|
28
|
+
getRelationshipBetweenGroups(targetGroup: RelationshipGroup): Relationship;
|
|
29
|
+
/**
|
|
30
|
+
* Set the relationship group between this relationship group and another one.
|
|
31
|
+
*
|
|
32
|
+
* @param targetGroup The other relationship group.
|
|
33
|
+
* @param relationship The desired relationship.
|
|
34
|
+
* @param biDirectionally If target group should have same relationship towards this.
|
|
35
|
+
*/
|
|
36
|
+
setRelationshipBetweenGroups(targetGroup: RelationshipGroup, relationship: Relationship, biDirectionally?: boolean): void;
|
|
37
|
+
/**
|
|
38
|
+
* Clear the relationship between this relationship group and another.
|
|
39
|
+
*
|
|
40
|
+
* @param targetGroup The other relationship group.
|
|
41
|
+
* @param relationship The desired relationship to clear.
|
|
42
|
+
* @param biDirectionally Whether the target group should also clear the relationship.
|
|
43
|
+
*/
|
|
44
|
+
clearRelationshipBetweenGroups(targetGroup: RelationshipGroup, relationship: Relationship, biDirectionally?: boolean): void;
|
|
45
|
+
/**
|
|
46
|
+
* Remove this relationship group from the game. This will not delete this object.
|
|
47
|
+
*/
|
|
48
|
+
remove(): void;
|
|
49
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Class to create and manage a relationship group. Useful to manage behavior between Peds.
|
|
3
|
+
*/
|
|
4
|
+
export class RelationshipGroup {
|
|
5
|
+
/**
|
|
6
|
+
* The hash of the relationship group
|
|
7
|
+
*/
|
|
8
|
+
hash;
|
|
9
|
+
/**
|
|
10
|
+
* Create a relationship group. Optionally pass a group hash.
|
|
11
|
+
*
|
|
12
|
+
* @param name Name of the relationship group.
|
|
13
|
+
*/
|
|
14
|
+
constructor(name) {
|
|
15
|
+
const [, groupHash] = AddRelationshipGroup(name);
|
|
16
|
+
this.hash = groupHash;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Gets the hash of the relationship group.
|
|
20
|
+
*
|
|
21
|
+
* @returns The hash of this object.
|
|
22
|
+
*/
|
|
23
|
+
get Hash() {
|
|
24
|
+
return this.hash;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get the relationship between two relationship groups.
|
|
28
|
+
*
|
|
29
|
+
* @param targetGroup The other relationship group.
|
|
30
|
+
* @returns The relationship
|
|
31
|
+
*/
|
|
32
|
+
getRelationshipBetweenGroups(targetGroup) {
|
|
33
|
+
return GetRelationshipBetweenGroups(this.Hash, targetGroup.Hash);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Set the relationship group between this relationship group and another one.
|
|
37
|
+
*
|
|
38
|
+
* @param targetGroup The other relationship group.
|
|
39
|
+
* @param relationship The desired relationship.
|
|
40
|
+
* @param biDirectionally If target group should have same relationship towards this.
|
|
41
|
+
*/
|
|
42
|
+
setRelationshipBetweenGroups(targetGroup, relationship, biDirectionally = false) {
|
|
43
|
+
SetRelationshipBetweenGroups(Number(relationship), this.Hash, targetGroup.Hash);
|
|
44
|
+
if (biDirectionally) {
|
|
45
|
+
SetRelationshipBetweenGroups(Number(relationship), targetGroup.Hash, this.Hash);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Clear the relationship between this relationship group and another.
|
|
50
|
+
*
|
|
51
|
+
* @param targetGroup The other relationship group.
|
|
52
|
+
* @param relationship The desired relationship to clear.
|
|
53
|
+
* @param biDirectionally Whether the target group should also clear the relationship.
|
|
54
|
+
*/
|
|
55
|
+
clearRelationshipBetweenGroups(targetGroup, relationship, biDirectionally = false) {
|
|
56
|
+
ClearRelationshipBetweenGroups(Number(relationship), this.Hash, targetGroup.Hash);
|
|
57
|
+
if (biDirectionally) {
|
|
58
|
+
ClearRelationshipBetweenGroups(Number(relationship), targetGroup.Hash, this.Hash);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Remove this relationship group from the game. This will not delete this object.
|
|
63
|
+
*/
|
|
64
|
+
remove() {
|
|
65
|
+
RemoveRelationshipGroup(this.Hash);
|
|
66
|
+
}
|
|
67
|
+
}
|
package/Volume.d.ts
ADDED
package/Volume.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export class Volume {
|
|
2
|
+
handle;
|
|
3
|
+
constructor(coord, rot, scale, customName) {
|
|
4
|
+
if (customName) {
|
|
5
|
+
this.handle = CreateVolumeCylinderWithCustomName(coord.x, coord.y, coord.z, rot.x, rot.y, rot.z, scale.x, scale.y, scale.z, customName);
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
this.handle = CreateVolumeCylinder(coord.x, coord.y, coord.z, rot.x, rot.y, rot.z, scale.x, scale.y, scale.z);
|
|
9
|
+
}
|
|
10
|
+
get Handle() {
|
|
11
|
+
return this.handle;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export class BaseEntity {
|
|
2
|
+
handle;
|
|
3
|
+
constructor(entHandle) {
|
|
4
|
+
this.handle = entHandle;
|
|
5
|
+
}
|
|
6
|
+
get Handle() {
|
|
7
|
+
return this.handle;
|
|
8
|
+
}
|
|
9
|
+
set Health(amount) {
|
|
10
|
+
SetEntityHealth(this.Handle, amount, 0);
|
|
11
|
+
}
|
|
12
|
+
get Health() {
|
|
13
|
+
return GetEntityHealth(this.Handle);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { BoneIndex, EntityType, ForceType } from "../enums/Entity";
|
|
2
|
+
import { Throwable } from "../types/Throwable";
|
|
3
|
+
import { Vector3 } from "../utils";
|
|
4
|
+
import { BaseEntity } from "./BaseEntity";
|
|
5
|
+
export declare class Entity extends BaseEntity {
|
|
6
|
+
constructor(handle: number);
|
|
7
|
+
addTrackingTrails(): void;
|
|
8
|
+
get EntityType(): EntityType;
|
|
9
|
+
/**
|
|
10
|
+
* @param direction - the direction to apply the force towards
|
|
11
|
+
* @param offset - the offset to apply the force to
|
|
12
|
+
* @param forceType - the force type to apply
|
|
13
|
+
* @param boneIndex - the boneIndex to apply the force to, or 0
|
|
14
|
+
* @param isDirectional - whether the direction is relational?
|
|
15
|
+
* @param ignoreUpVec - ?
|
|
16
|
+
* @param isForceRel - whether to multiply the force by the object mass & acceleration
|
|
17
|
+
*/
|
|
18
|
+
applyForce(direction: Vector3, offset: Vector3, forceType?: ForceType, boneIndex?: BoneIndex, isDirectional?: boolean, ignoreUpVec?: boolean, isForceRel?: boolean): void;
|
|
19
|
+
/**
|
|
20
|
+
* @param direction - the direction to apply the force towards
|
|
21
|
+
* @param forceType - the force type to use
|
|
22
|
+
* @param isDirectional - whether the direction is local?
|
|
23
|
+
* @param isForceRel - whether to multiply the force by the object mass & acceleration
|
|
24
|
+
*/
|
|
25
|
+
applyForceToCenter(direction: Vector3, forceType?: ForceType, isDirectional?: boolean, isForceRel?: boolean): void;
|
|
26
|
+
/**
|
|
27
|
+
* @param tgtEntity - the entity to attach to the {@Entity}
|
|
28
|
+
* @param pos - the position offset
|
|
29
|
+
* @param rot - the rotation to apply to the entity
|
|
30
|
+
* @param boneIndex - the bone to attach the entity to, or 0 for the center of the entity
|
|
31
|
+
* @param enableCollision - whether the entity should have collision enabled
|
|
32
|
+
* @param useSoftPinning - when false the entity will not detach from the {@Entity}
|
|
33
|
+
* @param vertexIndex - ?
|
|
34
|
+
* @param fixedRot - ?
|
|
35
|
+
* @throws Error if tgtEntity and {@Entity} are the same entity
|
|
36
|
+
*/
|
|
37
|
+
attachTo(tgtEntity: Entity, pos: Vector3, rot: Vector3, boneIndex?: BoneIndex, enableCollision?: boolean, useSoftPinning?: boolean, vertexIndex?: number, fixedRot?: boolean): Throwable<void>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { EntityType, ForceType } from "../enums/Entity";
|
|
2
|
+
import { _N } from "../utils";
|
|
3
|
+
import { BaseEntity } from "./BaseEntity";
|
|
4
|
+
export class Entity extends BaseEntity {
|
|
5
|
+
constructor(handle) {
|
|
6
|
+
super(handle);
|
|
7
|
+
}
|
|
8
|
+
addTrackingTrails() {
|
|
9
|
+
// _ADD_ENTITY_TRACKING_TRAILS
|
|
10
|
+
_N("0x1AD922AB5038DEF3", this.Handle);
|
|
11
|
+
}
|
|
12
|
+
get EntityType() {
|
|
13
|
+
return GetEntityType(this.Handle);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @param direction - the direction to apply the force towards
|
|
17
|
+
* @param offset - the offset to apply the force to
|
|
18
|
+
* @param forceType - the force type to apply
|
|
19
|
+
* @param boneIndex - the boneIndex to apply the force to, or 0
|
|
20
|
+
* @param isDirectional - whether the direction is relational?
|
|
21
|
+
* @param ignoreUpVec - ?
|
|
22
|
+
* @param isForceRel - whether to multiply the force by the object mass & acceleration
|
|
23
|
+
*/
|
|
24
|
+
applyForce(direction, offset, forceType = ForceType.MinForce, boneIndex = 0, isDirectional = false, ignoreUpVec = true, isForceRel = true) {
|
|
25
|
+
const d = direction;
|
|
26
|
+
const o = offset;
|
|
27
|
+
ApplyForceToEntity(this.Handle, forceType, d.x, d.y, d.z, o.x, o.y, o.z, boneIndex, isDirectional, ignoreUpVec, isForceRel, false, true);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @param direction - the direction to apply the force towards
|
|
31
|
+
* @param forceType - the force type to use
|
|
32
|
+
* @param isDirectional - whether the direction is local?
|
|
33
|
+
* @param isForceRel - whether to multiply the force by the object mass & acceleration
|
|
34
|
+
*/
|
|
35
|
+
applyForceToCenter(direction, forceType = ForceType.MinForce, isDirectional = false, isForceRel = true) {
|
|
36
|
+
const d = direction;
|
|
37
|
+
ApplyForceToEntityCenterOfMass(this.Handle, forceType, d.x, d.y, d.z, false, isDirectional, isForceRel, false);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* @param tgtEntity - the entity to attach to the {@Entity}
|
|
41
|
+
* @param pos - the position offset
|
|
42
|
+
* @param rot - the rotation to apply to the entity
|
|
43
|
+
* @param boneIndex - the bone to attach the entity to, or 0 for the center of the entity
|
|
44
|
+
* @param enableCollision - whether the entity should have collision enabled
|
|
45
|
+
* @param useSoftPinning - when false the entity will not detach from the {@Entity}
|
|
46
|
+
* @param vertexIndex - ?
|
|
47
|
+
* @param fixedRot - ?
|
|
48
|
+
* @throws Error if tgtEntity and {@Entity} are the same entity
|
|
49
|
+
*/
|
|
50
|
+
attachTo(tgtEntity, pos, rot, boneIndex = 0, enableCollision = true, useSoftPinning = false, vertexIndex = 0, fixedRot = true) {
|
|
51
|
+
if (tgtEntity.Handle === this.Handle) {
|
|
52
|
+
throw new Error("tgtEntity had the same handle as the current entity, attaching an entity to itself will crash");
|
|
53
|
+
}
|
|
54
|
+
const p = pos;
|
|
55
|
+
const r = rot;
|
|
56
|
+
AttachEntityToEntity(tgtEntity.Handle, this.Handle, boneIndex, p.x, p.y, p.z, r.x, r.y, r.z, false, useSoftPinning, enableCollision, (this.EntityType === EntityType.Ped), vertexIndex, fixedRot, false, false);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { Attributes } from "../Attribute";
|
|
2
|
+
import { eDamageCleanliness, KnockOffVehicle, TamingState } from "../enums/Ped";
|
|
3
|
+
import { VehicleSeat } from "../enums/VehicleSeat";
|
|
4
|
+
import { Vector3 } from "../utils";
|
|
5
|
+
import { BaseEntity } from "./BaseEntity";
|
|
6
|
+
import { Vehicle } from "./Vehicle";
|
|
7
|
+
import { Player } from "./Player";
|
|
8
|
+
export type OptionalPed = Ped | null;
|
|
9
|
+
export declare class Ped extends BaseEntity {
|
|
10
|
+
private attributes;
|
|
11
|
+
constructor(handle: number);
|
|
12
|
+
/**
|
|
13
|
+
* Blocks scenarios inbetween the specified vectors
|
|
14
|
+
* @todo Move to Game
|
|
15
|
+
* @param vec1
|
|
16
|
+
* @param vec2
|
|
17
|
+
* @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)
|
|
18
|
+
* @returns the scenarioId that can be used in {@link removeScenarioBlock} to unblock
|
|
19
|
+
*/
|
|
20
|
+
static blockScenariosInArea(vec1: Vector3, vec2: Vector3, blockingFlags: number): number;
|
|
21
|
+
/**
|
|
22
|
+
* Removes the blocking of scenarios in the specified area
|
|
23
|
+
* @param scenarioId the number returned from {@link blockScenariosInArea}
|
|
24
|
+
*/
|
|
25
|
+
static removeScenarioBlock(scenarioId: number): void;
|
|
26
|
+
/**
|
|
27
|
+
* While this increases the peds max health, if used on a player it wont increase the max core value on the hud
|
|
28
|
+
*/
|
|
29
|
+
set MaxHealth(amount: number);
|
|
30
|
+
/**
|
|
31
|
+
* @returns the maximum health of the ped
|
|
32
|
+
*/
|
|
33
|
+
get MaxHealth(): number;
|
|
34
|
+
/**
|
|
35
|
+
* @returns the {@link Attributes} for the current ped
|
|
36
|
+
*/
|
|
37
|
+
get Attributes(): Attributes;
|
|
38
|
+
get InVehicle(): boolean;
|
|
39
|
+
get IsInjured(): boolean;
|
|
40
|
+
get IsFatallyInjured(): boolean;
|
|
41
|
+
get IsPlayer(): boolean;
|
|
42
|
+
get Heading(): number;
|
|
43
|
+
set Heading(heading: number);
|
|
44
|
+
get IsShooting(): boolean;
|
|
45
|
+
get Accuracy(): number;
|
|
46
|
+
set Accuracy(accuracy: number);
|
|
47
|
+
get CanBeKnockedOffVehicle(): boolean;
|
|
48
|
+
get IsMale(): boolean;
|
|
49
|
+
get IsHuman(): boolean;
|
|
50
|
+
get IsOnTopOfVehicle(): boolean;
|
|
51
|
+
get Vehicle(): Vehicle;
|
|
52
|
+
/**
|
|
53
|
+
* @returns the last mount that this ped was on, or null if it doesn't exist
|
|
54
|
+
*/
|
|
55
|
+
get Mount(): OptionalPed;
|
|
56
|
+
/**
|
|
57
|
+
* returns the horse that this ped is leading
|
|
58
|
+
*/
|
|
59
|
+
get LeadingHorse(): OptionalPed;
|
|
60
|
+
/**
|
|
61
|
+
* returns the owner of the current animal
|
|
62
|
+
*/
|
|
63
|
+
get Owner(): OptionalPed;
|
|
64
|
+
get TamingState(): TamingState;
|
|
65
|
+
get IsInteractingWithAnimal(): boolean;
|
|
66
|
+
get IsSittingInAnyVehicle(): boolean;
|
|
67
|
+
get IsPlantingBomb(): boolean;
|
|
68
|
+
get IsInAnyBoat(): boolean;
|
|
69
|
+
get IsInAnyHeli(): boolean;
|
|
70
|
+
get IsInAnyPlane(): boolean;
|
|
71
|
+
get IsInFlyingVehicle(): boolean;
|
|
72
|
+
get IsFalling(): boolean;
|
|
73
|
+
get IsSliding(): boolean;
|
|
74
|
+
get IsJumping(): boolean;
|
|
75
|
+
get IsClimbing(): boolean;
|
|
76
|
+
get IsClimbingLadder(): boolean;
|
|
77
|
+
get IsVaulting(): boolean;
|
|
78
|
+
get IsDiving(): boolean;
|
|
79
|
+
get IsOpeningADoor(): boolean;
|
|
80
|
+
set SeeingRange(value: number);
|
|
81
|
+
set HearingRange(value: number);
|
|
82
|
+
get IsStealthed(): boolean;
|
|
83
|
+
get IsJacking(): boolean;
|
|
84
|
+
get IsStunned(): boolean;
|
|
85
|
+
get IsBeingJacked(): boolean;
|
|
86
|
+
get IsInCombatRoll(): boolean;
|
|
87
|
+
get CrouchMovement(): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* returns true if {@link DamageCleanliness} was ever lower than {@link eDamageCleanliness.Good}
|
|
90
|
+
*/
|
|
91
|
+
get IsDamaged(): boolean;
|
|
92
|
+
set IsDamaged(damaged: boolean);
|
|
93
|
+
get DamageCleanliness(): eDamageCleanliness;
|
|
94
|
+
set DamageCleanliness(cleanliness: eDamageCleanliness);
|
|
95
|
+
set DefenseModifier(amount: number);
|
|
96
|
+
set CanBeTargeted(toggle: boolean);
|
|
97
|
+
/**
|
|
98
|
+
* returns the ped who jacked this ped
|
|
99
|
+
*/
|
|
100
|
+
getJacker(): Ped;
|
|
101
|
+
setCrouchMovement(state: boolean, immediately?: boolean): void;
|
|
102
|
+
canBeTargetedByPlayer(player: Player, toggle: boolean): void;
|
|
103
|
+
clearLastBoneDamage(): void;
|
|
104
|
+
set OwnsAnimal(animal: Ped);
|
|
105
|
+
isInteractionPossible(animal: Ped): boolean;
|
|
106
|
+
isOnVehicle(vehicle: Vehicle): boolean;
|
|
107
|
+
isSittingInVehicle(vehicle: Vehicle): boolean;
|
|
108
|
+
warpOutOfVehicle(): void;
|
|
109
|
+
/**
|
|
110
|
+
* puts the ped onto the specified mount
|
|
111
|
+
* @param targetPed the horse to put the ped on
|
|
112
|
+
* @param seatIndex the seat index to put the ped on
|
|
113
|
+
*/
|
|
114
|
+
setOntoMount(targetPed: Ped, seatIndex: VehicleSeat): void;
|
|
115
|
+
removeFromMount(): void;
|
|
116
|
+
/**
|
|
117
|
+
*
|
|
118
|
+
* @param seatIndex the seat index to check
|
|
119
|
+
* @returns true of the specified seat is free on the mount
|
|
120
|
+
*/
|
|
121
|
+
isSeatFree(seatIndex: VehicleSeat): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Sets the ped into the specified vehicle
|
|
124
|
+
* @param vehicle the vehicle to put the ped into
|
|
125
|
+
* @param seatIndex the seat index to put the ped into
|
|
126
|
+
*/
|
|
127
|
+
setIntoVehicle(vehicle: Vehicle, seatIndex: VehicleSeat): void;
|
|
128
|
+
/**
|
|
129
|
+
* kills the ped and optionally sets the killer
|
|
130
|
+
* @param killer the entity that killed the ped
|
|
131
|
+
*/
|
|
132
|
+
killPed(killer?: BaseEntity): void;
|
|
133
|
+
damage(amount: number, boneId?: number, killer?: Ped): void;
|
|
134
|
+
/**
|
|
135
|
+
* this returns a different type then the getter so we can't use set, maybe ts will fix soon (tm)
|
|
136
|
+
* @param state how hard it will be to knock a ped off their vehicle
|
|
137
|
+
*/
|
|
138
|
+
setCanBeKnockedOffVehicle(state: KnockOffVehicle): void;
|
|
139
|
+
/**
|
|
140
|
+
* Removes the specified ped if its not a player entity
|
|
141
|
+
*/
|
|
142
|
+
delete(): void;
|
|
143
|
+
/**
|
|
144
|
+
* creates a clone of the ped
|
|
145
|
+
* @param network if the ped should be a networked entity
|
|
146
|
+
* @param bScriptHostPed whether to register the ped as pinned to the script host in the R* network model.
|
|
147
|
+
* @param copyHeadBlend whether to copy the peds head blend
|
|
148
|
+
* @returns the cloned ped
|
|
149
|
+
*/
|
|
150
|
+
clone(network: boolean, bScriptHostPed: boolean, copyHeadBlend: boolean): Ped;
|
|
151
|
+
/**
|
|
152
|
+
* clones the ped onto the target ped
|
|
153
|
+
* @param targetPed the ped to clone onto
|
|
154
|
+
*/
|
|
155
|
+
cloneTo(targetPed: Ped): void;
|
|
156
|
+
/**
|
|
157
|
+
* @param amount - the amount of armour to add to the ped
|
|
158
|
+
*/
|
|
159
|
+
addArmour(amount: number): void;
|
|
160
|
+
applyDamage(damageAmount: number, boneId?: number, pedKiller?: OptionalPed): void;
|
|
161
|
+
/**
|
|
162
|
+
* @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
|
|
163
|
+
* @param damage - the damage to apply
|
|
164
|
+
* @param mult - the multiplier?
|
|
165
|
+
*/
|
|
166
|
+
applyDamagePack(damagePack: string, damage: number, mult: number): void;
|
|
167
|
+
}
|