@nativewrappers/common-game 0.0.122 → 0.0.123
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/CommonModel.js +2 -2
- package/CommonTasks.d.ts +6 -5
- package/CommonTasks.js +4 -3
- package/entities/CommonBaseEntity.d.ts +62 -14
- package/entities/CommonBaseEntity.js +88 -36
- package/entities/CommonBaseEntityBone.d.ts +6 -6
- package/entities/CommonBaseEntityBone.js +7 -7
- package/entities/CommonBaseEntityBoneCollection.d.ts +3 -3
- package/entities/CommonEntityBone.d.ts +2 -2
- package/entities/CommonEntityBoneCollection.d.ts +2 -2
- package/entities/CommonPed.d.ts +1 -2
- package/entities/CommonPed.js +1 -4
- package/entities/CommonPedBone.d.ts +2 -2
- package/entities/CommonPedBoneCollection.d.ts +2 -2
- package/entities/CommonPlayer.js +1 -1
- package/entities/CommonProp.d.ts +1 -2
- package/entities/CommonProp.js +1 -4
- package/entities/CommonVehicle.d.ts +1 -2
- package/entities/CommonVehicle.js +1 -4
- package/entities/IHandle.d.ts +6 -0
- package/entities/IHandle.js +20 -0
- package/index.d.ts +1 -21
- package/index.js +1 -21
- package/interfaces/Dimension.d.ts +1 -1
- package/package.json +1 -1
- package/utils/Animations.js +1 -1
- package/common/Command.d.ts +0 -77
- package/common/Command.js +0 -152
- package/common/Convar.d.ts +0 -13
- package/common/Convar.js +0 -58
- package/common/GlobalData.d.ts +0 -12
- package/common/GlobalData.js +0 -20
- package/common/Kvp.d.ts +0 -69
- package/common/Kvp.js +0 -137
- package/common/Resource.d.ts +0 -14
- package/common/Resource.js +0 -54
- package/common/decors/Events.d.ts +0 -65
- package/common/decors/Events.js +0 -208
- package/common/net/NetworkedMap.d.ts +0 -28
- package/common/net/NetworkedMap.js +0 -225
- package/common/types.d.ts +0 -5
- package/common/types.js +0 -0
- package/common/utils/ClassTypes.d.ts +0 -11
- package/common/utils/ClassTypes.js +0 -15
- package/common/utils/Color.d.ts +0 -14
- package/common/utils/Color.js +0 -33
- package/common/utils/Delay.d.ts +0 -1
- package/common/utils/Delay.js +0 -6
- package/common/utils/Maths.d.ts +0 -4
- package/common/utils/Maths.js +0 -18
- package/common/utils/Point.d.ts +0 -9
- package/common/utils/Point.js +0 -36
- package/common/utils/PointF.d.ts +0 -7
- package/common/utils/PointF.js +0 -18
- package/common/utils/Quaternion.d.ts +0 -10
- package/common/utils/Quaternion.js +0 -33
- package/common/utils/Vector.d.ts +0 -429
- package/common/utils/Vector.js +0 -589
- package/common/utils/cleanPlayerName.d.ts +0 -6
- package/common/utils/cleanPlayerName.js +0 -17
- package/common/utils/enumValues.d.ts +0 -12
- package/common/utils/enumValues.js +0 -20
- package/common/utils/getStringFromUInt8Array.d.ts +0 -8
- package/common/utils/getStringFromUInt8Array.js +0 -6
- package/common/utils/getUInt32FromUint8Array.d.ts +0 -8
- package/common/utils/getUInt32FromUint8Array.js +0 -6
- package/common/utils/randomInt.d.ts +0 -1
- package/common/utils/randomInt.js +0 -9
package/CommonModel.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import { Delay } from "
|
|
4
|
-
import { Vector3 } from "
|
|
3
|
+
import { Delay } from "@common/utils/Delay";
|
|
4
|
+
import { Vector3 } from "@common/utils/Vector";
|
|
5
5
|
class CommonModel {
|
|
6
6
|
static {
|
|
7
7
|
__name(this, "CommonModel");
|
package/CommonTasks.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { Vector3 } from "
|
|
1
|
+
import { Vector3 } from "@common/utils/Vector";
|
|
2
2
|
import { CommonBaseEntity } from "./entities/CommonBaseEntity";
|
|
3
3
|
import { CommonPed } from "./entities/CommonPed";
|
|
4
4
|
import type { CommonVehicle } from "./entities/CommonVehicle";
|
|
5
5
|
import { VehicleSeat } from "./enums/VehicleSeat";
|
|
6
|
+
import { IHandle } from "./entities/IHandle";
|
|
6
7
|
export declare class CommonTasks {
|
|
7
|
-
|
|
8
|
-
constructor(ped:
|
|
8
|
+
protected ped: IHandle;
|
|
9
|
+
constructor(ped: IHandle | null);
|
|
9
10
|
achieveHeading(heading: number, timeout?: number): void;
|
|
10
11
|
blockTemporaryEvents(block?: boolean): void;
|
|
11
12
|
aimAt(target: CommonBaseEntity | Vector3, duration: number): void;
|
|
@@ -17,7 +18,7 @@ export declare class CommonTasks {
|
|
|
17
18
|
static everyoneLeaveVehicle(vehicle: CommonVehicle): void;
|
|
18
19
|
fightAgainst(target: CommonPed, duration?: number): void;
|
|
19
20
|
fightAgainstHatedTargets(radius: number, duration?: number): void;
|
|
20
|
-
fleeFrom(pedOrPosition: CommonPed | Vector3, distance?: number, duration?: number, fleeType?: number, fleeSpeed?: number, fleeFrom?:
|
|
21
|
+
fleeFrom(pedOrPosition: CommonPed | Vector3, distance?: number, duration?: number, fleeType?: number, fleeSpeed?: number, fleeFrom?: IHandle): void;
|
|
21
22
|
goTo(position: Vector3, ignorePaths?: boolean, timeout?: number, speed?: number, targetHeading?: number, distanceToSlide?: number, flags?: number): void;
|
|
22
23
|
goToEntity(target: CommonBaseEntity, offset?: Vector3, timeout?: number): void;
|
|
23
24
|
guardCurrentPosition(): void;
|
|
@@ -25,7 +26,7 @@ export declare class CommonTasks {
|
|
|
25
26
|
lookAt(targetOrPosition: CommonBaseEntity | Vector3, duration?: number): void;
|
|
26
27
|
playAnimation(animDict: string, animName: string, blendInSpeed: number, blendOutSpeed: number, duration: number, playbackRate: number, animFlags: number, ikFlags?: number): Promise<void>;
|
|
27
28
|
reloadWeapon(): void;
|
|
28
|
-
shootAt(targetOrPosition:
|
|
29
|
+
shootAt(targetOrPosition: IHandle | Vector3, duration?: number, pattern?: number, affectCockedState?: boolean): void;
|
|
29
30
|
shuffleToNextVehicleSeat(vehicle: CommonVehicle): void;
|
|
30
31
|
slideTo(position: Vector3, heading: number, duration?: number): void;
|
|
31
32
|
standStill(duration: number): void;
|
package/CommonTasks.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import { Vector3 } from "
|
|
3
|
+
import { Vector3 } from "@common/utils/Vector";
|
|
4
4
|
import { CommonBaseEntity } from "./entities/CommonBaseEntity";
|
|
5
5
|
import { CommonPed } from "./entities/CommonPed";
|
|
6
6
|
import { VehicleSeat } from "./enums/VehicleSeat";
|
|
7
7
|
import { LoadAnimDict } from "./utils/Animations";
|
|
8
|
-
import { GlobalData } from "
|
|
8
|
+
import { GlobalData } from "@common/GlobalData";
|
|
9
|
+
import { IHandle } from "./entities/IHandle";
|
|
9
10
|
class CommonTasks {
|
|
10
11
|
static {
|
|
11
12
|
__name(this, "CommonTasks");
|
|
@@ -166,7 +167,7 @@ class CommonTasks {
|
|
|
166
167
|
TaskReloadWeapon(this.ped.Handle, true);
|
|
167
168
|
}
|
|
168
169
|
shootAt(targetOrPosition, duration = -1, pattern = 0, affectCockedState = false) {
|
|
169
|
-
if (targetOrPosition instanceof
|
|
170
|
+
if (targetOrPosition instanceof IHandle) {
|
|
170
171
|
TaskShootAtEntity(this.ped.Handle, targetOrPosition.Handle, duration, pattern, affectCockedState);
|
|
171
172
|
} else {
|
|
172
173
|
TaskShootAtCoord(
|
|
@@ -1,24 +1,50 @@
|
|
|
1
|
-
import type { ClassTypes } from "
|
|
2
|
-
import type { Quaternion } from "
|
|
3
|
-
import { Vector3 } from "
|
|
1
|
+
import type { ClassTypes } from "@common/utils/ClassTypes";
|
|
2
|
+
import type { Quaternion } from "@common/utils/Quaternion";
|
|
3
|
+
import { Vector3 } from "@common/utils/Vector";
|
|
4
4
|
import type { CommonBaseEntityBoneCollection } from "./CommonBaseEntityBoneCollection";
|
|
5
5
|
import type { StateBagChangeHandler } from "../cfx/StateBagChangeHandler";
|
|
6
6
|
import { CommonModel } from "../CommonModel";
|
|
7
7
|
import type { CommonBaseEntityBone } from "./CommonBaseEntityBone";
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
import { IHandle } from "./IHandle";
|
|
9
|
+
export declare abstract class CommonBaseEntity extends IHandle {
|
|
10
10
|
protected stateBagCookies: number[];
|
|
11
11
|
protected netId: number | null;
|
|
12
12
|
protected abstract type: ClassTypes;
|
|
13
13
|
protected abstract bones?: CommonBaseEntityBoneCollection;
|
|
14
14
|
constructor(handle: number);
|
|
15
|
+
/**
|
|
16
|
+
* Replaces the current handle for the entity used on, this should be used sparringly, mainly
|
|
17
|
+
* in situations where you're going to reuse an entity over and over and don't want to make a
|
|
18
|
+
* new entity every time.
|
|
19
|
+
*
|
|
20
|
+
* **WARNING**: This does no checks, if you provide it an invalid entity it will use it
|
|
21
|
+
*
|
|
22
|
+
* ```ts
|
|
23
|
+
* const REUSABLE_ENTITY = new Entity(entityHandle);
|
|
24
|
+
*
|
|
25
|
+
* onNet("entityHandler", (entNetId: number) => {
|
|
26
|
+
* // if no net entity we should ignore
|
|
27
|
+
* if (!NetworkDoesEntityExistWithNetworkId(entNetId)) return;
|
|
28
|
+
*
|
|
29
|
+
* // Reuse our entity so we don't have to initialize a new one
|
|
30
|
+
* REUSABLE_ENTITY.replaceHandle(NetworkGetEntityFromNetworkId(entNetId));
|
|
31
|
+
* // Do something with REUSABLE_ENTITY entity
|
|
32
|
+
* })
|
|
33
|
+
```
|
|
34
|
+
*/
|
|
35
|
+
replaceHandle(newHandle: number): void;
|
|
36
|
+
get Exists(): boolean;
|
|
15
37
|
get Handle(): number;
|
|
16
38
|
/**
|
|
17
|
-
*
|
|
39
|
+
* This will return a warning if the the entity is not networked, you should always use {@link IsNetworked} prior to calling thisl
|
|
40
|
+
* @returns the network for the specified entity
|
|
41
|
+
*/
|
|
42
|
+
get NetworkId(): number;
|
|
43
|
+
/**
|
|
44
|
+
* @returns `true` if the current entity is networked, false otherwise
|
|
18
45
|
*/
|
|
19
46
|
get IsNetworked(): boolean;
|
|
20
47
|
set IsNetworked(networked: boolean);
|
|
21
|
-
get NetworkId(): number;
|
|
22
48
|
get State(): StateBagInterface;
|
|
23
49
|
AddStateBagChangeHandler(keyFilter: string | null, handler: StateBagChangeHandler<unknown>): number;
|
|
24
50
|
/**
|
|
@@ -34,11 +60,12 @@ export declare abstract class CommonBaseEntity {
|
|
|
34
60
|
getSpeedVector(isRelative?: boolean): Vector3;
|
|
35
61
|
get ForwardVector(): Vector3;
|
|
36
62
|
get Matrix(): Vector3[];
|
|
37
|
-
get Health(): number;
|
|
38
|
-
set Health(amount: number);
|
|
39
63
|
get MaxHealth(): number;
|
|
40
64
|
set MaxHealth(amount: number);
|
|
41
65
|
set IsDead(value: boolean);
|
|
66
|
+
/**
|
|
67
|
+
* @returns Returns true if the entity is dead
|
|
68
|
+
*/
|
|
42
69
|
get IsDead(): boolean;
|
|
43
70
|
get IsAlive(): boolean;
|
|
44
71
|
get Model(): CommonModel;
|
|
@@ -50,19 +77,40 @@ export declare abstract class CommonBaseEntity {
|
|
|
50
77
|
* Sets if the entity is a mission entity and will not be cleaned up by the engine
|
|
51
78
|
*/
|
|
52
79
|
set IsMissionEntity(value: boolean);
|
|
53
|
-
get Position(): Vector3;
|
|
54
|
-
set Position(position: Vector3);
|
|
55
80
|
set PositionNoOffset(position: Vector3);
|
|
56
81
|
get Rotation(): Vector3;
|
|
57
82
|
set Rotation(rotation: Vector3);
|
|
58
83
|
set Quaternion(quaternion: Quaternion);
|
|
59
|
-
get Heading(): number;
|
|
60
|
-
set Heading(heading: number);
|
|
61
84
|
get IsPositionFrozen(): boolean;
|
|
62
85
|
set IsPositionFrozen(value: boolean);
|
|
63
86
|
get Velocity(): Vector3;
|
|
64
87
|
set Velocity(velocity: Vector3);
|
|
65
|
-
|
|
88
|
+
get IsVisible(): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* @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.
|
|
91
|
+
*/
|
|
92
|
+
set Health(amount: number);
|
|
93
|
+
/**
|
|
94
|
+
* @returns the amount of health the current {@link BaseEntity} has
|
|
95
|
+
*/
|
|
96
|
+
get Health(): number;
|
|
97
|
+
/**
|
|
98
|
+
* @returns the heading of the current {@link BaseEntity}
|
|
99
|
+
*/
|
|
100
|
+
get Heading(): number;
|
|
101
|
+
/**
|
|
102
|
+
* @param heading sets the entitys heading to the specified heading, this can be in the range of 0..360
|
|
103
|
+
*/
|
|
104
|
+
set Heading(heading: number);
|
|
105
|
+
/**
|
|
106
|
+
* @returns the position of the current Entity
|
|
107
|
+
*/
|
|
108
|
+
get Position(): Vector3;
|
|
109
|
+
/**
|
|
110
|
+
* You should always try to load the collisions before setting the entitys position if going a long distance.
|
|
111
|
+
* @param pos sets the position for the current ped
|
|
112
|
+
*/
|
|
113
|
+
set Position(pos: Vector3);
|
|
66
114
|
delete(): void;
|
|
67
115
|
attachToBone(entityBone: CommonBaseEntityBone, position: Vector3, rotation: Vector3, collisions?: boolean, unk9?: boolean, useSoftPinning?: boolean, rotationOrder?: number): void;
|
|
68
116
|
}
|
|
@@ -1,27 +1,63 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import { Vector3 } from "
|
|
3
|
+
import { Vector3 } from "@common/utils/Vector";
|
|
4
4
|
import cfx from "../cfx/cfx";
|
|
5
5
|
import { CommonModel } from "../CommonModel";
|
|
6
|
-
import { GlobalData } from "
|
|
7
|
-
|
|
6
|
+
import { GlobalData } from "@common/GlobalData";
|
|
7
|
+
import { IHandle } from "./IHandle";
|
|
8
|
+
class CommonBaseEntity extends IHandle {
|
|
8
9
|
static {
|
|
9
10
|
__name(this, "CommonBaseEntity");
|
|
10
11
|
}
|
|
11
|
-
handle;
|
|
12
12
|
stateBagCookies = [];
|
|
13
13
|
netId = null;
|
|
14
14
|
constructor(handle) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
super(handle);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Replaces the current handle for the entity used on, this should be used sparringly, mainly
|
|
19
|
+
* in situations where you're going to reuse an entity over and over and don't want to make a
|
|
20
|
+
* new entity every time.
|
|
21
|
+
*
|
|
22
|
+
* **WARNING**: This does no checks, if you provide it an invalid entity it will use it
|
|
23
|
+
*
|
|
24
|
+
* ```ts
|
|
25
|
+
* const REUSABLE_ENTITY = new Entity(entityHandle);
|
|
26
|
+
*
|
|
27
|
+
* onNet("entityHandler", (entNetId: number) => {
|
|
28
|
+
* // if no net entity we should ignore
|
|
29
|
+
* if (!NetworkDoesEntityExistWithNetworkId(entNetId)) return;
|
|
30
|
+
*
|
|
31
|
+
* // Reuse our entity so we don't have to initialize a new one
|
|
32
|
+
* REUSABLE_ENTITY.replaceHandle(NetworkGetEntityFromNetworkId(entNetId));
|
|
33
|
+
* // Do something with REUSABLE_ENTITY entity
|
|
34
|
+
* })
|
|
35
|
+
```
|
|
36
|
+
*/
|
|
37
|
+
replaceHandle(newHandle) {
|
|
38
|
+
this.handle = newHandle;
|
|
39
|
+
}
|
|
40
|
+
/*
|
|
41
|
+
* @returns `true` if the entity exists, `false` otherwise.
|
|
42
|
+
*/
|
|
43
|
+
get Exists() {
|
|
44
|
+
return DoesEntityExist(this.handle);
|
|
19
45
|
}
|
|
46
|
+
/*
|
|
47
|
+
* @returns the handle of the specified entity
|
|
48
|
+
*/
|
|
20
49
|
get Handle() {
|
|
21
50
|
return this.handle;
|
|
22
51
|
}
|
|
23
52
|
/**
|
|
24
|
-
*
|
|
53
|
+
* This will return a warning if the the entity is not networked, you should always use {@link IsNetworked} prior to calling thisl
|
|
54
|
+
* @returns the network for the specified entity
|
|
55
|
+
*/
|
|
56
|
+
get NetworkId() {
|
|
57
|
+
return NetworkGetNetworkIdFromEntity(this.handle);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* @returns `true` if the current entity is networked, false otherwise
|
|
25
61
|
*/
|
|
26
62
|
get IsNetworked() {
|
|
27
63
|
return NetworkGetEntityIsNetworked(this.handle);
|
|
@@ -30,19 +66,13 @@ class CommonBaseEntity {
|
|
|
30
66
|
if (networked) {
|
|
31
67
|
NetworkRegisterEntityAsNetworked(this.handle);
|
|
32
68
|
} else {
|
|
33
|
-
if (GlobalData.
|
|
69
|
+
if (GlobalData.IS_REDM) {
|
|
34
70
|
Citizen.invokeNative("0xE31A04513237DC89", this.handle);
|
|
35
71
|
} else {
|
|
36
72
|
NetworkUnregisterNetworkedEntity(this.handle);
|
|
37
73
|
}
|
|
38
74
|
}
|
|
39
75
|
}
|
|
40
|
-
get NetworkId() {
|
|
41
|
-
if (this.netId) {
|
|
42
|
-
return this.netId;
|
|
43
|
-
}
|
|
44
|
-
return NetworkGetNetworkIdFromEntity(this.handle);
|
|
45
|
-
}
|
|
46
76
|
get State() {
|
|
47
77
|
return cfx.Entity(this.handle).state;
|
|
48
78
|
}
|
|
@@ -83,12 +113,6 @@ class CommonBaseEntity {
|
|
|
83
113
|
get Matrix() {
|
|
84
114
|
return Vector3.fromArrays(GetEntityMatrix(this.handle));
|
|
85
115
|
}
|
|
86
|
-
get Health() {
|
|
87
|
-
return GetEntityHealth(this.handle);
|
|
88
|
-
}
|
|
89
|
-
set Health(amount) {
|
|
90
|
-
SetEntityHealth(this.handle, amount);
|
|
91
|
-
}
|
|
92
116
|
get MaxHealth() {
|
|
93
117
|
return GetEntityMaxHealth(this.handle);
|
|
94
118
|
}
|
|
@@ -102,6 +126,9 @@ class CommonBaseEntity {
|
|
|
102
126
|
SetEntityHealth(this.handle, 200);
|
|
103
127
|
}
|
|
104
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* @returns Returns true if the entity is dead
|
|
131
|
+
*/
|
|
105
132
|
get IsDead() {
|
|
106
133
|
return IsEntityDead(this.handle);
|
|
107
134
|
}
|
|
@@ -127,12 +154,6 @@ class CommonBaseEntity {
|
|
|
127
154
|
SetEntityAsNoLongerNeeded(this.handle);
|
|
128
155
|
}
|
|
129
156
|
}
|
|
130
|
-
get Position() {
|
|
131
|
-
return Vector3.fromArray(GetEntityCoords(this.handle, false));
|
|
132
|
-
}
|
|
133
|
-
set Position(position) {
|
|
134
|
-
SetEntityCoords(this.handle, position.x, position.y, position.z, false, false, false, true);
|
|
135
|
-
}
|
|
136
157
|
set PositionNoOffset(position) {
|
|
137
158
|
SetEntityCoordsNoOffset(this.handle, position.x, position.y, position.z, true, true, true);
|
|
138
159
|
}
|
|
@@ -145,12 +166,6 @@ class CommonBaseEntity {
|
|
|
145
166
|
set Quaternion(quaternion) {
|
|
146
167
|
SetEntityQuaternion(this.handle, quaternion.x, quaternion.y, quaternion.z, quaternion.w);
|
|
147
168
|
}
|
|
148
|
-
get Heading() {
|
|
149
|
-
return GetEntityHeading(this.handle);
|
|
150
|
-
}
|
|
151
|
-
set Heading(heading) {
|
|
152
|
-
SetEntityHeading(this.handle, heading);
|
|
153
|
-
}
|
|
154
169
|
get IsPositionFrozen() {
|
|
155
170
|
return IsEntityPositionFrozen(this.handle);
|
|
156
171
|
}
|
|
@@ -163,8 +178,45 @@ class CommonBaseEntity {
|
|
|
163
178
|
set Velocity(velocity) {
|
|
164
179
|
SetEntityVelocity(this.handle, velocity.x, velocity.y, velocity.z);
|
|
165
180
|
}
|
|
166
|
-
|
|
167
|
-
return
|
|
181
|
+
get IsVisible() {
|
|
182
|
+
return IsEntityVisible(this.handle);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* @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.
|
|
186
|
+
*/
|
|
187
|
+
set Health(amount) {
|
|
188
|
+
SetEntityHealth(this.handle, amount, 0);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* @returns the amount of health the current {@link BaseEntity} has
|
|
192
|
+
*/
|
|
193
|
+
get Health() {
|
|
194
|
+
return GetEntityHealth(this.handle);
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* @returns the heading of the current {@link BaseEntity}
|
|
198
|
+
*/
|
|
199
|
+
get Heading() {
|
|
200
|
+
return GetEntityHeading(this.handle);
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* @param heading sets the entitys heading to the specified heading, this can be in the range of 0..360
|
|
204
|
+
*/
|
|
205
|
+
set Heading(heading) {
|
|
206
|
+
SetEntityHeading(this.handle, heading);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* @returns the position of the current Entity
|
|
210
|
+
*/
|
|
211
|
+
get Position() {
|
|
212
|
+
return Vector3.fromArray(GetEntityCoords(this.handle, true, true));
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* You should always try to load the collisions before setting the entitys position if going a long distance.
|
|
216
|
+
* @param pos sets the position for the current ped
|
|
217
|
+
*/
|
|
218
|
+
set Position(pos) {
|
|
219
|
+
SetEntityCoords(this.handle, pos.x, pos.y, pos.z, false, false, false, false);
|
|
168
220
|
}
|
|
169
221
|
delete() {
|
|
170
222
|
this.IsMissionEntity = true;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Vector3 } from "
|
|
2
|
-
import type {
|
|
1
|
+
import { Vector3 } from "@common/utils/Vector";
|
|
2
|
+
import type { IHandle } from "./IHandle";
|
|
3
3
|
export declare abstract class CommonBaseEntityBone {
|
|
4
|
+
protected readonly owner: IHandle;
|
|
5
|
+
protected readonly index: number;
|
|
6
|
+
constructor(owner: IHandle, boneIndex?: number, boneName?: string);
|
|
4
7
|
get Index(): number;
|
|
5
|
-
get Owner():
|
|
8
|
+
get Owner(): IHandle;
|
|
6
9
|
get Position(): Vector3;
|
|
7
10
|
get IsValid(): boolean;
|
|
8
|
-
protected readonly owner: CommonBaseEntity;
|
|
9
|
-
protected readonly index: number;
|
|
10
|
-
constructor(owner: CommonBaseEntity, boneIndex?: number, boneName?: string);
|
|
11
11
|
}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import { Vector3 } from "
|
|
3
|
+
import { Vector3 } from "@common/utils/Vector";
|
|
4
4
|
class CommonBaseEntityBone {
|
|
5
5
|
static {
|
|
6
6
|
__name(this, "CommonBaseEntityBone");
|
|
7
7
|
}
|
|
8
|
+
owner;
|
|
9
|
+
index;
|
|
10
|
+
constructor(owner, boneIndex, boneName) {
|
|
11
|
+
this.owner = owner;
|
|
12
|
+
this.index = boneIndex ? boneIndex : GetEntityBoneIndexByName(this.owner.Handle, boneName ?? "");
|
|
13
|
+
}
|
|
8
14
|
get Index() {
|
|
9
15
|
return this.index;
|
|
10
16
|
}
|
|
@@ -20,12 +26,6 @@ class CommonBaseEntityBone {
|
|
|
20
26
|
get IsValid() {
|
|
21
27
|
return this.owner.exists() && this.index !== -1;
|
|
22
28
|
}
|
|
23
|
-
owner;
|
|
24
|
-
index;
|
|
25
|
-
constructor(owner, boneIndex, boneName) {
|
|
26
|
-
this.owner = owner;
|
|
27
|
-
this.index = boneIndex ? boneIndex : GetEntityBoneIndexByName(this.owner.Handle, boneName ?? "");
|
|
28
|
-
}
|
|
29
29
|
}
|
|
30
30
|
export {
|
|
31
31
|
CommonBaseEntityBone
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { CommonBaseEntity } from "./CommonBaseEntity";
|
|
2
1
|
import type { CommonBaseEntityBone } from "./CommonBaseEntityBone";
|
|
2
|
+
import type { IHandle } from "./IHandle";
|
|
3
3
|
export declare abstract class CommonBaseEntityBoneCollection {
|
|
4
|
-
protected readonly owner:
|
|
5
|
-
constructor(owner:
|
|
4
|
+
protected readonly owner: IHandle;
|
|
5
|
+
constructor(owner: IHandle);
|
|
6
6
|
hasBone(name: string): boolean;
|
|
7
7
|
abstract getBone(boneIndex?: number, boneName?: string): CommonBaseEntityBone;
|
|
8
8
|
abstract get Core(): CommonBaseEntityBone;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CommonBaseEntity } from "./CommonBaseEntity";
|
|
2
1
|
import { CommonBaseEntityBone } from "./CommonBaseEntityBone";
|
|
2
|
+
import type { IHandle } from "./IHandle";
|
|
3
3
|
export declare class CommonEntityBone extends CommonBaseEntityBone {
|
|
4
|
-
constructor(owner:
|
|
4
|
+
constructor(owner: IHandle, boneIndex?: number, boneName?: string);
|
|
5
5
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { CommonBaseEntity } from "./CommonBaseEntity";
|
|
2
1
|
import { CommonBaseEntityBoneCollection } from "./CommonBaseEntityBoneCollection";
|
|
3
2
|
import { CommonEntityBone } from "./CommonEntityBone";
|
|
3
|
+
import type { IHandle } from "./IHandle";
|
|
4
4
|
export declare class CommonEntityBoneCollection extends CommonBaseEntityBoneCollection {
|
|
5
|
-
constructor(owner:
|
|
5
|
+
constructor(owner: IHandle);
|
|
6
6
|
getBone(boneIndex: number): CommonEntityBone;
|
|
7
7
|
getBone(boneName: string): CommonEntityBone;
|
|
8
8
|
get Core(): CommonEntityBone;
|
package/entities/CommonPed.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { CommonBaseEntity } from "./CommonBaseEntity";
|
|
2
2
|
import { CommonPlayer } from "./CommonPlayer";
|
|
3
|
-
import { ClassTypes } from "
|
|
3
|
+
import { ClassTypes } from "@common/utils/ClassTypes";
|
|
4
4
|
import { CommonPedBoneCollection } from "./CommonPedBoneCollection";
|
|
5
5
|
import { CommonTasks } from "../CommonTasks";
|
|
6
6
|
export declare class CommonPed extends CommonBaseEntity {
|
|
7
7
|
private tasks;
|
|
8
8
|
protected type: ClassTypes;
|
|
9
9
|
protected bones?: CommonPedBoneCollection;
|
|
10
|
-
static exists(ped: CommonPed): boolean;
|
|
11
10
|
static fromHandle(handle: number): CommonPed | null;
|
|
12
11
|
static fromNetworkId(networkId: number): CommonPed | null;
|
|
13
12
|
constructor(handle: number);
|
package/entities/CommonPed.js
CHANGED
|
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
import { CommonBaseEntity } from "./CommonBaseEntity";
|
|
4
4
|
import { CommonPlayer } from "./CommonPlayer";
|
|
5
|
-
import { ClassTypes } from "
|
|
5
|
+
import { ClassTypes } from "@common/utils/ClassTypes";
|
|
6
6
|
import { CommonPedBoneCollection } from "./CommonPedBoneCollection";
|
|
7
7
|
import { CommonTasks } from "../CommonTasks";
|
|
8
8
|
class CommonPed extends CommonBaseEntity {
|
|
@@ -12,9 +12,6 @@ class CommonPed extends CommonBaseEntity {
|
|
|
12
12
|
tasks;
|
|
13
13
|
type = ClassTypes.Ped;
|
|
14
14
|
bones;
|
|
15
|
-
static exists(ped) {
|
|
16
|
-
return typeof ped !== "undefined" && ped.exists();
|
|
17
|
-
}
|
|
18
15
|
static fromHandle(handle) {
|
|
19
16
|
if (handle === 0 || !DoesEntityExist(handle)) {
|
|
20
17
|
return null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CommonBaseEntityBone } from "./CommonBaseEntityBone";
|
|
2
|
-
import type {
|
|
2
|
+
import type { IHandle } from "./IHandle";
|
|
3
3
|
export declare class CommonPedBone extends CommonBaseEntityBone {
|
|
4
|
-
constructor(owner:
|
|
4
|
+
constructor(owner: IHandle, boneId: number);
|
|
5
5
|
get IsValid(): boolean;
|
|
6
6
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CommonBaseEntityBoneCollection } from "./CommonBaseEntityBoneCollection";
|
|
2
|
-
import type { CommonPed } from "./CommonPed";
|
|
3
2
|
import { CommonPedBone } from "./CommonPedBone";
|
|
3
|
+
import type { IHandle } from "./IHandle";
|
|
4
4
|
export declare class CommonPedBoneCollection extends CommonBaseEntityBoneCollection {
|
|
5
|
-
constructor(owner:
|
|
5
|
+
constructor(owner: IHandle);
|
|
6
6
|
get Core(): CommonPedBone;
|
|
7
7
|
get LastDamaged(): CommonPedBone;
|
|
8
8
|
clearLastDamaged(): void;
|
package/entities/CommonPlayer.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
import { CommonPed } from "./CommonPed";
|
|
4
|
-
import { ClassTypes } from "
|
|
4
|
+
import { ClassTypes } from "@common/utils/ClassTypes";
|
|
5
5
|
import { GetEntityClassFromHandle } from "./GetEntityClassIdFromHandle";
|
|
6
6
|
import cfx from "../cfx/cfx";
|
|
7
7
|
import { GameConstants } from "../CommonGameConstants";
|
package/entities/CommonProp.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { ClassTypes } from "
|
|
1
|
+
import { ClassTypes } from "@common/utils/ClassTypes";
|
|
2
2
|
import { CommonBaseEntity } from "./CommonBaseEntity";
|
|
3
3
|
import { CommonEntityBoneCollection } from "./CommonEntityBoneCollection";
|
|
4
4
|
import type { CommonEntity } from "./CommonEntityType";
|
|
5
5
|
export declare class CommonProp extends CommonBaseEntity {
|
|
6
|
-
static exists(prop: CommonProp): boolean;
|
|
7
6
|
static fromHandle(handle: number): CommonProp | null;
|
|
8
7
|
static fromNetworkId(networkId: number): CommonProp | null;
|
|
9
8
|
protected type: ClassTypes;
|
package/entities/CommonProp.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import { ClassTypes } from "
|
|
3
|
+
import { ClassTypes } from "@common/utils/ClassTypes";
|
|
4
4
|
import { CommonBaseEntity } from "./CommonBaseEntity";
|
|
5
5
|
import { CommonEntityBoneCollection } from "./CommonEntityBoneCollection";
|
|
6
6
|
import { GetEntityClassFromHandle } from "./GetEntityClassIdFromHandle";
|
|
@@ -8,9 +8,6 @@ class CommonProp extends CommonBaseEntity {
|
|
|
8
8
|
static {
|
|
9
9
|
__name(this, "CommonProp");
|
|
10
10
|
}
|
|
11
|
-
static exists(prop) {
|
|
12
|
-
return typeof prop !== "undefined" && prop.exists();
|
|
13
|
-
}
|
|
14
11
|
static fromHandle(handle) {
|
|
15
12
|
return new this(handle);
|
|
16
13
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { ClassTypes } from "
|
|
1
|
+
import { ClassTypes } from "@common/utils/ClassTypes";
|
|
2
2
|
import { CommonBaseEntity } from "./CommonBaseEntity";
|
|
3
3
|
import { CommonEntityBoneCollection } from "./CommonEntityBoneCollection";
|
|
4
4
|
export declare class CommonVehicle extends CommonBaseEntity {
|
|
5
|
-
static exists(vehicle: CommonVehicle): boolean;
|
|
6
5
|
static fromHandle(handle: number): CommonVehicle | null;
|
|
7
6
|
static fromNetworkId(networkId: number): CommonVehicle | null;
|
|
8
7
|
protected type: ClassTypes;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import { ClassTypes } from "
|
|
3
|
+
import { ClassTypes } from "@common/utils/ClassTypes";
|
|
4
4
|
import { CommonBaseEntity } from "./CommonBaseEntity";
|
|
5
5
|
import { CommonEntityBoneCollection } from "./CommonEntityBoneCollection";
|
|
6
6
|
class CommonVehicle extends CommonBaseEntity {
|
|
7
7
|
static {
|
|
8
8
|
__name(this, "CommonVehicle");
|
|
9
9
|
}
|
|
10
|
-
static exists(vehicle) {
|
|
11
|
-
return typeof vehicle !== "undefined" && vehicle.exists();
|
|
12
|
-
}
|
|
13
10
|
static fromHandle(handle) {
|
|
14
11
|
if (handle === 0 || !DoesEntityExist(handle)) {
|
|
15
12
|
return null;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
class IHandle {
|
|
4
|
+
static {
|
|
5
|
+
__name(this, "IHandle");
|
|
6
|
+
}
|
|
7
|
+
handle;
|
|
8
|
+
constructor(handle) {
|
|
9
|
+
this.handle = handle;
|
|
10
|
+
}
|
|
11
|
+
exists() {
|
|
12
|
+
return DoesEntityExist(this.handle);
|
|
13
|
+
}
|
|
14
|
+
get Handle() {
|
|
15
|
+
return this.handle;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
IHandle
|
|
20
|
+
};
|
package/index.d.ts
CHANGED
|
@@ -17,28 +17,8 @@ export * from "./entities/CommonPlayer";
|
|
|
17
17
|
export * from "./entities/CommonProp";
|
|
18
18
|
export * from "./entities/CommonVehicle";
|
|
19
19
|
export * from "./entities/GetEntityClassIdFromHandle";
|
|
20
|
+
export * from "./entities/IHandle";
|
|
20
21
|
export * from "./definitions/index.d";
|
|
21
22
|
export * from "./definitions/redm.d";
|
|
22
|
-
export * from "./common/Command";
|
|
23
|
-
export * from "./common/Convar";
|
|
24
|
-
export * from "./common/GlobalData";
|
|
25
|
-
export * from "./common/Kvp";
|
|
26
|
-
export * from "./common/Resource";
|
|
27
|
-
export * from "./common/types";
|
|
28
|
-
export * from "./common/utils/ClassTypes";
|
|
29
|
-
export * from "./common/utils/Color";
|
|
30
|
-
export * from "./common/utils/Delay";
|
|
31
|
-
export * from "./common/utils/Maths";
|
|
32
|
-
export * from "./common/utils/Point";
|
|
33
|
-
export * from "./common/utils/PointF";
|
|
34
|
-
export * from "./common/utils/Quaternion";
|
|
35
|
-
export * from "./common/utils/Vector";
|
|
36
|
-
export * from "./common/utils/cleanPlayerName";
|
|
37
|
-
export * from "./common/utils/enumValues";
|
|
38
|
-
export * from "./common/utils/getStringFromUInt8Array";
|
|
39
|
-
export * from "./common/utils/getUInt32FromUint8Array";
|
|
40
|
-
export * from "./common/utils/randomInt";
|
|
41
|
-
export * from "./common/net/NetworkedMap";
|
|
42
|
-
export * from "./common/decors/Events";
|
|
43
23
|
export * from "./cfx/StateBagChangeHandler";
|
|
44
24
|
export * from "./cfx/cfx";
|