rock-mod 0.20.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/RockMod.d.ts +1 -1
- package/dist/client/RockMod.js +4 -0
- 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 +24 -0
- package/dist/client/entities/ccmp/camera/CCMPCamera.js +58 -0
- package/dist/client/entities/ccmp/camera/CCMPCameraManager.d.ts +16 -0
- package/dist/client/entities/ccmp/camera/CCMPCameraManager.js +51 -0
- 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 +65 -0
- package/dist/client/entities/ccmp/ped/CCMPPed.js +199 -0
- package/dist/client/entities/ccmp/ped/CCMPPedsManager.d.ts +27 -0
- package/dist/client/entities/ccmp/ped/CCMPPedsManager.js +177 -0
- package/dist/client/entities/ccmp/player/CCMPPlayer.d.ts +112 -0
- package/dist/client/entities/ccmp/player/CCMPPlayer.js +338 -0
- package/dist/client/entities/ccmp/player/CCMPPlayersManager.d.ts +85 -0
- package/dist/client/entities/ccmp/player/CCMPPlayersManager.js +331 -0
- 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 +27 -0
- package/dist/client/entities/ccmp/vehicle/CCMPVehiclesManager.js +183 -0
- package/dist/client/entities/common/baseObject/IBaseObject.d.ts +2 -1
- package/dist/client/entities/common/entity/IEntity.d.ts +3 -0
- package/dist/client/entities/ragemp/entity/RageEntity.d.ts +7 -0
- package/dist/client/entities/ragemp/entity/RageEntity.js +45 -2
- package/dist/client/factories/ccmp/CCMPManagersFactory.d.ts +48 -0
- package/dist/client/factories/ccmp/CCMPManagersFactory.js +189 -0
- package/dist/client/factories/ccmp/createNotImplementedProxy.d.ts +1 -0
- package/dist/client/factories/ccmp/createNotImplementedProxy.js +24 -0
- package/dist/client/game/ccmp/browser/CCMPBrowserManager.d.ts +22 -0
- package/dist/client/game/ccmp/browser/CCMPBrowserManager.js +66 -0
- package/dist/client/game/ccmp/chat/CCMPChatManager.d.ts +26 -0
- package/dist/client/game/ccmp/chat/CCMPChatManager.js +41 -0
- package/dist/client/game/ccmp/controls/CCMPControlsManager.d.ts +33 -0
- package/dist/client/game/ccmp/controls/CCMPControlsManager.js +47 -0
- package/dist/client/game/ccmp/cursor/CCMPCursorManager.d.ts +6 -0
- package/dist/client/game/ccmp/cursor/CCMPCursorManager.js +15 -0
- package/dist/client/game/ccmp/gameplay/CCMPGameplayManager.d.ts +6 -0
- package/dist/client/game/ccmp/gameplay/CCMPGameplayManager.js +10 -0
- package/dist/client/game/ccmp/graphics/CCMPGraphicsManager.d.ts +58 -0
- package/dist/client/game/ccmp/graphics/CCMPGraphicsManager.js +112 -0
- package/dist/client/game/ccmp/gui/CCMPGuiManager.d.ts +5 -0
- package/dist/client/game/ccmp/gui/CCMPGuiManager.js +17 -0
- package/dist/client/game/ccmp/keys/CCMPKeysManager.d.ts +41 -0
- package/dist/client/game/ccmp/keys/CCMPKeysManager.js +94 -0
- package/dist/client/game/ccmp/nametags/CCMPNametagsManager.d.ts +4 -0
- package/dist/client/game/ccmp/nametags/CCMPNametagsManager.js +6 -0
- package/dist/client/game/ccmp/native/CCMPNativeCallerManager.d.ts +74 -0
- package/dist/client/game/ccmp/native/CCMPNativeCallerManager.js +129 -0
- package/dist/client/game/ccmp/native/_generated/nativeDispatch.d.ts +5 -0
- package/dist/client/game/ccmp/native/_generated/nativeDispatch.js +8123 -0
- package/dist/client/game/ccmp/object/CCMPGameObjectManager.d.ts +4 -0
- package/dist/client/game/ccmp/object/CCMPGameObjectManager.js +6 -0
- package/dist/client/game/ccmp/pathfind/CCMPPathfindManager.d.ts +26 -0
- package/dist/client/game/ccmp/pathfind/CCMPPathfindManager.js +31 -0
- package/dist/client/game/ccmp/raycasting/CCMPRaycastingManager.d.ts +10 -0
- package/dist/client/game/ccmp/raycasting/CCMPRaycastingManager.js +46 -0
- package/dist/client/game/ccmp/storage/CCMPStorageManager.d.ts +7 -0
- package/dist/client/game/ccmp/storage/CCMPStorageManager.js +14 -0
- package/dist/client/game/ccmp/streaming/CCMPStreamingManager.d.ts +17 -0
- package/dist/client/game/ccmp/streaming/CCMPStreamingManager.js +41 -0
- package/dist/client/game/ccmp/ui/CCMPUiManager.d.ts +41 -0
- package/dist/client/game/ccmp/ui/CCMPUiManager.js +69 -0
- package/dist/client/game/ccmp/zone/CCMPZoneManager.d.ts +19 -0
- package/dist/client/game/ccmp/zone/CCMPZoneManager.js +20 -0
- package/dist/client/game/common/browser/IBrowserManager.d.ts +7 -0
- package/dist/client/game/common/chat/IChatManager.d.ts +1 -0
- package/dist/client/game/common/controls/IControlsManager.d.ts +3 -0
- package/dist/client/game/common/graphics/IGraphicsManager.d.ts +17 -0
- package/dist/client/game/common/streaming/IStreamingManager.d.ts +2 -0
- package/dist/client/game/ragemp/browser/RageBrowserManager.d.ts +2 -1
- package/dist/client/game/ragemp/browser/RageBrowserManager.js +30 -1
- package/dist/client/game/ragemp/chat/RageChatManager.d.ts +1 -0
- package/dist/client/game/ragemp/chat/RageChatManager.js +3 -0
- package/dist/client/game/ragemp/controls/RageControlsManager.d.ts +3 -0
- package/dist/client/game/ragemp/controls/RageControlsManager.js +9 -0
- package/dist/client/game/ragemp/graphics/RageGraphicsManager.d.ts +5 -1
- package/dist/client/game/ragemp/graphics/RageGraphicsManager.js +12 -0
- package/dist/client/game/ragemp/streaming/RageStreamingManager.d.ts +2 -0
- package/dist/client/game/ragemp/streaming/RageStreamingManager.js +6 -0
- package/dist/client/net/ccmp/CCMPConsoleForwarder.d.ts +11 -0
- package/dist/client/net/ccmp/CCMPConsoleForwarder.js +153 -0
- package/dist/client/net/ccmp/CCMPNetManager.d.ts +23 -0
- package/dist/client/net/ccmp/CCMPNetManager.js +55 -0
- package/dist/client/net/ccmp/dataHandler/CCMPDataHandler.d.ts +23 -0
- package/dist/client/net/ccmp/dataHandler/CCMPDataHandler.js +43 -0
- package/dist/client/net/ccmp/events/CCMPEventsBridge.d.ts +14 -0
- package/dist/client/net/ccmp/events/CCMPEventsBridge.js +19 -0
- package/dist/client/net/ccmp/events/CCMPEventsManager.d.ts +72 -0
- package/dist/client/net/ccmp/events/CCMPEventsManager.js +177 -0
- package/dist/client/net/ccmp/events/CCMPInProcessEmitter.d.ts +45 -0
- package/dist/client/net/ccmp/events/CCMPInProcessEmitter.js +133 -0
- package/dist/client/net/ccmp/events/CCMPRenderTicker.d.ts +18 -0
- package/dist/client/net/ccmp/events/CCMPRenderTicker.js +74 -0
- package/dist/client/net/ccmp/events/CCMPSyncedMetaBridge.d.ts +29 -0
- package/dist/client/net/ccmp/events/CCMPSyncedMetaBridge.js +45 -0
- package/dist/client/net/ccmp/rpc/CCMPRPCManager.d.ts +22 -0
- package/dist/client/net/ccmp/rpc/CCMPRPCManager.js +31 -0
- package/dist/client/net/common/dataHandler/IDataHandler.d.ts +2 -2
- package/dist/client/net/common/events/types.d.ts +6 -4
- package/dist/client/net/common/events/types.js +1 -0
- package/dist/client/net/ragemp/dataHandler/RageDataHandler.d.ts +2 -2
- package/dist/client/utils/ccmp/CCMPUtilsManager.d.ts +18 -0
- package/dist/client/utils/ccmp/CCMPUtilsManager.js +20 -0
- package/dist/server/RockMod.d.ts +1 -1
- package/dist/server/RockMod.js +4 -0
- package/dist/server/entities/ccmp/baseObject/CCMPBaseObject.d.ts +8 -0
- package/dist/server/entities/ccmp/baseObject/CCMPBaseObject.js +21 -0
- package/dist/server/entities/ccmp/baseObject/CCMPBaseObjectsIterator.d.ts +8 -0
- package/dist/server/entities/ccmp/baseObject/CCMPBaseObjectsIterator.js +16 -0
- package/dist/server/entities/ccmp/baseObject/CCMPBaseObjectsManager.d.ts +19 -0
- package/dist/server/entities/ccmp/baseObject/CCMPBaseObjectsManager.js +49 -0
- package/dist/server/entities/ccmp/blip/CCMPBlip.d.ts +36 -0
- package/dist/server/entities/ccmp/blip/CCMPBlip.js +86 -0
- package/dist/server/entities/ccmp/blip/CCMPBlipsManager.d.ts +9 -0
- package/dist/server/entities/ccmp/blip/CCMPBlipsManager.js +33 -0
- package/dist/server/entities/ccmp/colshape/CCMPCircleColshape.d.ts +7 -0
- package/dist/server/entities/ccmp/colshape/CCMPCircleColshape.js +10 -0
- package/dist/server/entities/ccmp/colshape/CCMPColshape.d.ts +25 -0
- package/dist/server/entities/ccmp/colshape/CCMPColshape.js +53 -0
- package/dist/server/entities/ccmp/colshape/CCMPColshapesManager.d.ts +28 -0
- package/dist/server/entities/ccmp/colshape/CCMPColshapesManager.js +108 -0
- package/dist/server/entities/ccmp/colshape/CCMPCuboidColshape.d.ts +7 -0
- package/dist/server/entities/ccmp/colshape/CCMPCuboidColshape.js +10 -0
- package/dist/server/entities/ccmp/colshape/CCMPCylinderColshape.d.ts +7 -0
- package/dist/server/entities/ccmp/colshape/CCMPCylinderColshape.js +10 -0
- package/dist/server/entities/ccmp/colshape/CCMPRectangleColshape.d.ts +7 -0
- package/dist/server/entities/ccmp/colshape/CCMPRectangleColshape.js +10 -0
- package/dist/server/entities/ccmp/colshape/CCMPSphereColshape.d.ts +7 -0
- package/dist/server/entities/ccmp/colshape/CCMPSphereColshape.js +10 -0
- package/dist/server/entities/ccmp/entity/CCMPEntitiesManager.d.ts +8 -0
- package/dist/server/entities/ccmp/entity/CCMPEntitiesManager.js +10 -0
- package/dist/server/entities/ccmp/entity/CCMPEntity.d.ts +13 -0
- package/dist/server/entities/ccmp/entity/CCMPEntity.js +28 -0
- package/dist/server/entities/ccmp/marker/CCMPMarker.d.ts +34 -0
- package/dist/server/entities/ccmp/marker/CCMPMarker.js +85 -0
- package/dist/server/entities/ccmp/marker/CCMPMarkersManager.d.ts +9 -0
- package/dist/server/entities/ccmp/marker/CCMPMarkersManager.js +30 -0
- package/dist/server/entities/ccmp/object/CCMPObject.d.ts +48 -0
- package/dist/server/entities/ccmp/object/CCMPObject.js +68 -0
- package/dist/server/entities/ccmp/object/CCMPObjectsManager.d.ts +9 -0
- package/dist/server/entities/ccmp/object/CCMPObjectsManager.js +27 -0
- package/dist/server/entities/ccmp/ped/CCMPPed.d.ts +33 -0
- package/dist/server/entities/ccmp/ped/CCMPPed.js +82 -0
- package/dist/server/entities/ccmp/ped/CCMPPedsManager.d.ts +9 -0
- package/dist/server/entities/ccmp/ped/CCMPPedsManager.js +28 -0
- package/dist/server/entities/ccmp/player/CCMPPlayer.d.ts +65 -0
- package/dist/server/entities/ccmp/player/CCMPPlayer.js +180 -0
- package/dist/server/entities/ccmp/player/CCMPPlayersManager.d.ts +12 -0
- package/dist/server/entities/ccmp/player/CCMPPlayersManager.js +66 -0
- package/dist/server/entities/ccmp/vehicle/CCMPVehicle.d.ts +58 -0
- package/dist/server/entities/ccmp/vehicle/CCMPVehicle.js +161 -0
- package/dist/server/entities/ccmp/vehicle/CCMPVehiclesManager.d.ts +9 -0
- package/dist/server/entities/ccmp/vehicle/CCMPVehiclesManager.js +31 -0
- package/dist/server/entities/ccmp/worldObject/CCMPWorldObject.d.ts +9 -0
- package/dist/server/entities/ccmp/worldObject/CCMPWorldObject.js +7 -0
- package/dist/server/entities/ccmp/worldObject/CCMPWorldObjectsIterator.d.ts +10 -0
- package/dist/server/entities/ccmp/worldObject/CCMPWorldObjectsIterator.js +40 -0
- package/dist/server/entities/ccmp/worldObject/CCMPWorldObjectsManager.d.ts +11 -0
- package/dist/server/entities/ccmp/worldObject/CCMPWorldObjectsManager.js +16 -0
- package/dist/server/entities/mock/player/MockPlayersManager.js +2 -1
- 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/dist/server/factories/ccmp/CCMPManagersFactory.d.ts +23 -0
- package/dist/server/factories/ccmp/CCMPManagersFactory.js +46 -0
- package/dist/server/net/ccmp/CCMPNetManager.d.ts +19 -0
- package/dist/server/net/ccmp/CCMPNetManager.js +112 -0
- package/dist/server/net/ccmp/events/CCMPEventsManager.d.ts +17 -0
- package/dist/server/net/ccmp/events/CCMPEventsManager.js +54 -0
- package/dist/server/net/ccmp/rpc/CCMPRPCManager.d.ts +8 -0
- package/dist/server/net/ccmp/rpc/CCMPRPCManager.js +18 -0
- package/dist/server/net/common/events/types.d.ts +2 -0
- package/dist/server/net/common/events/types.js +1 -0
- package/dist/server/utils/ccmp/CCMPUtilsManager.d.ts +4 -0
- package/dist/server/utils/ccmp/CCMPUtilsManager.js +9 -0
- package/dist/server/world/ccmp/CCMPWorldManager.d.ts +10 -0
- package/dist/server/world/ccmp/CCMPWorldManager.js +24 -0
- package/package.json +3 -1
package/dist/client/RockMod.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { type IUtilsManager } from "./utils";
|
|
|
4
4
|
import { type IManagersFactory } from "./factories/common/IManagersFactory";
|
|
5
5
|
import { type IGameManagers } from "./game";
|
|
6
6
|
import { type IConsoleManager } from "./console";
|
|
7
|
-
type MultiplayerType = "RageMP" | "AltV" | "Mock";
|
|
7
|
+
type MultiplayerType = "RageMP" | "AltV" | "Mock" | "CCMP";
|
|
8
8
|
export interface RockModOptions {
|
|
9
9
|
multiplayer: MultiplayerType;
|
|
10
10
|
}
|
package/dist/client/RockMod.js
CHANGED
|
@@ -20,6 +20,10 @@ export class RockMod {
|
|
|
20
20
|
const { RageManagersFactory } = await import("./factories/ragemp/RageManagersFactory");
|
|
21
21
|
return new RageManagersFactory();
|
|
22
22
|
}
|
|
23
|
+
case "CCMP": {
|
|
24
|
+
const { CCMPManagersFactory } = await import("./factories/ccmp/CCMPManagersFactory");
|
|
25
|
+
return new CCMPManagersFactory();
|
|
26
|
+
}
|
|
23
27
|
case "AltV":
|
|
24
28
|
case "Mock": {
|
|
25
29
|
throw new Error("This multiplayer type is not implemented yet on client side");
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type Blip as CcmpBlip } from "@classic-mp/types/client";
|
|
2
|
+
import { BaseObjectType, type IBlipColor, type IBlipSprite } from "../../../../shared/entities";
|
|
3
|
+
import { type IVector3D, Vector3D } from "../../../../shared/common/utils";
|
|
4
|
+
import { type IBlip } from "../../common/blip/IBlip";
|
|
5
|
+
export declare class CCMPBlip implements IBlip {
|
|
6
|
+
private readonly _ccmpBlip;
|
|
7
|
+
private readonly _onDestroy;
|
|
8
|
+
private _destroyed;
|
|
9
|
+
constructor(_ccmpBlip: CcmpBlip, _onDestroy?: (blip: CCMPBlip) => void);
|
|
10
|
+
get id(): number;
|
|
11
|
+
get remoteId(): number | null;
|
|
12
|
+
get type(): BaseObjectType;
|
|
13
|
+
get isExists(): boolean;
|
|
14
|
+
get handle(): number;
|
|
15
|
+
destroy(): void;
|
|
16
|
+
get position(): Vector3D;
|
|
17
|
+
get dimension(): number;
|
|
18
|
+
setPosition(_value: IVector3D): void;
|
|
19
|
+
setDimension(_value: number): void;
|
|
20
|
+
setCoords(_xPos: number, _yPos: number, _zPos: number, _xAxis: boolean, _yAxis: boolean, _zAxis: boolean, _clearArea: boolean): void;
|
|
21
|
+
get name(): string;
|
|
22
|
+
get sprite(): IBlipSprite;
|
|
23
|
+
get color(): number;
|
|
24
|
+
get alpha(): number;
|
|
25
|
+
get scale(): number;
|
|
26
|
+
get drawDistance(): number;
|
|
27
|
+
get shortRange(): boolean;
|
|
28
|
+
get rotation(): number;
|
|
29
|
+
getVariable(name: string): unknown | null;
|
|
30
|
+
getSyncedMeta(key: string): unknown | undefined;
|
|
31
|
+
hasSyncedMeta(key: string): boolean;
|
|
32
|
+
getSyncedMetaKeys(): readonly string[];
|
|
33
|
+
setSprite(_value: IBlipSprite): void;
|
|
34
|
+
setColor(_value: IBlipColor): void;
|
|
35
|
+
setAlpha(_value: number): void;
|
|
36
|
+
setShowHeadingIndicator(_value: boolean): void;
|
|
37
|
+
setRotation(_value: number): void;
|
|
38
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { BaseObjectType } from "../../../../shared/entities";
|
|
2
|
+
import { Vector3D } from "../../../../shared/common/utils";
|
|
3
|
+
const notImplemented = (memberName) => {
|
|
4
|
+
throw new Error(`CCMPBlip.${memberName}: not implemented`);
|
|
5
|
+
};
|
|
6
|
+
export class CCMPBlip {
|
|
7
|
+
constructor(_ccmpBlip, _onDestroy = () => { }) {
|
|
8
|
+
this._ccmpBlip = _ccmpBlip;
|
|
9
|
+
this._onDestroy = _onDestroy;
|
|
10
|
+
this._destroyed = false;
|
|
11
|
+
}
|
|
12
|
+
get id() {
|
|
13
|
+
return this._ccmpBlip.id;
|
|
14
|
+
}
|
|
15
|
+
get remoteId() {
|
|
16
|
+
return this._ccmpBlip.remoteId;
|
|
17
|
+
}
|
|
18
|
+
get type() {
|
|
19
|
+
return BaseObjectType.Blip;
|
|
20
|
+
}
|
|
21
|
+
get isExists() {
|
|
22
|
+
return !this._destroyed && this._ccmpBlip.isExists;
|
|
23
|
+
}
|
|
24
|
+
get handle() {
|
|
25
|
+
return this._ccmpBlip.handle;
|
|
26
|
+
}
|
|
27
|
+
destroy() {
|
|
28
|
+
if (this._destroyed)
|
|
29
|
+
return;
|
|
30
|
+
this._destroyed = true;
|
|
31
|
+
this._ccmpBlip.destroy();
|
|
32
|
+
this._onDestroy(this);
|
|
33
|
+
}
|
|
34
|
+
get position() {
|
|
35
|
+
const { x, y, z } = this._ccmpBlip.position;
|
|
36
|
+
return new Vector3D(x, y, z);
|
|
37
|
+
}
|
|
38
|
+
get dimension() {
|
|
39
|
+
return this._ccmpBlip.dimension;
|
|
40
|
+
}
|
|
41
|
+
setPosition(_value) {
|
|
42
|
+
notImplemented("setPosition");
|
|
43
|
+
}
|
|
44
|
+
setDimension(_value) {
|
|
45
|
+
notImplemented("setDimension");
|
|
46
|
+
}
|
|
47
|
+
setCoords(_xPos, _yPos, _zPos, _xAxis, _yAxis, _zAxis, _clearArea) {
|
|
48
|
+
notImplemented("setCoords");
|
|
49
|
+
}
|
|
50
|
+
get name() {
|
|
51
|
+
return this._ccmpBlip.name;
|
|
52
|
+
}
|
|
53
|
+
get sprite() {
|
|
54
|
+
return this._ccmpBlip.sprite;
|
|
55
|
+
}
|
|
56
|
+
get color() {
|
|
57
|
+
return this._ccmpBlip.color;
|
|
58
|
+
}
|
|
59
|
+
get alpha() {
|
|
60
|
+
return this._ccmpBlip.alpha;
|
|
61
|
+
}
|
|
62
|
+
get scale() {
|
|
63
|
+
return this._ccmpBlip.scale;
|
|
64
|
+
}
|
|
65
|
+
get drawDistance() {
|
|
66
|
+
return this._ccmpBlip.drawDistance;
|
|
67
|
+
}
|
|
68
|
+
get shortRange() {
|
|
69
|
+
return this._ccmpBlip.shortRange;
|
|
70
|
+
}
|
|
71
|
+
get rotation() {
|
|
72
|
+
return this._ccmpBlip.rotation;
|
|
73
|
+
}
|
|
74
|
+
getVariable(name) {
|
|
75
|
+
const remoteId = this.remoteId;
|
|
76
|
+
if (remoteId === null) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
const value = ccmp.entities.getStreamSyncedMeta(ccmp.entities.ENTITY_TYPE.Blip, remoteId, name);
|
|
80
|
+
return value === undefined ? null : value;
|
|
81
|
+
}
|
|
82
|
+
getSyncedMeta(key) {
|
|
83
|
+
const remoteId = this.remoteId;
|
|
84
|
+
if (remoteId === null) {
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
return ccmp.entities.getStreamSyncedMeta(ccmp.entities.ENTITY_TYPE.Blip, remoteId, key);
|
|
88
|
+
}
|
|
89
|
+
hasSyncedMeta(key) {
|
|
90
|
+
const remoteId = this.remoteId;
|
|
91
|
+
if (remoteId === null) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
return ccmp.entities.hasStreamSyncedMeta(ccmp.entities.ENTITY_TYPE.Blip, remoteId, key);
|
|
95
|
+
}
|
|
96
|
+
getSyncedMetaKeys() {
|
|
97
|
+
const remoteId = this.remoteId;
|
|
98
|
+
if (remoteId === null) {
|
|
99
|
+
return [];
|
|
100
|
+
}
|
|
101
|
+
return ccmp.entities.getStreamSyncedMetaKeys(ccmp.entities.ENTITY_TYPE.Blip, remoteId);
|
|
102
|
+
}
|
|
103
|
+
setSprite(_value) {
|
|
104
|
+
notImplemented("setSprite");
|
|
105
|
+
}
|
|
106
|
+
setColor(_value) {
|
|
107
|
+
notImplemented("setColor");
|
|
108
|
+
}
|
|
109
|
+
setAlpha(_value) {
|
|
110
|
+
notImplemented("setAlpha");
|
|
111
|
+
}
|
|
112
|
+
setShowHeadingIndicator(_value) {
|
|
113
|
+
notImplemented("setShowHeadingIndicator");
|
|
114
|
+
}
|
|
115
|
+
setRotation(_value) {
|
|
116
|
+
notImplemented("setRotation");
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type CCMPEventsManager } from "../../../net/ccmp/events/CCMPEventsManager";
|
|
2
|
+
import { type IBlipCreateOptions, type IBlipsManager } from "../../common/blip/IBlipsManager";
|
|
3
|
+
import { type IWorldObjectsIterator } from "../../common/worldObject/IWorldObjectsIterator";
|
|
4
|
+
import { CCMPBlip } from "./CCMPBlip";
|
|
5
|
+
export declare class CCMPBlipsManager implements IBlipsManager {
|
|
6
|
+
private readonly _events;
|
|
7
|
+
private readonly _blips;
|
|
8
|
+
private readonly _blipsByRemoteId;
|
|
9
|
+
private readonly _iterator;
|
|
10
|
+
constructor(_events: CCMPEventsManager);
|
|
11
|
+
create(options: IBlipCreateOptions): CCMPBlip;
|
|
12
|
+
syncWithMpPool(): void;
|
|
13
|
+
registerById(id: number): CCMPBlip;
|
|
14
|
+
unregisterById(id: number): CCMPBlip;
|
|
15
|
+
findByID(id: number): CCMPBlip | null;
|
|
16
|
+
getByID(id: number): CCMPBlip;
|
|
17
|
+
findByRemoteID(remoteId: number): CCMPBlip | null;
|
|
18
|
+
getByRemoteID(remoteId: number): CCMPBlip;
|
|
19
|
+
deleteById(id: number): CCMPBlip;
|
|
20
|
+
get iterator(): IWorldObjectsIterator<CCMPBlip>;
|
|
21
|
+
private _register;
|
|
22
|
+
private _unregister;
|
|
23
|
+
private _findRegistered;
|
|
24
|
+
private _registerLifecycleEvents;
|
|
25
|
+
private _filter;
|
|
26
|
+
private _pruneDestroyed;
|
|
27
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { ClientInternalEventName } from "../../../net/common/events/types";
|
|
2
|
+
import { CCMPBlip } from "./CCMPBlip";
|
|
3
|
+
export class CCMPBlipsManager {
|
|
4
|
+
constructor(_events) {
|
|
5
|
+
this._events = _events;
|
|
6
|
+
this._blips = new Map();
|
|
7
|
+
this._blipsByRemoteId = new Map();
|
|
8
|
+
this._iterator = {
|
|
9
|
+
all: () => this._filter(() => true),
|
|
10
|
+
dimension: (value) => this._filter((blip) => blip.dimension === value),
|
|
11
|
+
range2D: (center, range) => this._filter((blip) => {
|
|
12
|
+
const position = blip.position;
|
|
13
|
+
const squaredDistance = (position.x - center.x) ** 2 + (position.y - center.y) ** 2;
|
|
14
|
+
return squaredDistance <= range * range;
|
|
15
|
+
}),
|
|
16
|
+
range3D: (center, range) => this._filter((blip) => blip.position.isInRange(center, range)),
|
|
17
|
+
};
|
|
18
|
+
this._registerLifecycleEvents();
|
|
19
|
+
this.syncWithMpPool();
|
|
20
|
+
}
|
|
21
|
+
create(options) {
|
|
22
|
+
const createOptions = {
|
|
23
|
+
dimension: options.dimension,
|
|
24
|
+
};
|
|
25
|
+
if (options.alpha !== undefined)
|
|
26
|
+
createOptions.alpha = options.alpha;
|
|
27
|
+
if (options.color !== undefined)
|
|
28
|
+
createOptions.color = options.color;
|
|
29
|
+
if (options.drawDistance !== undefined)
|
|
30
|
+
createOptions.drawDistance = options.drawDistance;
|
|
31
|
+
if (options.name !== undefined)
|
|
32
|
+
createOptions.name = options.name;
|
|
33
|
+
if (options.rotation !== undefined)
|
|
34
|
+
createOptions.rotation = options.rotation;
|
|
35
|
+
if (options.scale !== undefined)
|
|
36
|
+
createOptions.scale = options.scale;
|
|
37
|
+
if (options.shortRange !== undefined)
|
|
38
|
+
createOptions.shortRange = options.shortRange;
|
|
39
|
+
const ccmpBlip = ccmp.blips.create(options.sprite, options.position, createOptions);
|
|
40
|
+
if (!ccmpBlip) {
|
|
41
|
+
throw new Error(`CCMPBlipsManager.create: ccmp.blips.create failed for sprite "${options.sprite}"`);
|
|
42
|
+
}
|
|
43
|
+
return this._register(ccmpBlip);
|
|
44
|
+
}
|
|
45
|
+
syncWithMpPool() {
|
|
46
|
+
this._pruneDestroyed();
|
|
47
|
+
for (const ccmpBlip of ccmp.blips.all) {
|
|
48
|
+
this._register(ccmpBlip);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
registerById(id) {
|
|
52
|
+
const existingBlip = this.findByID(id);
|
|
53
|
+
if (existingBlip) {
|
|
54
|
+
return existingBlip;
|
|
55
|
+
}
|
|
56
|
+
const ccmpBlip = ccmp.blips.getById(id);
|
|
57
|
+
if (!ccmpBlip) {
|
|
58
|
+
throw new Error(`CCMPBlipsManager.registerById(${id}): blip not found.`);
|
|
59
|
+
}
|
|
60
|
+
return this._register(ccmpBlip);
|
|
61
|
+
}
|
|
62
|
+
unregisterById(id) {
|
|
63
|
+
return this.deleteById(id);
|
|
64
|
+
}
|
|
65
|
+
findByID(id) {
|
|
66
|
+
var _a;
|
|
67
|
+
const blip = (_a = this._blips.get(id)) !== null && _a !== void 0 ? _a : null;
|
|
68
|
+
if (blip && !blip.isExists) {
|
|
69
|
+
this._unregister(blip);
|
|
70
|
+
}
|
|
71
|
+
else if (blip) {
|
|
72
|
+
return blip;
|
|
73
|
+
}
|
|
74
|
+
const ccmpBlip = ccmp.blips.getById(id);
|
|
75
|
+
if (!ccmpBlip) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
return this._register(ccmpBlip);
|
|
79
|
+
}
|
|
80
|
+
getByID(id) {
|
|
81
|
+
const blip = this.findByID(id);
|
|
82
|
+
if (!blip) {
|
|
83
|
+
throw new Error(`CCMPBlipsManager.getByID(${id}): blip not found.`);
|
|
84
|
+
}
|
|
85
|
+
return blip;
|
|
86
|
+
}
|
|
87
|
+
findByRemoteID(remoteId) {
|
|
88
|
+
var _a;
|
|
89
|
+
const blip = (_a = this._blipsByRemoteId.get(remoteId)) !== null && _a !== void 0 ? _a : null;
|
|
90
|
+
if (blip && !blip.isExists) {
|
|
91
|
+
this._unregister(blip);
|
|
92
|
+
}
|
|
93
|
+
else if (blip) {
|
|
94
|
+
return blip;
|
|
95
|
+
}
|
|
96
|
+
const ccmpBlip = ccmp.blips.getByRemoteId(remoteId);
|
|
97
|
+
if (!ccmpBlip) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
return this._register(ccmpBlip);
|
|
101
|
+
}
|
|
102
|
+
getByRemoteID(remoteId) {
|
|
103
|
+
const blip = this.findByRemoteID(remoteId);
|
|
104
|
+
if (!blip) {
|
|
105
|
+
throw new Error(`CCMPBlipsManager.getByRemoteID(${remoteId}): blip not found.`);
|
|
106
|
+
}
|
|
107
|
+
return blip;
|
|
108
|
+
}
|
|
109
|
+
deleteById(id) {
|
|
110
|
+
const blip = this.getByID(id);
|
|
111
|
+
blip.destroy();
|
|
112
|
+
return blip;
|
|
113
|
+
}
|
|
114
|
+
get iterator() {
|
|
115
|
+
return this._iterator;
|
|
116
|
+
}
|
|
117
|
+
_register(ccmpBlip) {
|
|
118
|
+
const existingBlip = this._findRegistered(ccmpBlip);
|
|
119
|
+
if (existingBlip && existingBlip.isExists) {
|
|
120
|
+
return existingBlip;
|
|
121
|
+
}
|
|
122
|
+
if (existingBlip) {
|
|
123
|
+
this._unregister(existingBlip);
|
|
124
|
+
}
|
|
125
|
+
const blip = new CCMPBlip(ccmpBlip, (destroyedBlip) => {
|
|
126
|
+
this._unregister(destroyedBlip);
|
|
127
|
+
});
|
|
128
|
+
this._blips.set(blip.id, blip);
|
|
129
|
+
if (blip.remoteId !== null) {
|
|
130
|
+
this._blipsByRemoteId.set(blip.remoteId, blip);
|
|
131
|
+
}
|
|
132
|
+
return blip;
|
|
133
|
+
}
|
|
134
|
+
_unregister(blip) {
|
|
135
|
+
this._blips.delete(blip.id);
|
|
136
|
+
if (blip.remoteId !== null) {
|
|
137
|
+
this._blipsByRemoteId.delete(blip.remoteId);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
_findRegistered(ccmpBlip) {
|
|
141
|
+
var _a, _b, _c;
|
|
142
|
+
return ((_c = (_b = (ccmpBlip.remoteId === null ? null : ((_a = this._blipsByRemoteId.get(ccmpBlip.remoteId)) !== null && _a !== void 0 ? _a : null))) !== null && _b !== void 0 ? _b : this._blips.get(ccmpBlip.id)) !== null && _c !== void 0 ? _c : null);
|
|
143
|
+
}
|
|
144
|
+
_registerLifecycleEvents() {
|
|
145
|
+
ccmp.on("blipCreated", (ccmpBlip) => {
|
|
146
|
+
if (!ccmpBlip)
|
|
147
|
+
return;
|
|
148
|
+
const blip = this._register(ccmpBlip);
|
|
149
|
+
this._events.emitInternal(ClientInternalEventName.EntityCreated, blip);
|
|
150
|
+
});
|
|
151
|
+
ccmp.on("blipDestroyed", (ccmpBlip) => {
|
|
152
|
+
var _a;
|
|
153
|
+
if (!ccmpBlip)
|
|
154
|
+
return;
|
|
155
|
+
const blip = (_a = this._findRegistered(ccmpBlip)) !== null && _a !== void 0 ? _a : this._register(ccmpBlip);
|
|
156
|
+
this._events.emitInternal(ClientInternalEventName.EntityDestroyed, blip);
|
|
157
|
+
this._unregister(blip);
|
|
158
|
+
});
|
|
159
|
+
ccmp.on("blipStreamIn", (ccmpBlip) => {
|
|
160
|
+
if (!ccmpBlip)
|
|
161
|
+
return;
|
|
162
|
+
const blip = this._register(ccmpBlip);
|
|
163
|
+
this._events.emitInternal(ClientInternalEventName.EntityStreamIn, blip);
|
|
164
|
+
});
|
|
165
|
+
ccmp.on("blipStreamOut", (ccmpBlip) => {
|
|
166
|
+
var _a;
|
|
167
|
+
if (!ccmpBlip)
|
|
168
|
+
return;
|
|
169
|
+
const blip = (_a = this._findRegistered(ccmpBlip)) !== null && _a !== void 0 ? _a : this._register(ccmpBlip);
|
|
170
|
+
this._events.emitInternal(ClientInternalEventName.EntityStreamOut, blip);
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
*_filter(predicate) {
|
|
174
|
+
for (const blip of this._blips.values()) {
|
|
175
|
+
if (!blip.isExists) {
|
|
176
|
+
this._unregister(blip);
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
if (predicate(blip)) {
|
|
180
|
+
yield blip;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
_pruneDestroyed() {
|
|
185
|
+
for (const blip of this._blips.values()) {
|
|
186
|
+
if (!blip.isExists) {
|
|
187
|
+
this._unregister(blip);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BaseObjectType } from "../../../../shared/entities";
|
|
2
|
+
import { type Camera as CcmpCamera } from "@classic-mp/types/client";
|
|
3
|
+
import { type ICamera } from "../../common/camera/ICamera";
|
|
4
|
+
import { type IVector3D, Vector3D } from "../../../../shared/common/utils";
|
|
5
|
+
export declare class CCMPCamera implements ICamera {
|
|
6
|
+
private readonly _camera;
|
|
7
|
+
constructor(_camera: CcmpCamera);
|
|
8
|
+
get id(): number;
|
|
9
|
+
get remoteId(): number | null;
|
|
10
|
+
get type(): BaseObjectType;
|
|
11
|
+
get isExists(): boolean;
|
|
12
|
+
get handle(): number;
|
|
13
|
+
destroy(): void;
|
|
14
|
+
get isActive(): boolean;
|
|
15
|
+
setIsActive(value: boolean): void;
|
|
16
|
+
get direction(): IVector3D;
|
|
17
|
+
get fov(): number;
|
|
18
|
+
setFov(value: number): void;
|
|
19
|
+
pointAtCoord(value: IVector3D): void;
|
|
20
|
+
setPosition(value: Vector3D): void;
|
|
21
|
+
get position(): Vector3D;
|
|
22
|
+
get rotation(): IVector3D;
|
|
23
|
+
setRotation(value: IVector3D): void;
|
|
24
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { BaseObjectType } from "../../../../shared/entities";
|
|
2
|
+
import { Vector3D } from "../../../../shared/common/utils";
|
|
3
|
+
export class CCMPCamera {
|
|
4
|
+
constructor(_camera) {
|
|
5
|
+
this._camera = _camera;
|
|
6
|
+
}
|
|
7
|
+
get id() {
|
|
8
|
+
return this._camera.id;
|
|
9
|
+
}
|
|
10
|
+
get remoteId() {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
get type() {
|
|
14
|
+
return BaseObjectType.Camera;
|
|
15
|
+
}
|
|
16
|
+
get isExists() {
|
|
17
|
+
return this._camera.isAlive;
|
|
18
|
+
}
|
|
19
|
+
get handle() {
|
|
20
|
+
return this._camera.handle;
|
|
21
|
+
}
|
|
22
|
+
destroy() {
|
|
23
|
+
this._camera.destroy();
|
|
24
|
+
}
|
|
25
|
+
get isActive() {
|
|
26
|
+
return this._camera.isActive;
|
|
27
|
+
}
|
|
28
|
+
setIsActive(value) {
|
|
29
|
+
this._camera.setActive(value);
|
|
30
|
+
}
|
|
31
|
+
get direction() {
|
|
32
|
+
const { x, y, z } = this._camera.direction;
|
|
33
|
+
return new Vector3D(x, y, z);
|
|
34
|
+
}
|
|
35
|
+
get fov() {
|
|
36
|
+
return this._camera.fov;
|
|
37
|
+
}
|
|
38
|
+
setFov(value) {
|
|
39
|
+
this._camera.setFov(value);
|
|
40
|
+
}
|
|
41
|
+
pointAtCoord(value) {
|
|
42
|
+
this._camera.pointAtCoord(value);
|
|
43
|
+
}
|
|
44
|
+
setPosition(value) {
|
|
45
|
+
this._camera.setPosition(value);
|
|
46
|
+
}
|
|
47
|
+
get position() {
|
|
48
|
+
const { x, y, z } = this._camera.position;
|
|
49
|
+
return new Vector3D(x, y, z);
|
|
50
|
+
}
|
|
51
|
+
get rotation() {
|
|
52
|
+
const { x, y, z } = this._camera.rotation;
|
|
53
|
+
return new Vector3D(x, y, z);
|
|
54
|
+
}
|
|
55
|
+
setRotation(value) {
|
|
56
|
+
this._camera.setRotation(value);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type IBaseObjectsIterator } from "../../common/baseObject/IBaseObjectsIterator";
|
|
2
|
+
import { type ICameraCreateOptions, type ICameraManager } from "../../common/camera/ICameraManager";
|
|
3
|
+
import { CCMPCamera } from "./CCMPCamera";
|
|
4
|
+
export declare class CCMPCameraManager implements ICameraManager {
|
|
5
|
+
private readonly _cameras;
|
|
6
|
+
private readonly _iterator;
|
|
7
|
+
get iterator(): IBaseObjectsIterator<CCMPCamera>;
|
|
8
|
+
create(options: ICameraCreateOptions): CCMPCamera;
|
|
9
|
+
renderScriptCams(render: boolean, ease: boolean, easeTime: number, freezePreviousCamera: boolean): void;
|
|
10
|
+
getGameplayCamera(): CCMPCamera;
|
|
11
|
+
getByID(id: number): CCMPCamera;
|
|
12
|
+
findByID(id: number): CCMPCamera | null;
|
|
13
|
+
getByRemoteID(remoteId: number): CCMPCamera;
|
|
14
|
+
findByRemoteID(remoteId: number): CCMPCamera | null;
|
|
15
|
+
deleteById(id: number): CCMPCamera;
|
|
16
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { CCMPCamera } from "./CCMPCamera";
|
|
2
|
+
export class CCMPCameraManager {
|
|
3
|
+
constructor() {
|
|
4
|
+
this._cameras = new Map();
|
|
5
|
+
this._iterator = {
|
|
6
|
+
all: () => this._cameras.values(),
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
get iterator() {
|
|
10
|
+
return this._iterator;
|
|
11
|
+
}
|
|
12
|
+
create(options) {
|
|
13
|
+
const camera = new CCMPCamera(ccmp.cameras.create(options.name, options.position, options.rotation, options.fov));
|
|
14
|
+
this._cameras.set(camera.id, camera);
|
|
15
|
+
return camera;
|
|
16
|
+
}
|
|
17
|
+
renderScriptCams(render, ease, easeTime, freezePreviousCamera) {
|
|
18
|
+
ccmp.cameras.renderScriptCams(render, ease, easeTime, freezePreviousCamera);
|
|
19
|
+
}
|
|
20
|
+
getGameplayCamera() {
|
|
21
|
+
return new CCMPCamera(ccmp.cameras.getGameplayCamera());
|
|
22
|
+
}
|
|
23
|
+
getByID(id) {
|
|
24
|
+
const camera = this.findByID(id);
|
|
25
|
+
if (!camera) {
|
|
26
|
+
throw new Error(`CCMPCameraManager.getByID(${id}): camera not found.`);
|
|
27
|
+
}
|
|
28
|
+
return camera;
|
|
29
|
+
}
|
|
30
|
+
findByID(id) {
|
|
31
|
+
var _a;
|
|
32
|
+
return (_a = this._cameras.get(id)) !== null && _a !== void 0 ? _a : null;
|
|
33
|
+
}
|
|
34
|
+
getByRemoteID(remoteId) {
|
|
35
|
+
const camera = this.findByRemoteID(remoteId);
|
|
36
|
+
if (!camera) {
|
|
37
|
+
throw new Error(`CCMPCameraManager.getByRemoteID(${remoteId}): camera not found.`);
|
|
38
|
+
}
|
|
39
|
+
return camera;
|
|
40
|
+
}
|
|
41
|
+
findByRemoteID(remoteId) {
|
|
42
|
+
void remoteId;
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
deleteById(id) {
|
|
46
|
+
const camera = this.getByID(id);
|
|
47
|
+
camera.destroy();
|
|
48
|
+
this._cameras.delete(id);
|
|
49
|
+
return camera;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type Colshape as CcmpColshape } from "@classic-mp/types/client";
|
|
2
|
+
import { BaseObjectType } from "../../../../shared/entities";
|
|
3
|
+
import { type IVector3D, Vector3D } from "../../../../shared/common/utils";
|
|
4
|
+
import { type IColshape } from "../../common/colshape/IColshape";
|
|
5
|
+
export declare class CCMPColshape implements IColshape {
|
|
6
|
+
private readonly _ccmpColshape;
|
|
7
|
+
private readonly _onDestroy;
|
|
8
|
+
private _destroyed;
|
|
9
|
+
constructor(_ccmpColshape: CcmpColshape, _onDestroy?: (colshape: CCMPColshape) => void);
|
|
10
|
+
get id(): number;
|
|
11
|
+
get remoteId(): number | null;
|
|
12
|
+
get type(): BaseObjectType;
|
|
13
|
+
get isExists(): boolean;
|
|
14
|
+
get handle(): number;
|
|
15
|
+
destroy(): void;
|
|
16
|
+
get position(): Vector3D;
|
|
17
|
+
get dimension(): number;
|
|
18
|
+
get key(): string | undefined;
|
|
19
|
+
setPosition(_value: IVector3D): void;
|
|
20
|
+
setDimension(_value: number): void;
|
|
21
|
+
setCoords(_xPos: number, _yPos: number, _zPos: number, _xAxis: boolean, _yAxis: boolean, _zAxis: boolean, _clearArea: boolean): void;
|
|
22
|
+
getVariable(name: string): unknown | null;
|
|
23
|
+
getSyncedMeta(key: string): unknown | undefined;
|
|
24
|
+
hasSyncedMeta(key: string): boolean;
|
|
25
|
+
getSyncedMetaKeys(): readonly string[];
|
|
26
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { BaseObjectType } from "../../../../shared/entities";
|
|
2
|
+
import { Vector3D } from "../../../../shared/common/utils";
|
|
3
|
+
const notImplemented = (memberName) => {
|
|
4
|
+
throw new Error(`CCMPColshape.${memberName}: not implemented`);
|
|
5
|
+
};
|
|
6
|
+
export class CCMPColshape {
|
|
7
|
+
constructor(_ccmpColshape, _onDestroy = () => { }) {
|
|
8
|
+
this._ccmpColshape = _ccmpColshape;
|
|
9
|
+
this._onDestroy = _onDestroy;
|
|
10
|
+
this._destroyed = false;
|
|
11
|
+
}
|
|
12
|
+
get id() {
|
|
13
|
+
return this._ccmpColshape.id;
|
|
14
|
+
}
|
|
15
|
+
get remoteId() {
|
|
16
|
+
return this._ccmpColshape.remoteId;
|
|
17
|
+
}
|
|
18
|
+
get type() {
|
|
19
|
+
return BaseObjectType.Colshape;
|
|
20
|
+
}
|
|
21
|
+
get isExists() {
|
|
22
|
+
return !this._destroyed && this._ccmpColshape.isExists;
|
|
23
|
+
}
|
|
24
|
+
get handle() {
|
|
25
|
+
return 0;
|
|
26
|
+
}
|
|
27
|
+
destroy() {
|
|
28
|
+
if (this._destroyed)
|
|
29
|
+
return;
|
|
30
|
+
this._destroyed = true;
|
|
31
|
+
this._ccmpColshape.destroy();
|
|
32
|
+
this._onDestroy(this);
|
|
33
|
+
}
|
|
34
|
+
get position() {
|
|
35
|
+
const { x, y, z } = this._ccmpColshape.position;
|
|
36
|
+
return new Vector3D(x, y, z);
|
|
37
|
+
}
|
|
38
|
+
get dimension() {
|
|
39
|
+
return this._ccmpColshape.dimension;
|
|
40
|
+
}
|
|
41
|
+
get key() {
|
|
42
|
+
const value = this.getSyncedMeta("key");
|
|
43
|
+
return typeof value === "string" ? value : undefined;
|
|
44
|
+
}
|
|
45
|
+
setPosition(_value) {
|
|
46
|
+
notImplemented("setPosition");
|
|
47
|
+
}
|
|
48
|
+
setDimension(_value) {
|
|
49
|
+
notImplemented("setDimension");
|
|
50
|
+
}
|
|
51
|
+
setCoords(_xPos, _yPos, _zPos, _xAxis, _yAxis, _zAxis, _clearArea) {
|
|
52
|
+
notImplemented("setCoords");
|
|
53
|
+
}
|
|
54
|
+
getVariable(name) {
|
|
55
|
+
const remoteId = this.remoteId;
|
|
56
|
+
if (remoteId === null) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
const value = ccmp.entities.getStreamSyncedMeta(ccmp.entities.ENTITY_TYPE.Colshape, remoteId, name);
|
|
60
|
+
return value === undefined ? null : value;
|
|
61
|
+
}
|
|
62
|
+
getSyncedMeta(key) {
|
|
63
|
+
const remoteId = this.remoteId;
|
|
64
|
+
if (remoteId === null) {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
return ccmp.entities.getStreamSyncedMeta(ccmp.entities.ENTITY_TYPE.Colshape, remoteId, key);
|
|
68
|
+
}
|
|
69
|
+
hasSyncedMeta(key) {
|
|
70
|
+
const remoteId = this.remoteId;
|
|
71
|
+
if (remoteId === null) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
return ccmp.entities.hasStreamSyncedMeta(ccmp.entities.ENTITY_TYPE.Colshape, remoteId, key);
|
|
75
|
+
}
|
|
76
|
+
getSyncedMetaKeys() {
|
|
77
|
+
const remoteId = this.remoteId;
|
|
78
|
+
if (remoteId === null) {
|
|
79
|
+
return [];
|
|
80
|
+
}
|
|
81
|
+
return ccmp.entities.getStreamSyncedMetaKeys(ccmp.entities.ENTITY_TYPE.Colshape, remoteId);
|
|
82
|
+
}
|
|
83
|
+
}
|