rock-mod 0.21.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/entities/ccmp/blip/CCMPBlip.d.ts +38 -0
- package/dist/client/entities/ccmp/blip/CCMPBlip.js +118 -0
- package/dist/client/entities/ccmp/blip/CCMPBlipsManager.d.ts +27 -0
- package/dist/client/entities/ccmp/blip/CCMPBlipsManager.js +191 -0
- package/dist/client/entities/ccmp/camera/CCMPCamera.d.ts +1 -1
- package/dist/client/entities/ccmp/camera/CCMPCamera.js +1 -1
- package/dist/client/entities/ccmp/camera/CCMPCameraManager.js +2 -1
- package/dist/client/entities/ccmp/colshape/CCMPColshape.d.ts +26 -0
- package/dist/client/entities/ccmp/colshape/CCMPColshape.js +83 -0
- package/dist/client/entities/ccmp/colshape/CCMPColshapesManager.d.ts +31 -0
- package/dist/client/entities/ccmp/colshape/CCMPColshapesManager.js +193 -0
- package/dist/client/entities/ccmp/marker/CCMPMarker.d.ts +34 -0
- package/dist/client/entities/ccmp/marker/CCMPMarker.js +109 -0
- package/dist/client/entities/ccmp/marker/CCMPMarkersManager.d.ts +27 -0
- package/dist/client/entities/ccmp/marker/CCMPMarkersManager.js +180 -0
- package/dist/client/entities/ccmp/object/CCMPObject.d.ts +53 -0
- package/dist/client/entities/ccmp/object/CCMPObject.js +218 -0
- package/dist/client/entities/ccmp/object/CCMPObjectsManager.d.ts +27 -0
- package/dist/client/entities/ccmp/object/CCMPObjectsManager.js +177 -0
- package/dist/client/entities/ccmp/ped/CCMPPed.d.ts +1 -1
- package/dist/client/entities/ccmp/ped/CCMPPed.js +21 -7
- package/dist/client/entities/ccmp/ped/CCMPPedsManager.d.ts +7 -0
- package/dist/client/entities/ccmp/ped/CCMPPedsManager.js +82 -10
- package/dist/client/entities/ccmp/player/CCMPPlayer.d.ts +1 -1
- package/dist/client/entities/ccmp/player/CCMPPlayer.js +10 -4
- package/dist/client/entities/ccmp/player/CCMPPlayersManager.d.ts +4 -3
- package/dist/client/entities/ccmp/player/CCMPPlayersManager.js +20 -7
- package/dist/client/entities/ccmp/vehicle/CCMPVehicle.d.ts +119 -0
- package/dist/client/entities/ccmp/vehicle/CCMPVehicle.js +392 -0
- package/dist/client/entities/ccmp/vehicle/CCMPVehiclesManager.d.ts +11 -48
- package/dist/client/entities/ccmp/vehicle/CCMPVehiclesManager.js +152 -74
- package/dist/client/entities/common/baseObject/IBaseObject.d.ts +2 -1
- package/dist/client/entities/ragemp/entity/RageEntity.d.ts +4 -0
- package/dist/client/entities/ragemp/entity/RageEntity.js +34 -2
- package/dist/client/factories/ccmp/CCMPManagersFactory.d.ts +9 -7
- package/dist/client/factories/ccmp/CCMPManagersFactory.js +62 -22
- package/dist/client/game/ccmp/storage/CCMPStorageManager.d.ts +0 -18
- package/dist/client/game/ccmp/storage/CCMPStorageManager.js +4 -36
- package/dist/client/net/ccmp/CCMPNetManager.js +1 -1
- package/dist/client/net/ccmp/dataHandler/CCMPDataHandler.d.ts +2 -2
- package/dist/client/net/ccmp/dataHandler/CCMPDataHandler.js +2 -2
- package/dist/client/net/ccmp/events/CCMPSyncedMetaBridge.d.ts +21 -16
- package/dist/client/net/ccmp/events/CCMPSyncedMetaBridge.js +32 -22
- package/dist/client/net/common/dataHandler/IDataHandler.d.ts +2 -2
- package/dist/client/net/common/events/types.d.ts +4 -4
- package/dist/client/net/ragemp/dataHandler/RageDataHandler.d.ts +2 -2
- package/dist/server/entities/ccmp/baseObject/CCMPBaseObjectsManager.js +4 -4
- package/dist/server/entities/ccmp/blip/CCMPBlip.d.ts +2 -0
- package/dist/server/entities/ccmp/blip/CCMPBlip.js +6 -0
- package/dist/server/entities/ccmp/colshape/CCMPColshape.d.ts +2 -0
- package/dist/server/entities/ccmp/colshape/CCMPColshape.js +6 -0
- package/dist/server/entities/ccmp/marker/CCMPMarker.d.ts +2 -0
- package/dist/server/entities/ccmp/marker/CCMPMarker.js +6 -0
- package/dist/server/entities/ccmp/object/CCMPObject.d.ts +1 -1
- package/dist/server/entities/ccmp/object/CCMPObject.js +3 -5
- package/dist/server/entities/ccmp/object/CCMPObjectsManager.js +1 -2
- package/dist/server/entities/ccmp/vehicle/CCMPVehicle.d.ts +2 -2
- package/dist/server/entities/ccmp/vehicle/CCMPVehicle.js +5 -5
- package/dist/server/entities/ragemp/entity/RageEntity.d.ts +5 -1
- package/dist/server/entities/ragemp/entity/RageEntity.js +17 -1
- package/dist/server/entities/ragemp/object/RageObjectsManager.js +1 -1
- package/dist/server/entities/ragemp/ped/RagePedsManager.js +1 -1
- package/dist/server/entities/ragemp/vehicle/RageVehiclesManager.js +1 -1
- package/package.json +2 -2
|
@@ -9,9 +9,10 @@ import { CCMPPlayer } from "./CCMPPlayer";
|
|
|
9
9
|
*
|
|
10
10
|
* ### Хранилище
|
|
11
11
|
*
|
|
12
|
-
* `Map<id, CCMPPlayer>`.
|
|
13
|
-
*
|
|
14
|
-
* `
|
|
12
|
+
* `Map<id, CCMPPlayer>`. For CCMP players only, `id` and `remoteId` still
|
|
13
|
+
* mean the same server/network id. Non-player CCMP wrappers have a separate
|
|
14
|
+
* client-local `id` and nullable server `remoteId`.
|
|
15
|
+
* `findByID`/`findByRemoteID`/`findByRemoteId` map to one lookup for players.
|
|
15
16
|
*
|
|
16
17
|
* ### Жизненный цикл local player'а
|
|
17
18
|
*
|
|
@@ -7,9 +7,10 @@ import { CCMPPlayer } from "./CCMPPlayer";
|
|
|
7
7
|
*
|
|
8
8
|
* ### Хранилище
|
|
9
9
|
*
|
|
10
|
-
* `Map<id, CCMPPlayer>`.
|
|
11
|
-
*
|
|
12
|
-
* `
|
|
10
|
+
* `Map<id, CCMPPlayer>`. For CCMP players only, `id` and `remoteId` still
|
|
11
|
+
* mean the same server/network id. Non-player CCMP wrappers have a separate
|
|
12
|
+
* client-local `id` and nullable server `remoteId`.
|
|
13
|
+
* `findByID`/`findByRemoteID`/`findByRemoteId` map to one lookup for players.
|
|
13
14
|
*
|
|
14
15
|
* ### Жизненный цикл local player'а
|
|
15
16
|
*
|
|
@@ -62,16 +63,28 @@ export class CCMPPlayersManager {
|
|
|
62
63
|
[ClientInternalEventName.PlayerReady]: (player) => {
|
|
63
64
|
// Если кто-то ещё эмитнул rm::playerReady (например, cooperation
|
|
64
65
|
// fallback в будущем) — синхронизируем своё состояние.
|
|
65
|
-
|
|
66
|
+
const remoteId = player.remoteId;
|
|
67
|
+
if (remoteId === null) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
this._ensurePlayer(remoteId, player.name, /* isLocal */ true);
|
|
66
71
|
},
|
|
67
72
|
[ClientInternalEventName.PlayerConnected]: (player) => {
|
|
68
|
-
|
|
73
|
+
const remoteId = player.remoteId;
|
|
74
|
+
if (remoteId === null) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
this._ensurePlayer(remoteId, player.name, /* isLocal */ false);
|
|
69
78
|
},
|
|
70
79
|
[ClientInternalEventName.PlayerDisconnected]: (player) => {
|
|
71
|
-
const
|
|
80
|
+
const remoteId = player.remoteId;
|
|
81
|
+
if (remoteId === null) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const existing = this._players.get(remoteId);
|
|
72
85
|
if (existing) {
|
|
73
86
|
existing.markRemoved();
|
|
74
|
-
this._players.delete(
|
|
87
|
+
this._players.delete(remoteId);
|
|
75
88
|
}
|
|
76
89
|
},
|
|
77
90
|
});
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { BaseObjectType } from "../../../../shared/entities";
|
|
2
|
+
import { type IRGB, type IVector3D, Vector3D } from "../../../../shared/common/utils";
|
|
3
|
+
import { type IBaseObject } from "../../common/baseObject/IBaseObject";
|
|
4
|
+
import { type ILightState, type IVehicle } from "../../common/vehicle/IVehicle";
|
|
5
|
+
export interface ICCMPNativeVehicle {
|
|
6
|
+
readonly id: number;
|
|
7
|
+
readonly remoteId: number | null;
|
|
8
|
+
readonly isRemote: boolean;
|
|
9
|
+
readonly handle: number;
|
|
10
|
+
readonly model: number;
|
|
11
|
+
readonly dimension: number;
|
|
12
|
+
readonly isAlive: boolean;
|
|
13
|
+
readonly isExists?: boolean;
|
|
14
|
+
readonly position: IVector3D;
|
|
15
|
+
readonly rotation: IVector3D;
|
|
16
|
+
readonly heading: number;
|
|
17
|
+
readonly numberPlateText: string;
|
|
18
|
+
readonly numberPlate: string;
|
|
19
|
+
destroy(): boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare class CCMPVehicle implements IVehicle {
|
|
22
|
+
private readonly _ccmpVehicle;
|
|
23
|
+
private readonly _onDestroy;
|
|
24
|
+
private _destroyed;
|
|
25
|
+
constructor(_ccmpVehicle: ICCMPNativeVehicle, _onDestroy?: (vehicle: CCMPVehicle) => void);
|
|
26
|
+
get id(): number;
|
|
27
|
+
get remoteId(): number | null;
|
|
28
|
+
get type(): BaseObjectType;
|
|
29
|
+
get isExists(): boolean;
|
|
30
|
+
get handle(): number;
|
|
31
|
+
destroy(): void;
|
|
32
|
+
get position(): Vector3D;
|
|
33
|
+
get dimension(): number;
|
|
34
|
+
setPosition(_value: IVector3D): void;
|
|
35
|
+
setDimension(_value: number): void;
|
|
36
|
+
setCoords(_xPos: number, _yPos: number, _zPos: number, _xAxis: boolean, _yAxis: boolean, _zAxis: boolean, _clearArea: boolean): void;
|
|
37
|
+
get model(): number;
|
|
38
|
+
get heading(): number;
|
|
39
|
+
setHeading(_heading: number): void;
|
|
40
|
+
setModel(_value: string): void;
|
|
41
|
+
get rotation(): Vector3D;
|
|
42
|
+
get forwardVector(): Vector3D;
|
|
43
|
+
setRotation(_value: IVector3D): void;
|
|
44
|
+
freezePosition(_freeze: boolean): void;
|
|
45
|
+
setCollision(_collision: boolean, _keepPhysics: boolean): void;
|
|
46
|
+
setInvincible(_invincible: boolean): void;
|
|
47
|
+
setVisible(_visible: boolean): void;
|
|
48
|
+
setAlpha(alpha: number): void;
|
|
49
|
+
get alpha(): number;
|
|
50
|
+
resetAlpha(): void;
|
|
51
|
+
getOffsetFromInWorldCoords(offsetX: number, offsetY: number, offsetZ: number): IVector3D;
|
|
52
|
+
getBoneIndexByName(boneName: string): number;
|
|
53
|
+
getWorldPositionOfBone(boneIndex: number): IVector3D;
|
|
54
|
+
getVariable(name: string): unknown | null;
|
|
55
|
+
getSyncedMeta(key: string): unknown | undefined;
|
|
56
|
+
hasSyncedMeta(key: string): boolean;
|
|
57
|
+
getSyncedMetaKeys(): readonly string[];
|
|
58
|
+
attachToEntity(_target: IBaseObject, _boneIndex: number, _offset: IVector3D, _rotation: IVector3D, _p9: boolean, _useSoftPinning: boolean, _collision: boolean, _isPed: boolean, _vertexIndex: number, _fixedRot: boolean): void;
|
|
59
|
+
detach(_useDetachVelocity: boolean, _collision: boolean): void;
|
|
60
|
+
getSpeed(): number;
|
|
61
|
+
isPlayingAnim(_dictionary: string, _name: string, _taskFlag: number): boolean;
|
|
62
|
+
get bodyHealth(): number;
|
|
63
|
+
get engineHealth(): number;
|
|
64
|
+
get numberPlate(): string;
|
|
65
|
+
get isDead(): boolean;
|
|
66
|
+
setBodyHealth(_value: number): void;
|
|
67
|
+
setEngineHealth(_value: number): void;
|
|
68
|
+
setNumberPlate(_value: string): void;
|
|
69
|
+
explode(): void;
|
|
70
|
+
getPedInSeat(seat: number): number;
|
|
71
|
+
setUndriveable(_toggle: boolean): void;
|
|
72
|
+
get maxNumberOfPassengers(): number;
|
|
73
|
+
get gear(): number;
|
|
74
|
+
get speed(): number;
|
|
75
|
+
get isEngineRunning(): boolean;
|
|
76
|
+
setEngineOn(_toggle: boolean, _instantly: boolean, _otherwise: boolean): void;
|
|
77
|
+
get lightsState(): ILightState;
|
|
78
|
+
get isLocked(): boolean;
|
|
79
|
+
setIsLocked(_value: boolean): void;
|
|
80
|
+
setCustomPrimaryColour(color: IRGB): void;
|
|
81
|
+
setCustomSecondaryColour(color: IRGB): void;
|
|
82
|
+
get customPrimaryColour(): IRGB;
|
|
83
|
+
get customSecondaryColour(): IRGB;
|
|
84
|
+
setMod(modType: number, modIndex: number): void;
|
|
85
|
+
getMod(modType: number): number;
|
|
86
|
+
getNumMods(modType: number): number;
|
|
87
|
+
setNeonLightEnabled(index: number, toggle: boolean): void;
|
|
88
|
+
setNeonLightsColour(color: IRGB): void;
|
|
89
|
+
setWindowTint(tintType: number): void;
|
|
90
|
+
get windowTint(): number;
|
|
91
|
+
setWheelType(wheelType: number): void;
|
|
92
|
+
get wheelType(): number;
|
|
93
|
+
setNumberPlateTextIndex(_index: number): void;
|
|
94
|
+
get numberPlateTextIndex(): number;
|
|
95
|
+
setDoorOpen(_doorIndex: number, _loose: boolean, _openInstantly: boolean): void;
|
|
96
|
+
setDoorShut(_doorIndex: number, _instantly: boolean): void;
|
|
97
|
+
setHandling(_field: string, _value: number): void;
|
|
98
|
+
getHandling(_field: string): number;
|
|
99
|
+
setEnginePowerMultiplier(_value: number): void;
|
|
100
|
+
setEngineTorqueMultiplier(_value: number): void;
|
|
101
|
+
modifyTopSpeed(_value: number): void;
|
|
102
|
+
setCheatPowerIncrease(_value: number): void;
|
|
103
|
+
toggleMod(modType: number, toggle: boolean): void;
|
|
104
|
+
setTyreSmokeColor(r: number, g: number, b: number): void;
|
|
105
|
+
setModColor1(paintType: number, color: number, p3: number): void;
|
|
106
|
+
setExtraColours(_pearlescentColor: number, _wheelColor: number): void;
|
|
107
|
+
setHeadlightColor(colorIndex: number): void;
|
|
108
|
+
setDashboardColor(colorIndex: number): void;
|
|
109
|
+
setInteriorColor(colorIndex: number): void;
|
|
110
|
+
getMaxBraking(): number;
|
|
111
|
+
getAcceleration(): number;
|
|
112
|
+
getMaxTraction(): number;
|
|
113
|
+
getModelMaxSpeed(): number;
|
|
114
|
+
private _withHandle;
|
|
115
|
+
private _withHandleVoid;
|
|
116
|
+
private _setModKit;
|
|
117
|
+
private _getRemoteVehicleExists;
|
|
118
|
+
private _getOffsetFromCachedTransform;
|
|
119
|
+
}
|
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
import { BaseObjectType } from "../../../../shared/entities";
|
|
3
|
+
import { Vector3D } from "../../../../shared/common/utils";
|
|
4
|
+
const notImplemented = (memberName) => {
|
|
5
|
+
throw new Error(`CCMPVehicle.${memberName}: not implemented`);
|
|
6
|
+
};
|
|
7
|
+
export class CCMPVehicle {
|
|
8
|
+
constructor(_ccmpVehicle, _onDestroy = () => { }) {
|
|
9
|
+
this._ccmpVehicle = _ccmpVehicle;
|
|
10
|
+
this._onDestroy = _onDestroy;
|
|
11
|
+
this._destroyed = false;
|
|
12
|
+
}
|
|
13
|
+
get id() {
|
|
14
|
+
return this._ccmpVehicle.id;
|
|
15
|
+
}
|
|
16
|
+
get remoteId() {
|
|
17
|
+
return this._ccmpVehicle.remoteId;
|
|
18
|
+
}
|
|
19
|
+
get type() {
|
|
20
|
+
return BaseObjectType.Vehicle;
|
|
21
|
+
}
|
|
22
|
+
get isExists() {
|
|
23
|
+
var _a;
|
|
24
|
+
if (this._destroyed)
|
|
25
|
+
return false;
|
|
26
|
+
if (this._ccmpVehicle.isRemote) {
|
|
27
|
+
return this._getRemoteVehicleExists();
|
|
28
|
+
}
|
|
29
|
+
return !this._destroyed && ((_a = this._ccmpVehicle.isExists) !== null && _a !== void 0 ? _a : this._ccmpVehicle.isAlive);
|
|
30
|
+
}
|
|
31
|
+
get handle() {
|
|
32
|
+
const handle = Number(this._ccmpVehicle.handle);
|
|
33
|
+
return Number.isFinite(handle) && handle > 0 ? Math.trunc(handle) : 0;
|
|
34
|
+
}
|
|
35
|
+
destroy() {
|
|
36
|
+
if (this._destroyed)
|
|
37
|
+
return;
|
|
38
|
+
this._destroyed = true;
|
|
39
|
+
this._ccmpVehicle.destroy();
|
|
40
|
+
this._onDestroy(this);
|
|
41
|
+
}
|
|
42
|
+
get position() {
|
|
43
|
+
const { x, y, z } = this._ccmpVehicle.position;
|
|
44
|
+
return new Vector3D(x, y, z);
|
|
45
|
+
}
|
|
46
|
+
get dimension() {
|
|
47
|
+
return this._ccmpVehicle.dimension;
|
|
48
|
+
}
|
|
49
|
+
setPosition(_value) {
|
|
50
|
+
notImplemented("setPosition");
|
|
51
|
+
}
|
|
52
|
+
setDimension(_value) {
|
|
53
|
+
notImplemented("setDimension");
|
|
54
|
+
}
|
|
55
|
+
setCoords(_xPos, _yPos, _zPos, _xAxis, _yAxis, _zAxis, _clearArea) {
|
|
56
|
+
notImplemented("setCoords");
|
|
57
|
+
}
|
|
58
|
+
get model() {
|
|
59
|
+
return this._ccmpVehicle.model;
|
|
60
|
+
}
|
|
61
|
+
get heading() {
|
|
62
|
+
return this._ccmpVehicle.heading;
|
|
63
|
+
}
|
|
64
|
+
setHeading(_heading) {
|
|
65
|
+
notImplemented("setHeading");
|
|
66
|
+
}
|
|
67
|
+
setModel(_value) {
|
|
68
|
+
notImplemented("setModel");
|
|
69
|
+
}
|
|
70
|
+
get rotation() {
|
|
71
|
+
const { x, y, z } = this._ccmpVehicle.rotation;
|
|
72
|
+
return new Vector3D(x, y, z);
|
|
73
|
+
}
|
|
74
|
+
get forwardVector() {
|
|
75
|
+
const headingRad = (this.heading * Math.PI) / 180;
|
|
76
|
+
return new Vector3D(-Math.sin(headingRad), Math.cos(headingRad), 0);
|
|
77
|
+
}
|
|
78
|
+
setRotation(_value) {
|
|
79
|
+
notImplemented("setRotation");
|
|
80
|
+
}
|
|
81
|
+
freezePosition(_freeze) {
|
|
82
|
+
notImplemented("freezePosition");
|
|
83
|
+
}
|
|
84
|
+
setCollision(_collision, _keepPhysics) {
|
|
85
|
+
notImplemented("setCollision");
|
|
86
|
+
}
|
|
87
|
+
setInvincible(_invincible) {
|
|
88
|
+
notImplemented("setInvincible");
|
|
89
|
+
}
|
|
90
|
+
setVisible(_visible) {
|
|
91
|
+
notImplemented("setVisible");
|
|
92
|
+
}
|
|
93
|
+
setAlpha(alpha) {
|
|
94
|
+
this._withHandleVoid((handle) => {
|
|
95
|
+
ccmp.natives.entity.setEntityAlpha(handle, alpha, false);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
get alpha() {
|
|
99
|
+
return this._withHandle(255, (handle) => ccmp.natives.entity.getEntityAlpha(handle));
|
|
100
|
+
}
|
|
101
|
+
resetAlpha() {
|
|
102
|
+
this._withHandleVoid((handle) => {
|
|
103
|
+
ccmp.natives.entity.resetEntityAlpha(handle);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
getOffsetFromInWorldCoords(offsetX, offsetY, offsetZ) {
|
|
107
|
+
return this._withHandle(this._getOffsetFromCachedTransform(offsetX, offsetY, offsetZ), (handle) => {
|
|
108
|
+
const { x, y, z } = ccmp.natives.entity.getOffsetFromEntityInWorldCoords(handle, offsetX, offsetY, offsetZ);
|
|
109
|
+
return new Vector3D(x, y, z);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
getBoneIndexByName(boneName) {
|
|
113
|
+
return this._withHandle(-1, (handle) => ccmp.natives.entity.getEntityBoneIndexByName(handle, boneName));
|
|
114
|
+
}
|
|
115
|
+
getWorldPositionOfBone(boneIndex) {
|
|
116
|
+
return this._withHandle(this.position, (handle) => {
|
|
117
|
+
const { x, y, z } = ccmp.natives.entity.getWorldPositionOfEntityBone(handle, boneIndex);
|
|
118
|
+
return new Vector3D(x, y, z);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
getVariable(name) {
|
|
122
|
+
const remoteId = this.remoteId;
|
|
123
|
+
if (remoteId === null) {
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
const value = ccmp.entities.getStreamSyncedMeta(ccmp.entities.ENTITY_TYPE.Vehicle, remoteId, name);
|
|
127
|
+
return value === undefined ? null : value;
|
|
128
|
+
}
|
|
129
|
+
getSyncedMeta(key) {
|
|
130
|
+
const remoteId = this.remoteId;
|
|
131
|
+
if (remoteId === null) {
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
134
|
+
return ccmp.entities.getStreamSyncedMeta(ccmp.entities.ENTITY_TYPE.Vehicle, remoteId, key);
|
|
135
|
+
}
|
|
136
|
+
hasSyncedMeta(key) {
|
|
137
|
+
const remoteId = this.remoteId;
|
|
138
|
+
if (remoteId === null) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
return ccmp.entities.hasStreamSyncedMeta(ccmp.entities.ENTITY_TYPE.Vehicle, remoteId, key);
|
|
142
|
+
}
|
|
143
|
+
getSyncedMetaKeys() {
|
|
144
|
+
const remoteId = this.remoteId;
|
|
145
|
+
if (remoteId === null) {
|
|
146
|
+
return [];
|
|
147
|
+
}
|
|
148
|
+
return ccmp.entities.getStreamSyncedMetaKeys(ccmp.entities.ENTITY_TYPE.Vehicle, remoteId);
|
|
149
|
+
}
|
|
150
|
+
attachToEntity(_target, _boneIndex, _offset, _rotation, _p9, _useSoftPinning, _collision, _isPed, _vertexIndex, _fixedRot) {
|
|
151
|
+
notImplemented("attachToEntity");
|
|
152
|
+
}
|
|
153
|
+
detach(_useDetachVelocity, _collision) {
|
|
154
|
+
notImplemented("detach");
|
|
155
|
+
}
|
|
156
|
+
getSpeed() {
|
|
157
|
+
return notImplemented("getSpeed");
|
|
158
|
+
}
|
|
159
|
+
isPlayingAnim(_dictionary, _name, _taskFlag) {
|
|
160
|
+
return notImplemented("isPlayingAnim");
|
|
161
|
+
}
|
|
162
|
+
get bodyHealth() {
|
|
163
|
+
return notImplemented("bodyHealth");
|
|
164
|
+
}
|
|
165
|
+
get engineHealth() {
|
|
166
|
+
return notImplemented("engineHealth");
|
|
167
|
+
}
|
|
168
|
+
get numberPlate() {
|
|
169
|
+
var _a;
|
|
170
|
+
return (_a = this._ccmpVehicle.numberPlate) !== null && _a !== void 0 ? _a : this._ccmpVehicle.numberPlateText;
|
|
171
|
+
}
|
|
172
|
+
get isDead() {
|
|
173
|
+
return !this.isExists;
|
|
174
|
+
}
|
|
175
|
+
setBodyHealth(_value) {
|
|
176
|
+
notImplemented("setBodyHealth");
|
|
177
|
+
}
|
|
178
|
+
setEngineHealth(_value) {
|
|
179
|
+
notImplemented("setEngineHealth");
|
|
180
|
+
}
|
|
181
|
+
setNumberPlate(_value) {
|
|
182
|
+
notImplemented("setNumberPlate");
|
|
183
|
+
}
|
|
184
|
+
explode() {
|
|
185
|
+
notImplemented("explode");
|
|
186
|
+
}
|
|
187
|
+
getPedInSeat(seat) {
|
|
188
|
+
return this._withHandle(0, (handle) => ccmp.natives.vehicle.getPedInVehicleSeat(handle, seat, false));
|
|
189
|
+
}
|
|
190
|
+
setUndriveable(_toggle) {
|
|
191
|
+
notImplemented("setUndriveable");
|
|
192
|
+
}
|
|
193
|
+
get maxNumberOfPassengers() {
|
|
194
|
+
return notImplemented("maxNumberOfPassengers");
|
|
195
|
+
}
|
|
196
|
+
get gear() {
|
|
197
|
+
return notImplemented("gear");
|
|
198
|
+
}
|
|
199
|
+
get speed() {
|
|
200
|
+
return notImplemented("speed");
|
|
201
|
+
}
|
|
202
|
+
get isEngineRunning() {
|
|
203
|
+
return notImplemented("isEngineRunning");
|
|
204
|
+
}
|
|
205
|
+
setEngineOn(_toggle, _instantly, _otherwise) {
|
|
206
|
+
notImplemented("setEngineOn");
|
|
207
|
+
}
|
|
208
|
+
get lightsState() {
|
|
209
|
+
return notImplemented("lightsState");
|
|
210
|
+
}
|
|
211
|
+
get isLocked() {
|
|
212
|
+
return notImplemented("isLocked");
|
|
213
|
+
}
|
|
214
|
+
setIsLocked(_value) {
|
|
215
|
+
notImplemented("setIsLocked");
|
|
216
|
+
}
|
|
217
|
+
setCustomPrimaryColour(color) {
|
|
218
|
+
this._withHandleVoid((handle) => {
|
|
219
|
+
ccmp.natives.vehicle.setVehicleCustomPrimaryColour(handle, color.r, color.g, color.b);
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
setCustomSecondaryColour(color) {
|
|
223
|
+
this._withHandleVoid((handle) => {
|
|
224
|
+
ccmp.natives.vehicle.setVehicleCustomSecondaryColour(handle, color.r, color.g, color.b);
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
get customPrimaryColour() {
|
|
228
|
+
return this._withHandle({ r: 0, g: 0, b: 0 }, (handle) => ccmp.natives.vehicle.getVehicleCustomPrimaryColour(handle));
|
|
229
|
+
}
|
|
230
|
+
get customSecondaryColour() {
|
|
231
|
+
return this._withHandle({ r: 0, g: 0, b: 0 }, (handle) => ccmp.natives.vehicle.getVehicleCustomSecondaryColour(handle));
|
|
232
|
+
}
|
|
233
|
+
setMod(modType, modIndex) {
|
|
234
|
+
this._withHandleVoid((handle) => {
|
|
235
|
+
this._setModKit(handle);
|
|
236
|
+
ccmp.natives.vehicle.setVehicleMod(handle, modType, modIndex, false);
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
getMod(modType) {
|
|
240
|
+
return this._withHandle(-1, (handle) => ccmp.natives.vehicle.getVehicleMod(handle, modType));
|
|
241
|
+
}
|
|
242
|
+
getNumMods(modType) {
|
|
243
|
+
return this._withHandle(0, (handle) => ccmp.natives.vehicle.getNumVehicleMods(handle, modType));
|
|
244
|
+
}
|
|
245
|
+
setNeonLightEnabled(index, toggle) {
|
|
246
|
+
this._withHandleVoid((handle) => {
|
|
247
|
+
ccmp.natives.vehicle.setVehicleNeonEnabled(handle, index, toggle);
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
setNeonLightsColour(color) {
|
|
251
|
+
this._withHandleVoid((handle) => {
|
|
252
|
+
ccmp.natives.vehicle.setVehicleNeonColour(handle, color.r, color.g, color.b);
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
setWindowTint(tintType) {
|
|
256
|
+
this._withHandleVoid((handle) => {
|
|
257
|
+
ccmp.natives.vehicle.setVehicleWindowTint(handle, tintType);
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
get windowTint() {
|
|
261
|
+
return this._withHandle(0, (handle) => ccmp.natives.vehicle.getVehicleWindowTint(handle));
|
|
262
|
+
}
|
|
263
|
+
setWheelType(wheelType) {
|
|
264
|
+
this._withHandleVoid((handle) => {
|
|
265
|
+
ccmp.natives.vehicle.setVehicleWheelType(handle, wheelType);
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
get wheelType() {
|
|
269
|
+
return this._withHandle(0, (handle) => ccmp.natives.vehicle.getVehicleWheelType(handle));
|
|
270
|
+
}
|
|
271
|
+
setNumberPlateTextIndex(_index) {
|
|
272
|
+
notImplemented("setNumberPlateTextIndex");
|
|
273
|
+
}
|
|
274
|
+
get numberPlateTextIndex() {
|
|
275
|
+
return notImplemented("numberPlateTextIndex");
|
|
276
|
+
}
|
|
277
|
+
setDoorOpen(_doorIndex, _loose, _openInstantly) {
|
|
278
|
+
notImplemented("setDoorOpen");
|
|
279
|
+
}
|
|
280
|
+
setDoorShut(_doorIndex, _instantly) {
|
|
281
|
+
notImplemented("setDoorShut");
|
|
282
|
+
}
|
|
283
|
+
setHandling(_field, _value) {
|
|
284
|
+
notImplemented("setHandling");
|
|
285
|
+
}
|
|
286
|
+
getHandling(_field) {
|
|
287
|
+
return notImplemented("getHandling");
|
|
288
|
+
}
|
|
289
|
+
setEnginePowerMultiplier(_value) {
|
|
290
|
+
notImplemented("setEnginePowerMultiplier");
|
|
291
|
+
}
|
|
292
|
+
setEngineTorqueMultiplier(_value) {
|
|
293
|
+
notImplemented("setEngineTorqueMultiplier");
|
|
294
|
+
}
|
|
295
|
+
modifyTopSpeed(_value) {
|
|
296
|
+
notImplemented("modifyTopSpeed");
|
|
297
|
+
}
|
|
298
|
+
setCheatPowerIncrease(_value) {
|
|
299
|
+
notImplemented("setCheatPowerIncrease");
|
|
300
|
+
}
|
|
301
|
+
toggleMod(modType, toggle) {
|
|
302
|
+
this._withHandleVoid((handle) => {
|
|
303
|
+
this._setModKit(handle);
|
|
304
|
+
ccmp.natives.vehicle.toggleVehicleMod(handle, modType, toggle);
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
setTyreSmokeColor(r, g, b) {
|
|
308
|
+
this._withHandleVoid((handle) => {
|
|
309
|
+
ccmp.natives.vehicle.setVehicleTyreSmokeColor(handle, r, g, b);
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
setModColor1(paintType, color, p3) {
|
|
313
|
+
this._withHandleVoid((handle) => {
|
|
314
|
+
ccmp.natives.vehicle.setVehicleModColor1(handle, paintType, color, p3);
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
setExtraColours(_pearlescentColor, _wheelColor) {
|
|
318
|
+
notImplemented("setExtraColours");
|
|
319
|
+
}
|
|
320
|
+
setHeadlightColor(colorIndex) {
|
|
321
|
+
this._withHandleVoid((handle) => {
|
|
322
|
+
ccmp.natives.vehicle.setVehicleXenonLightColorIndex(handle, colorIndex);
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
setDashboardColor(colorIndex) {
|
|
326
|
+
this._withHandleVoid((handle) => {
|
|
327
|
+
var _a;
|
|
328
|
+
const vehicleNatives = ccmp.natives.vehicle;
|
|
329
|
+
const setDashboardColor = (_a = vehicleNatives.setVehicleDashboardColor) !== null && _a !== void 0 ? _a : vehicleNatives.setVehicleDashboardColour;
|
|
330
|
+
if (!setDashboardColor)
|
|
331
|
+
return;
|
|
332
|
+
setDashboardColor(handle, colorIndex);
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
setInteriorColor(colorIndex) {
|
|
336
|
+
this._withHandleVoid((handle) => {
|
|
337
|
+
var _a;
|
|
338
|
+
const vehicleNatives = ccmp.natives.vehicle;
|
|
339
|
+
const setInteriorColor = (_a = vehicleNatives.setVehicleInteriorColor) !== null && _a !== void 0 ? _a : vehicleNatives.setVehicleInteriorColour;
|
|
340
|
+
if (!setInteriorColor)
|
|
341
|
+
return;
|
|
342
|
+
setInteriorColor(handle, colorIndex);
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
getMaxBraking() {
|
|
346
|
+
return notImplemented("getMaxBraking");
|
|
347
|
+
}
|
|
348
|
+
getAcceleration() {
|
|
349
|
+
return notImplemented("getAcceleration");
|
|
350
|
+
}
|
|
351
|
+
getMaxTraction() {
|
|
352
|
+
return notImplemented("getMaxTraction");
|
|
353
|
+
}
|
|
354
|
+
getModelMaxSpeed() {
|
|
355
|
+
return notImplemented("getModelMaxSpeed");
|
|
356
|
+
}
|
|
357
|
+
_withHandle(fallback, callback) {
|
|
358
|
+
const handle = this.handle;
|
|
359
|
+
if (!handle) {
|
|
360
|
+
return fallback;
|
|
361
|
+
}
|
|
362
|
+
return callback(handle);
|
|
363
|
+
}
|
|
364
|
+
_withHandleVoid(callback) {
|
|
365
|
+
const handle = this.handle;
|
|
366
|
+
if (!handle) {
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
callback(handle);
|
|
370
|
+
}
|
|
371
|
+
_setModKit(handle) {
|
|
372
|
+
ccmp.natives.vehicle.setVehicleModKit(handle, 0);
|
|
373
|
+
}
|
|
374
|
+
_getRemoteVehicleExists() {
|
|
375
|
+
var _a;
|
|
376
|
+
try {
|
|
377
|
+
return (_a = this._ccmpVehicle.isExists) !== null && _a !== void 0 ? _a : true;
|
|
378
|
+
}
|
|
379
|
+
catch (_b) {
|
|
380
|
+
return true;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
_getOffsetFromCachedTransform(offsetX, offsetY, offsetZ) {
|
|
384
|
+
const position = this.position;
|
|
385
|
+
const headingRad = (this.heading * Math.PI) / 180;
|
|
386
|
+
const rightX = Math.cos(headingRad);
|
|
387
|
+
const rightY = Math.sin(headingRad);
|
|
388
|
+
const forwardX = -Math.sin(headingRad);
|
|
389
|
+
const forwardY = Math.cos(headingRad);
|
|
390
|
+
return new Vector3D(position.x + rightX * offsetX + forwardX * offsetY, position.y + rightY * offsetX + forwardY * offsetY, position.z + offsetZ);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
@@ -1,54 +1,11 @@
|
|
|
1
1
|
import { type IVehicle } from "../../common/vehicle/IVehicle";
|
|
2
2
|
import { type IVehicleCreateOptions, type IVehiclesManager } from "../../common/vehicle/IVehiclesManager";
|
|
3
3
|
import { type IWorldObjectsIterator } from "../../common/worldObject/IWorldObjectsIterator";
|
|
4
|
-
/**
|
|
5
|
-
* Реализация `IVehiclesManager` под CCMP — **пустой пул** + native helper.
|
|
6
|
-
*
|
|
7
|
-
* ### Почему пусто
|
|
8
|
-
*
|
|
9
|
-
* RageMP даёт `mp.vehicles.toArray()`/`mp.vehicles.at(id)` — JS-side pool из
|
|
10
|
-
* stream'нутых-в-радиус транспортных средств, заполняемый рантаймом. CCMP
|
|
11
|
-
* такого пула на client-side не экспонирует:
|
|
12
|
-
* - `ccmp.natives.vehicle.createVehicle` создаёт локальный handle без id /
|
|
13
|
-
* replication / managed lifecycle.
|
|
14
|
-
* - `ccmp.vehicles.*` (server-side) спавнит реплицируемые vehicle-сущности,
|
|
15
|
-
* но клиент видит их данные через game state, а не как managed-IVehicle-
|
|
16
|
-
* инстансы в JS-pool'е.
|
|
17
|
-
*
|
|
18
|
-
* Поэтому iterator всегда пустой, `find*` возвращает null, `get*` и `deleteById` кидают.
|
|
19
|
-
*
|
|
20
|
-
* ### Hot path: `iterator.all()` на каждый render-tick
|
|
21
|
-
*
|
|
22
|
-
* Геймод-консьюмер `VehiclePartsInteractionController.syncVehicleProximity` →
|
|
23
|
-
* `VehiclePartsInteractionService.syncState` → `VehicleService.getNearbyVehicles`
|
|
24
|
-
* → `VehicleRepository.getNearby` → `VehicleRepository.getAll` → `iterator.all()`.
|
|
25
|
-
* До этой реализации `VehiclesManager` был `createNotImplementedProxy`, и каждый
|
|
26
|
-
* frame падал `CCMPVehiclesManager.iterator.all: not implemented yet`. Теперь
|
|
27
|
-
* iterator возвращает пустой итератор — interaction-сервис тихо деградирует
|
|
28
|
-
* (нет vehicles в радиусе → нет UI-хинтов / интеракций).
|
|
29
|
-
*
|
|
30
|
-
* ### `create(...)` под CCMP
|
|
31
|
-
*
|
|
32
|
-
* Не реализован осознанно: `VehicleRepository.create(...)` в геймоде ожидает
|
|
33
|
-
* `IRockModVehicle` с id/remoteId/position/etc, а CCMP-натив `createVehicle`
|
|
34
|
-
* возвращает только handle без id-mapping'а. Для корректной поддержки нужен
|
|
35
|
-
* полноценный `CCMPVehicle`-класс и интеграция с server-side `ccmp.vehicles.*`
|
|
36
|
-
* — отдельная задача. Сейчас бросаем понятную ошибку.
|
|
37
|
-
*
|
|
38
|
-
* ### `getDisplayNameFromVehicleModel`
|
|
39
|
-
*
|
|
40
|
-
* Этот метод **реализован** — натив `getDisplayNameFromVehicleModel`
|
|
41
|
-
* (`0xB215AAC32D25D019`) экспонирован в `ccmp.natives.vehicle.*` и работает
|
|
42
|
-
* без vehicle-pool'а (принимает только modelHash, возвращает GXT-ключ или
|
|
43
|
-
* "CARNOTFOUND" для unknown-моделей).
|
|
44
|
-
*
|
|
45
|
-
* TODO: когда понадобится spawning vehicles из клиента (миссии, тестовые
|
|
46
|
-
* объекты) — реализовать через `ccmp.natives.vehicle.createVehicle` + локальный
|
|
47
|
-
* id-counter + `CCMPVehicle`-обёртку. Для синхронизированных vehicles нужна
|
|
48
|
-
* server-side фабрика с `ccmp.vehicles.create` и net-events для распространения
|
|
49
|
-
* id-mapping'а.
|
|
50
|
-
*/
|
|
51
4
|
export declare class CCMPVehiclesManager implements IVehiclesManager {
|
|
5
|
+
private readonly _vehicles;
|
|
6
|
+
private readonly _vehiclesByRemoteId;
|
|
7
|
+
private readonly _iterator;
|
|
8
|
+
constructor();
|
|
52
9
|
create(options: IVehicleCreateOptions): IVehicle;
|
|
53
10
|
getDisplayNameFromVehicleModel(modelHash: number): string;
|
|
54
11
|
syncWithMpPool(): void;
|
|
@@ -60,5 +17,11 @@ export declare class CCMPVehiclesManager implements IVehiclesManager {
|
|
|
60
17
|
getByRemoteID(remoteId: number): IVehicle;
|
|
61
18
|
deleteById(id: number): IVehicle;
|
|
62
19
|
get iterator(): IWorldObjectsIterator<IVehicle>;
|
|
63
|
-
private
|
|
20
|
+
private _register;
|
|
21
|
+
private _unregister;
|
|
22
|
+
private _findRegistered;
|
|
23
|
+
private _registerLifecycleEvents;
|
|
24
|
+
private _filter;
|
|
25
|
+
private _pruneDestroyed;
|
|
26
|
+
private _getNativeVehiclesApi;
|
|
64
27
|
}
|