rock-mod 0.22.0 → 0.23.1
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/entities/ccmp/object/CCMPObject.d.ts +3 -6
- package/dist/client/entities/ccmp/object/CCMPObject.js +33 -102
- package/dist/client/entities/ccmp/player/CCMPPlayer.d.ts +14 -16
- package/dist/client/entities/ccmp/player/CCMPPlayer.js +85 -92
- package/dist/client/entities/ccmp/vehicle/CCMPVehicle.d.ts +32 -49
- package/dist/client/entities/ccmp/vehicle/CCMPVehicle.js +117 -198
- package/dist/client/entities/ccmp/vehicle/CCMPVehiclesManager.js +2 -1
- package/dist/client/game/ccmp/chat/CCMPChatManager.d.ts +2 -22
- package/dist/client/game/ccmp/chat/CCMPChatManager.js +6 -34
- package/dist/client/game/ccmp/graphics/CCMPGraphicsManager.js +7 -17
- package/dist/client/game/ccmp/ui/CCMPUiManager.d.ts +0 -29
- package/dist/client/game/ccmp/ui/CCMPUiManager.js +5 -41
- package/dist/client/net/ccmp/CCMPNetManager.d.ts +0 -7
- package/dist/client/net/ccmp/CCMPNetManager.js +0 -26
- package/dist/client/net/ccmp/events/CCMPEventsBridge.d.ts +3 -1
- package/dist/client/net/ccmp/events/CCMPEventsBridge.js +33 -3
- package/dist/server/entities/altv/colshape/AltVColshape.d.ts +2 -0
- package/dist/server/entities/altv/colshape/AltVColshape.js +6 -0
- package/dist/server/entities/ccmp/player/CCMPPlayersManager.js +15 -0
- package/dist/server/entities/ccmp/vehicle/CCMPVehicle.d.ts +27 -13
- package/dist/server/entities/ccmp/vehicle/CCMPVehicle.js +82 -39
- package/dist/server/entities/common/colshape/IColshape.d.ts +2 -0
- package/dist/server/entities/mock/colshape/MockColshape.d.ts +3 -0
- package/dist/server/entities/mock/colshape/MockColshape.js +8 -0
- package/dist/server/entities/ragemp/colshape/RageColshape.d.ts +2 -0
- package/dist/server/entities/ragemp/colshape/RageColshape.js +6 -0
- package/dist/server/net/ccmp/CCMPNetManager.js +0 -5
- package/dist/server/net/ccmp/events/CCMPEventsManager.d.ts +6 -2
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { type Object as CcmpObject } from "@classic-mp/types/client";
|
|
1
2
|
import { BaseObjectType } from "../../../../shared/entities";
|
|
2
3
|
import { type IVector3D, Vector3D } from "../../../../shared/common/utils";
|
|
3
|
-
import { type Object as CcmpObject } from "@classic-mp/types/client";
|
|
4
4
|
import { type IBaseObject } from "../../common/baseObject/IBaseObject";
|
|
5
5
|
import { type IObject } from "../../common/object/IObject";
|
|
6
6
|
export declare class CCMPObject implements IObject {
|
|
@@ -17,12 +17,12 @@ export declare class CCMPObject implements IObject {
|
|
|
17
17
|
get position(): Vector3D;
|
|
18
18
|
get dimension(): number;
|
|
19
19
|
setPosition(value: IVector3D): void;
|
|
20
|
-
setDimension(
|
|
20
|
+
setDimension(value: number): void;
|
|
21
21
|
setCoords(xPos: number, yPos: number, zPos: number, xAxis: boolean, yAxis: boolean, zAxis: boolean, clearArea: boolean): void;
|
|
22
22
|
get model(): number;
|
|
23
23
|
get heading(): number;
|
|
24
24
|
setHeading(heading: number): void;
|
|
25
|
-
setModel(
|
|
25
|
+
setModel(value: string): void;
|
|
26
26
|
get rotation(): Vector3D;
|
|
27
27
|
get forwardVector(): Vector3D;
|
|
28
28
|
setRotation(value: IVector3D): void;
|
|
@@ -46,8 +46,5 @@ export declare class CCMPObject implements IObject {
|
|
|
46
46
|
detach(useDetachVelocity: boolean, collision: boolean): void;
|
|
47
47
|
getSpeed(): number;
|
|
48
48
|
isPlayingAnim(dictionary: string, name: string, taskFlag: number): boolean;
|
|
49
|
-
private _withHandle;
|
|
50
|
-
private _withHandleVoid;
|
|
51
49
|
private _normalizeHandle;
|
|
52
|
-
private _getOffsetFromCachedTransform;
|
|
53
50
|
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
1
|
import { BaseObjectType } from "../../../../shared/entities";
|
|
3
2
|
import { Vector3D } from "../../../../shared/common/utils";
|
|
4
|
-
const notImplemented = (memberName) => {
|
|
5
|
-
throw new Error(`CCMPObject.${memberName}: not implemented`);
|
|
6
|
-
};
|
|
7
3
|
export class CCMPObject {
|
|
8
4
|
constructor(_ccmpObject, _onDestroy = () => { }) {
|
|
9
5
|
this._ccmpObject = _ccmpObject;
|
|
@@ -23,8 +19,7 @@ export class CCMPObject {
|
|
|
23
19
|
return !this._destroyed && this._ccmpObject.isExists;
|
|
24
20
|
}
|
|
25
21
|
get handle() {
|
|
26
|
-
|
|
27
|
-
return Number.isFinite(handle) && handle > 0 ? Math.trunc(handle) : 0;
|
|
22
|
+
return this._normalizeHandle(this._ccmpObject.handle);
|
|
28
23
|
}
|
|
29
24
|
destroy() {
|
|
30
25
|
if (this._destroyed)
|
|
@@ -41,15 +36,13 @@ export class CCMPObject {
|
|
|
41
36
|
return this._ccmpObject.dimension;
|
|
42
37
|
}
|
|
43
38
|
setPosition(value) {
|
|
44
|
-
this.
|
|
39
|
+
this._ccmpObject.setPosition(value);
|
|
45
40
|
}
|
|
46
|
-
setDimension(
|
|
47
|
-
|
|
41
|
+
setDimension(value) {
|
|
42
|
+
this._ccmpObject.setDimension(value);
|
|
48
43
|
}
|
|
49
44
|
setCoords(xPos, yPos, zPos, xAxis, yAxis, zAxis, clearArea) {
|
|
50
|
-
this.
|
|
51
|
-
ccmp.natives.entity.setEntityCoords(handle, xPos, yPos, zPos, xAxis, yAxis, zAxis, clearArea);
|
|
52
|
-
});
|
|
45
|
+
this._ccmpObject.setCoords(xPos, yPos, zPos, xAxis, yAxis, zAxis, clearArea);
|
|
53
46
|
}
|
|
54
47
|
get model() {
|
|
55
48
|
return this._ccmpObject.model;
|
|
@@ -58,161 +51,99 @@ export class CCMPObject {
|
|
|
58
51
|
return this._ccmpObject.heading;
|
|
59
52
|
}
|
|
60
53
|
setHeading(heading) {
|
|
61
|
-
this.
|
|
62
|
-
ccmp.natives.entity.setEntityHeading(handle, heading);
|
|
63
|
-
});
|
|
54
|
+
this._ccmpObject.setHeading(heading);
|
|
64
55
|
}
|
|
65
|
-
setModel(
|
|
66
|
-
|
|
56
|
+
setModel(value) {
|
|
57
|
+
this._ccmpObject.setModel(value);
|
|
67
58
|
}
|
|
68
59
|
get rotation() {
|
|
69
60
|
const { x, y, z } = this._ccmpObject.rotation;
|
|
70
61
|
return new Vector3D(x, y, z);
|
|
71
62
|
}
|
|
72
63
|
get forwardVector() {
|
|
73
|
-
const
|
|
74
|
-
return new Vector3D(
|
|
64
|
+
const { x, y, z } = this._ccmpObject.forwardVector;
|
|
65
|
+
return new Vector3D(x, y, z);
|
|
75
66
|
}
|
|
76
67
|
setRotation(value) {
|
|
77
|
-
this.
|
|
78
|
-
ccmp.natives.entity.setEntityRotation(handle, value.x, value.y, value.z, 2, true);
|
|
79
|
-
});
|
|
68
|
+
this._ccmpObject.setRotation(value);
|
|
80
69
|
}
|
|
81
70
|
freezePosition(freeze) {
|
|
82
|
-
this.
|
|
83
|
-
ccmp.natives.entity.freezeEntityPosition(handle, freeze);
|
|
84
|
-
});
|
|
71
|
+
this._ccmpObject.freezePosition(freeze);
|
|
85
72
|
}
|
|
86
73
|
setCollision(collision, keepPhysics) {
|
|
87
|
-
this.
|
|
88
|
-
ccmp.natives.entity.setEntityCollision(handle, collision, keepPhysics);
|
|
89
|
-
});
|
|
74
|
+
this._ccmpObject.setCollision(collision, keepPhysics);
|
|
90
75
|
}
|
|
91
76
|
setInvincible(invincible) {
|
|
92
|
-
this.
|
|
93
|
-
ccmp.natives.entity.setEntityInvincible(handle, invincible, true);
|
|
94
|
-
});
|
|
77
|
+
this._ccmpObject.setInvincible(invincible);
|
|
95
78
|
}
|
|
96
79
|
setVisible(visible) {
|
|
97
|
-
this.
|
|
98
|
-
ccmp.natives.entity.setEntityVisible(handle, visible, false);
|
|
99
|
-
});
|
|
80
|
+
this._ccmpObject.setVisible(visible);
|
|
100
81
|
}
|
|
101
82
|
setAlpha(alpha) {
|
|
102
|
-
this.
|
|
103
|
-
ccmp.natives.entity.setEntityAlpha(handle, alpha, false);
|
|
104
|
-
});
|
|
83
|
+
this._ccmpObject.setAlpha(alpha);
|
|
105
84
|
}
|
|
106
85
|
get alpha() {
|
|
107
|
-
return this.
|
|
86
|
+
return this._ccmpObject.alpha;
|
|
108
87
|
}
|
|
109
88
|
resetAlpha() {
|
|
110
|
-
this.
|
|
111
|
-
ccmp.natives.entity.resetEntityAlpha(handle);
|
|
112
|
-
});
|
|
89
|
+
this._ccmpObject.resetAlpha();
|
|
113
90
|
}
|
|
114
91
|
getOffsetFromInWorldCoords(offsetX, offsetY, offsetZ) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
return new Vector3D(x, y, z);
|
|
118
|
-
});
|
|
92
|
+
const { x, y, z } = this._ccmpObject.getOffsetFromInWorldCoords(offsetX, offsetY, offsetZ);
|
|
93
|
+
return new Vector3D(x, y, z);
|
|
119
94
|
}
|
|
120
95
|
getBoneIndexByName(boneName) {
|
|
121
|
-
return this.
|
|
96
|
+
return this._ccmpObject.getBoneIndexByName(boneName);
|
|
122
97
|
}
|
|
123
98
|
getWorldPositionOfBone(boneIndex) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
return new Vector3D(x, y, z);
|
|
127
|
-
});
|
|
99
|
+
const { x, y, z } = this._ccmpObject.getWorldPositionOfBone(boneIndex);
|
|
100
|
+
return new Vector3D(x, y, z);
|
|
128
101
|
}
|
|
129
102
|
getVariable(name) {
|
|
130
103
|
const remoteId = this.remoteId;
|
|
131
|
-
if (remoteId === null)
|
|
104
|
+
if (remoteId === null)
|
|
132
105
|
return null;
|
|
133
|
-
}
|
|
134
106
|
const value = ccmp.entities.getStreamSyncedMeta(ccmp.entities.ENTITY_TYPE.Object, remoteId, name);
|
|
135
107
|
return value === undefined ? null : value;
|
|
136
108
|
}
|
|
137
109
|
getSyncedMeta(key) {
|
|
138
110
|
const remoteId = this.remoteId;
|
|
139
|
-
if (remoteId === null)
|
|
111
|
+
if (remoteId === null)
|
|
140
112
|
return undefined;
|
|
141
|
-
}
|
|
142
113
|
return ccmp.entities.getStreamSyncedMeta(ccmp.entities.ENTITY_TYPE.Object, remoteId, key);
|
|
143
114
|
}
|
|
144
115
|
hasSyncedMeta(key) {
|
|
145
116
|
const remoteId = this.remoteId;
|
|
146
|
-
if (remoteId === null)
|
|
117
|
+
if (remoteId === null)
|
|
147
118
|
return false;
|
|
148
|
-
}
|
|
149
119
|
return ccmp.entities.hasStreamSyncedMeta(ccmp.entities.ENTITY_TYPE.Object, remoteId, key);
|
|
150
120
|
}
|
|
151
121
|
getSyncedMetaKeys() {
|
|
152
122
|
const remoteId = this.remoteId;
|
|
153
|
-
if (remoteId === null)
|
|
123
|
+
if (remoteId === null)
|
|
154
124
|
return [];
|
|
155
|
-
}
|
|
156
125
|
return ccmp.entities.getStreamSyncedMetaKeys(ccmp.entities.ENTITY_TYPE.Object, remoteId);
|
|
157
126
|
}
|
|
158
127
|
attachTo(entity, boneIndex, xPos, yPos, zPos, xRot, yRot, zRot, useSoftPinning, collision, isPed, vertexIndex, fixedRot) {
|
|
159
|
-
|
|
160
|
-
if (!targetHandle)
|
|
161
|
-
return;
|
|
162
|
-
this._withHandleVoid((handle) => {
|
|
163
|
-
ccmp.natives.entity.attachEntityToEntity(handle, targetHandle, boneIndex, xPos, yPos, zPos, xRot, yRot, zRot, false, useSoftPinning, collision, isPed, vertexIndex, fixedRot, 0);
|
|
164
|
-
});
|
|
128
|
+
this._ccmpObject.attachTo(entity, boneIndex, xPos, yPos, zPos, xRot, yRot, zRot, useSoftPinning, collision, isPed, vertexIndex, fixedRot);
|
|
165
129
|
}
|
|
166
130
|
isAttachedTo(entity) {
|
|
167
|
-
|
|
168
|
-
if (!targetHandle)
|
|
169
|
-
return false;
|
|
170
|
-
return this._withHandle(false, (handle) => ccmp.natives.entity.isEntityAttachedToEntity(handle, targetHandle));
|
|
131
|
+
return this._ccmpObject.isAttachedTo(entity);
|
|
171
132
|
}
|
|
172
133
|
attachToEntity(target, boneIndex, offset, rotation, p9, useSoftPinning, collision, isPed, vertexIndex, fixedRot) {
|
|
173
|
-
|
|
174
|
-
if (!targetHandle)
|
|
175
|
-
return;
|
|
176
|
-
this._withHandleVoid((handle) => {
|
|
177
|
-
ccmp.natives.entity.attachEntityToEntity(handle, targetHandle, boneIndex, offset.x, offset.y, offset.z, rotation.x, rotation.y, rotation.z, p9, useSoftPinning, collision, isPed, vertexIndex, fixedRot, 0);
|
|
178
|
-
});
|
|
134
|
+
this._ccmpObject.attachToEntity(target, boneIndex, offset, rotation, p9, useSoftPinning, collision, isPed, vertexIndex, fixedRot);
|
|
179
135
|
}
|
|
180
136
|
detach(useDetachVelocity, collision) {
|
|
181
|
-
this.
|
|
182
|
-
ccmp.natives.entity.detachEntity(handle, useDetachVelocity, collision);
|
|
183
|
-
});
|
|
137
|
+
this._ccmpObject.detach(useDetachVelocity, collision);
|
|
184
138
|
}
|
|
185
139
|
getSpeed() {
|
|
186
|
-
return this.
|
|
140
|
+
return this._ccmpObject.getSpeed();
|
|
187
141
|
}
|
|
188
142
|
isPlayingAnim(dictionary, name, taskFlag) {
|
|
189
|
-
return this.
|
|
190
|
-
}
|
|
191
|
-
_withHandle(fallback, callback) {
|
|
192
|
-
const handle = this.handle;
|
|
193
|
-
if (!handle) {
|
|
194
|
-
return fallback;
|
|
195
|
-
}
|
|
196
|
-
return callback(handle);
|
|
197
|
-
}
|
|
198
|
-
_withHandleVoid(callback) {
|
|
199
|
-
const handle = this.handle;
|
|
200
|
-
if (!handle) {
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
callback(handle);
|
|
143
|
+
return this._ccmpObject.isPlayingAnim(dictionary, name, taskFlag);
|
|
204
144
|
}
|
|
205
145
|
_normalizeHandle(value) {
|
|
206
146
|
const handle = Number(value);
|
|
207
147
|
return Number.isFinite(handle) && handle > 0 ? Math.trunc(handle) : 0;
|
|
208
148
|
}
|
|
209
|
-
_getOffsetFromCachedTransform(offsetX, offsetY, offsetZ) {
|
|
210
|
-
const position = this.position;
|
|
211
|
-
const headingRad = (this.heading * Math.PI) / 180;
|
|
212
|
-
const rightX = Math.cos(headingRad);
|
|
213
|
-
const rightY = Math.sin(headingRad);
|
|
214
|
-
const forwardX = -Math.sin(headingRad);
|
|
215
|
-
const forwardY = Math.cos(headingRad);
|
|
216
|
-
return new Vector3D(position.x + rightX * offsetX + forwardX * offsetY, position.y + rightY * offsetX + forwardY * offsetY, position.z + offsetZ);
|
|
217
|
-
}
|
|
218
149
|
}
|
|
@@ -45,7 +45,7 @@ export declare class CCMPPlayer implements IPlayer {
|
|
|
45
45
|
get model(): number;
|
|
46
46
|
get heading(): number;
|
|
47
47
|
setHeading(heading: number): void;
|
|
48
|
-
setModel(
|
|
48
|
+
setModel(value: string): void;
|
|
49
49
|
get rotation(): IVector3D;
|
|
50
50
|
setRotation(value: IVector3D): void;
|
|
51
51
|
get forwardVector(): IVector3D;
|
|
@@ -82,31 +82,29 @@ export declare class CCMPPlayer implements IPlayer {
|
|
|
82
82
|
getAmmoInClip(_weapon: number): number;
|
|
83
83
|
getWeaponAmmo(_weapon: number): number;
|
|
84
84
|
getBoneIndex(boneId: number): number;
|
|
85
|
-
setDecoration(
|
|
86
|
-
removeDecoration(
|
|
85
|
+
setDecoration(collection: string, overlay: string): void;
|
|
86
|
+
removeDecoration(collection: string, overlay: string): void;
|
|
87
87
|
clearDecorations(): void;
|
|
88
|
-
setHeadBlendData(
|
|
89
|
-
setFaceFeature(
|
|
90
|
-
setHeadOverlay(
|
|
91
|
-
setHeadOverlayColor(
|
|
92
|
-
setEyeColor(
|
|
93
|
-
setHairColor(
|
|
94
|
-
setComponentVariation(
|
|
95
|
-
setPropertyVariation(
|
|
96
|
-
clearProp(
|
|
88
|
+
setHeadBlendData(shapeFirstId: number, shapeSecondId: number, shapeThirdId: number, skinFirstId: number, skinSecondId: number, skinThirdId: number, shapeMix: number, skinMix: number, thirdMix: number, isParent: boolean): void;
|
|
89
|
+
setFaceFeature(index: number, value: number): void;
|
|
90
|
+
setHeadOverlay(overlayId: number, index: number, opacity: number, _firstColor: number, _secondColor: number): void;
|
|
91
|
+
setHeadOverlayColor(overlayId: number, colorTypeId: number, firstColor: number, secondColor: number): void;
|
|
92
|
+
setEyeColor(eyeColor: number): void;
|
|
93
|
+
setHairColor(colorId: number, highlightColorId: number): void;
|
|
94
|
+
setComponentVariation(componentId: number, drawableId: number, textureId: number, paletteId: number): void;
|
|
95
|
+
setPropertyVariation(componentId: number, drawableId: number, textureId: number, attach: boolean): void;
|
|
96
|
+
clearProp(componentId: number): void;
|
|
97
97
|
get isLocalPlayer(): boolean;
|
|
98
98
|
taskSwapWeapon(): void;
|
|
99
99
|
taskEnterVehicle(vehicleHandle: number, timeout: number, seat: number, speed: number, flag: number, _p6: number): void;
|
|
100
100
|
clearTasks(): void;
|
|
101
101
|
clearTasksImmediately(): void;
|
|
102
|
-
taskPlayAnim(
|
|
103
|
-
stopAnim(
|
|
102
|
+
taskPlayAnim(dictionary: string, name: string, blendInSpeed: number, blendOutSpeed: number, duration: number, flag: number, playbackRate: number, lockX: boolean, lockY: boolean, lockZ: boolean): void;
|
|
103
|
+
stopAnim(dictionary: string, name: string, blendOutSpeed: number): void;
|
|
104
104
|
setMovementClipset(_clipset: string, _speed: number): void;
|
|
105
105
|
resetMovementClipset(_blendDuration: number): void;
|
|
106
106
|
getBoneCoords(boneId: number, offsetX: number, offsetY: number, offsetZ: number): IVector3D;
|
|
107
107
|
setNoCollision(otherHandle: number, thisFrameOnly: boolean): void;
|
|
108
108
|
private _getNativePlayer;
|
|
109
|
-
private _withHandle;
|
|
110
|
-
private _withHandleVoid;
|
|
111
109
|
private _warnOnce;
|
|
112
110
|
}
|
|
@@ -68,7 +68,8 @@ export class CCMPPlayer {
|
|
|
68
68
|
}
|
|
69
69
|
// -- IEntity --------------------------------------------------------------
|
|
70
70
|
get model() {
|
|
71
|
-
|
|
71
|
+
var _a, _b;
|
|
72
|
+
return (_b = (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.model) !== null && _b !== void 0 ? _b : 0;
|
|
72
73
|
}
|
|
73
74
|
get heading() {
|
|
74
75
|
var _a, _b;
|
|
@@ -78,25 +79,23 @@ export class CCMPPlayer {
|
|
|
78
79
|
var _a;
|
|
79
80
|
(_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.setHeading(heading);
|
|
80
81
|
}
|
|
81
|
-
setModel(
|
|
82
|
-
|
|
82
|
+
setModel(value) {
|
|
83
|
+
var _a;
|
|
84
|
+
(_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.setModel(value);
|
|
83
85
|
}
|
|
84
86
|
get rotation() {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
});
|
|
87
|
+
var _a;
|
|
88
|
+
const rotation = (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.rotation;
|
|
89
|
+
return rotation ? new Vector3D(rotation.x, rotation.y, rotation.z) : ZERO_VECTOR;
|
|
89
90
|
}
|
|
90
91
|
setRotation(value) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
});
|
|
92
|
+
var _a;
|
|
93
|
+
(_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.setRotation(value);
|
|
94
94
|
}
|
|
95
95
|
get forwardVector() {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
});
|
|
96
|
+
var _a;
|
|
97
|
+
const vector = (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.forwardVector;
|
|
98
|
+
return vector ? new Vector3D(vector.x, vector.y, vector.z) : ZERO_VECTOR;
|
|
100
99
|
}
|
|
101
100
|
freezePosition(freeze) {
|
|
102
101
|
var _a;
|
|
@@ -127,19 +126,18 @@ export class CCMPPlayer {
|
|
|
127
126
|
(_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.resetAlpha();
|
|
128
127
|
}
|
|
129
128
|
getOffsetFromInWorldCoords(offsetX, offsetY, offsetZ) {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
});
|
|
129
|
+
var _a;
|
|
130
|
+
const position = (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.getOffsetFromInWorldCoords(offsetX, offsetY, offsetZ);
|
|
131
|
+
return position ? new Vector3D(position.x, position.y, position.z) : ZERO_VECTOR;
|
|
134
132
|
}
|
|
135
133
|
getBoneIndexByName(boneName) {
|
|
136
|
-
|
|
134
|
+
var _a, _b;
|
|
135
|
+
return (_b = (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.getBoneIndexByName(boneName)) !== null && _b !== void 0 ? _b : -1;
|
|
137
136
|
}
|
|
138
137
|
getWorldPositionOfBone(boneIndex) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
});
|
|
138
|
+
var _a;
|
|
139
|
+
const position = (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.getWorldPositionOfBone(boneIndex);
|
|
140
|
+
return position ? new Vector3D(position.x, position.y, position.z) : ZERO_VECTOR;
|
|
143
141
|
}
|
|
144
142
|
getVariable(name) {
|
|
145
143
|
const value = ccmp.entities.getStreamSyncedMeta(ccmp.entities.ENTITY_TYPE.Player, this._id, name);
|
|
@@ -155,20 +153,20 @@ export class CCMPPlayer {
|
|
|
155
153
|
return ccmp.entities.getStreamSyncedMetaKeys(ccmp.entities.ENTITY_TYPE.Player, this._id);
|
|
156
154
|
}
|
|
157
155
|
attachToEntity(target, boneIndex, offset, rotation, p9, useSoftPinning, collision, isPed, vertexIndex, fixedRot) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
});
|
|
156
|
+
var _a;
|
|
157
|
+
(_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.attachToEntity(target, boneIndex, offset, rotation, p9, useSoftPinning, collision, isPed, vertexIndex, fixedRot);
|
|
161
158
|
}
|
|
162
159
|
detach(useDetachVelocity, collision) {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
});
|
|
160
|
+
var _a;
|
|
161
|
+
(_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.detach(useDetachVelocity, collision);
|
|
166
162
|
}
|
|
167
163
|
getSpeed() {
|
|
168
|
-
|
|
164
|
+
var _a, _b;
|
|
165
|
+
return (_b = (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.getSpeed()) !== null && _b !== void 0 ? _b : 0;
|
|
169
166
|
}
|
|
170
167
|
isPlayingAnim(dictionary, name, taskFlag) {
|
|
171
|
-
|
|
168
|
+
var _a, _b;
|
|
169
|
+
return (_b = (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.isPlayingAnim(dictionary, name, taskFlag)) !== null && _b !== void 0 ? _b : false;
|
|
172
170
|
}
|
|
173
171
|
// -- IPlayer --------------------------------------------------------------
|
|
174
172
|
get name() {
|
|
@@ -214,70 +212,83 @@ export class CCMPPlayer {
|
|
|
214
212
|
return 0;
|
|
215
213
|
}
|
|
216
214
|
getBoneIndex(boneId) {
|
|
217
|
-
|
|
215
|
+
var _a, _b;
|
|
216
|
+
return (_b = (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.getBoneIndex(boneId)) !== null && _b !== void 0 ? _b : -1;
|
|
218
217
|
}
|
|
219
|
-
setDecoration(
|
|
220
|
-
|
|
218
|
+
setDecoration(collection, overlay) {
|
|
219
|
+
var _a;
|
|
220
|
+
(_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.setDecoration(collection, overlay);
|
|
221
221
|
}
|
|
222
|
-
removeDecoration(
|
|
223
|
-
|
|
222
|
+
removeDecoration(collection, overlay) {
|
|
223
|
+
var _a;
|
|
224
|
+
(_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.removeDecoration(collection, overlay);
|
|
224
225
|
}
|
|
225
226
|
clearDecorations() {
|
|
226
|
-
|
|
227
|
+
var _a;
|
|
228
|
+
(_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.clearDecorations();
|
|
227
229
|
}
|
|
228
|
-
setHeadBlendData(
|
|
229
|
-
|
|
230
|
+
setHeadBlendData(shapeFirstId, shapeSecondId, shapeThirdId, skinFirstId, skinSecondId, skinThirdId, shapeMix, skinMix, thirdMix, isParent) {
|
|
231
|
+
var _a;
|
|
232
|
+
(_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.setHeadBlendData(shapeFirstId, shapeSecondId, shapeThirdId, skinFirstId, skinSecondId, skinThirdId, shapeMix, skinMix, thirdMix, isParent);
|
|
230
233
|
}
|
|
231
|
-
setFaceFeature(
|
|
232
|
-
|
|
234
|
+
setFaceFeature(index, value) {
|
|
235
|
+
var _a;
|
|
236
|
+
(_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.setFaceFeature(index, value);
|
|
233
237
|
}
|
|
234
|
-
setHeadOverlay(
|
|
235
|
-
|
|
238
|
+
setHeadOverlay(overlayId, index, opacity, _firstColor, _secondColor) {
|
|
239
|
+
var _a;
|
|
240
|
+
(_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.setHeadOverlay(overlayId, index, opacity);
|
|
236
241
|
}
|
|
237
|
-
setHeadOverlayColor(
|
|
238
|
-
|
|
242
|
+
setHeadOverlayColor(overlayId, colorTypeId, firstColor, secondColor) {
|
|
243
|
+
var _a;
|
|
244
|
+
(_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.setHeadOverlayColor(overlayId, colorTypeId, firstColor, secondColor);
|
|
239
245
|
}
|
|
240
|
-
setEyeColor(
|
|
241
|
-
|
|
246
|
+
setEyeColor(eyeColor) {
|
|
247
|
+
var _a;
|
|
248
|
+
(_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.setEyeColor(eyeColor);
|
|
242
249
|
}
|
|
243
|
-
setHairColor(
|
|
244
|
-
|
|
250
|
+
setHairColor(colorId, highlightColorId) {
|
|
251
|
+
var _a;
|
|
252
|
+
(_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.setHairColor(colorId, highlightColorId);
|
|
245
253
|
}
|
|
246
|
-
setComponentVariation(
|
|
247
|
-
|
|
254
|
+
setComponentVariation(componentId, drawableId, textureId, paletteId) {
|
|
255
|
+
var _a;
|
|
256
|
+
(_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.setComponentVariation(componentId, drawableId, textureId, paletteId);
|
|
248
257
|
}
|
|
249
|
-
setPropertyVariation(
|
|
250
|
-
|
|
258
|
+
setPropertyVariation(componentId, drawableId, textureId, attach) {
|
|
259
|
+
var _a;
|
|
260
|
+
(_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.setPropertyVariation(componentId, drawableId, textureId, attach);
|
|
251
261
|
}
|
|
252
|
-
clearProp(
|
|
253
|
-
|
|
262
|
+
clearProp(componentId) {
|
|
263
|
+
var _a;
|
|
264
|
+
(_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.clearProp(componentId);
|
|
254
265
|
}
|
|
255
266
|
get isLocalPlayer() {
|
|
256
267
|
return this._isLocal;
|
|
257
268
|
}
|
|
258
269
|
taskSwapWeapon() {
|
|
259
|
-
|
|
270
|
+
var _a;
|
|
271
|
+
(_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.taskSwapWeapon(true);
|
|
260
272
|
}
|
|
261
273
|
taskEnterVehicle(vehicleHandle, timeout, seat, speed, flag, _p6) {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
});
|
|
274
|
+
var _a;
|
|
275
|
+
(_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.taskEnterVehicle(vehicleHandle, timeout, seat, speed, flag);
|
|
265
276
|
}
|
|
266
277
|
clearTasks() {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
});
|
|
278
|
+
var _a;
|
|
279
|
+
(_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.clearTasks();
|
|
270
280
|
}
|
|
271
281
|
clearTasksImmediately() {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
});
|
|
282
|
+
var _a;
|
|
283
|
+
(_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.clearTasksImmediately();
|
|
275
284
|
}
|
|
276
|
-
taskPlayAnim(
|
|
277
|
-
|
|
285
|
+
taskPlayAnim(dictionary, name, blendInSpeed, blendOutSpeed, duration, flag, playbackRate, lockX, lockY, lockZ) {
|
|
286
|
+
var _a;
|
|
287
|
+
(_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.taskPlayAnim(dictionary, name, blendInSpeed, blendOutSpeed, duration, flag, playbackRate, lockX, lockY, lockZ);
|
|
278
288
|
}
|
|
279
|
-
stopAnim(
|
|
280
|
-
|
|
289
|
+
stopAnim(dictionary, name, blendOutSpeed) {
|
|
290
|
+
var _a;
|
|
291
|
+
(_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.stopAnim(dictionary, name, blendOutSpeed);
|
|
281
292
|
}
|
|
282
293
|
setMovementClipset(_clipset, _speed) {
|
|
283
294
|
this._warnOnce("setMovementClipset");
|
|
@@ -286,17 +297,13 @@ export class CCMPPlayer {
|
|
|
286
297
|
this._warnOnce("resetMovementClipset");
|
|
287
298
|
}
|
|
288
299
|
getBoneCoords(boneId, offsetX, offsetY, offsetZ) {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
});
|
|
300
|
+
var _a;
|
|
301
|
+
const position = (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.getBoneCoords(boneId, offsetX, offsetY, offsetZ);
|
|
302
|
+
return position ? new Vector3D(position.x, position.y, position.z) : ZERO_VECTOR;
|
|
293
303
|
}
|
|
294
304
|
setNoCollision(otherHandle, thisFrameOnly) {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
ccmp.natives.entity.setEntityNoCollisionEntity(handle, otherHandle, thisFrameOnly);
|
|
298
|
-
}
|
|
299
|
-
});
|
|
305
|
+
var _a;
|
|
306
|
+
(_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.setNoCollision(otherHandle, thisFrameOnly);
|
|
300
307
|
}
|
|
301
308
|
_getNativePlayer() {
|
|
302
309
|
try {
|
|
@@ -311,20 +318,6 @@ export class CCMPPlayer {
|
|
|
311
318
|
return null;
|
|
312
319
|
}
|
|
313
320
|
}
|
|
314
|
-
_withHandle(fallback, callback) {
|
|
315
|
-
const handle = this.handle;
|
|
316
|
-
if (!handle) {
|
|
317
|
-
return fallback;
|
|
318
|
-
}
|
|
319
|
-
return callback(handle);
|
|
320
|
-
}
|
|
321
|
-
_withHandleVoid(callback) {
|
|
322
|
-
const handle = this.handle;
|
|
323
|
-
if (!handle) {
|
|
324
|
-
return;
|
|
325
|
-
}
|
|
326
|
-
callback(handle);
|
|
327
|
-
}
|
|
328
321
|
_warnOnce(method) {
|
|
329
322
|
if (CCMPPlayer._warnedMethods.has(method)) {
|
|
330
323
|
return;
|