rock-mod 0.21.0 → 0.23.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.
Files changed (81) hide show
  1. package/dist/client/entities/ccmp/blip/CCMPBlip.d.ts +38 -0
  2. package/dist/client/entities/ccmp/blip/CCMPBlip.js +118 -0
  3. package/dist/client/entities/ccmp/blip/CCMPBlipsManager.d.ts +27 -0
  4. package/dist/client/entities/ccmp/blip/CCMPBlipsManager.js +191 -0
  5. package/dist/client/entities/ccmp/camera/CCMPCamera.d.ts +1 -1
  6. package/dist/client/entities/ccmp/camera/CCMPCamera.js +1 -1
  7. package/dist/client/entities/ccmp/camera/CCMPCameraManager.js +2 -1
  8. package/dist/client/entities/ccmp/colshape/CCMPColshape.d.ts +26 -0
  9. package/dist/client/entities/ccmp/colshape/CCMPColshape.js +83 -0
  10. package/dist/client/entities/ccmp/colshape/CCMPColshapesManager.d.ts +31 -0
  11. package/dist/client/entities/ccmp/colshape/CCMPColshapesManager.js +193 -0
  12. package/dist/client/entities/ccmp/marker/CCMPMarker.d.ts +34 -0
  13. package/dist/client/entities/ccmp/marker/CCMPMarker.js +109 -0
  14. package/dist/client/entities/ccmp/marker/CCMPMarkersManager.d.ts +27 -0
  15. package/dist/client/entities/ccmp/marker/CCMPMarkersManager.js +180 -0
  16. package/dist/client/entities/ccmp/object/CCMPObject.d.ts +50 -0
  17. package/dist/client/entities/ccmp/object/CCMPObject.js +149 -0
  18. package/dist/client/entities/ccmp/object/CCMPObjectsManager.d.ts +27 -0
  19. package/dist/client/entities/ccmp/object/CCMPObjectsManager.js +177 -0
  20. package/dist/client/entities/ccmp/ped/CCMPPed.d.ts +1 -1
  21. package/dist/client/entities/ccmp/ped/CCMPPed.js +21 -7
  22. package/dist/client/entities/ccmp/ped/CCMPPedsManager.d.ts +7 -0
  23. package/dist/client/entities/ccmp/ped/CCMPPedsManager.js +82 -10
  24. package/dist/client/entities/ccmp/player/CCMPPlayer.d.ts +15 -17
  25. package/dist/client/entities/ccmp/player/CCMPPlayer.js +86 -87
  26. package/dist/client/entities/ccmp/player/CCMPPlayersManager.d.ts +4 -3
  27. package/dist/client/entities/ccmp/player/CCMPPlayersManager.js +20 -7
  28. package/dist/client/entities/ccmp/vehicle/CCMPVehicle.d.ts +102 -0
  29. package/dist/client/entities/ccmp/vehicle/CCMPVehicle.js +311 -0
  30. package/dist/client/entities/ccmp/vehicle/CCMPVehiclesManager.d.ts +11 -48
  31. package/dist/client/entities/ccmp/vehicle/CCMPVehiclesManager.js +154 -75
  32. package/dist/client/entities/common/baseObject/IBaseObject.d.ts +2 -1
  33. package/dist/client/entities/ragemp/entity/RageEntity.d.ts +4 -0
  34. package/dist/client/entities/ragemp/entity/RageEntity.js +34 -2
  35. package/dist/client/factories/ccmp/CCMPManagersFactory.d.ts +9 -7
  36. package/dist/client/factories/ccmp/CCMPManagersFactory.js +62 -22
  37. package/dist/client/game/ccmp/chat/CCMPChatManager.d.ts +2 -22
  38. package/dist/client/game/ccmp/chat/CCMPChatManager.js +6 -34
  39. package/dist/client/game/ccmp/storage/CCMPStorageManager.d.ts +0 -18
  40. package/dist/client/game/ccmp/storage/CCMPStorageManager.js +4 -36
  41. package/dist/client/game/ccmp/ui/CCMPUiManager.d.ts +0 -29
  42. package/dist/client/game/ccmp/ui/CCMPUiManager.js +5 -41
  43. package/dist/client/net/ccmp/CCMPNetManager.d.ts +0 -7
  44. package/dist/client/net/ccmp/CCMPNetManager.js +0 -26
  45. package/dist/client/net/ccmp/dataHandler/CCMPDataHandler.d.ts +2 -2
  46. package/dist/client/net/ccmp/dataHandler/CCMPDataHandler.js +2 -2
  47. package/dist/client/net/ccmp/events/CCMPEventsBridge.d.ts +3 -1
  48. package/dist/client/net/ccmp/events/CCMPEventsBridge.js +33 -3
  49. package/dist/client/net/ccmp/events/CCMPSyncedMetaBridge.d.ts +21 -16
  50. package/dist/client/net/ccmp/events/CCMPSyncedMetaBridge.js +32 -22
  51. package/dist/client/net/common/dataHandler/IDataHandler.d.ts +2 -2
  52. package/dist/client/net/common/events/types.d.ts +4 -4
  53. package/dist/client/net/ragemp/dataHandler/RageDataHandler.d.ts +2 -2
  54. package/dist/server/entities/altv/colshape/AltVColshape.d.ts +2 -0
  55. package/dist/server/entities/altv/colshape/AltVColshape.js +6 -0
  56. package/dist/server/entities/ccmp/baseObject/CCMPBaseObjectsManager.js +4 -4
  57. package/dist/server/entities/ccmp/blip/CCMPBlip.d.ts +2 -0
  58. package/dist/server/entities/ccmp/blip/CCMPBlip.js +6 -0
  59. package/dist/server/entities/ccmp/colshape/CCMPColshape.d.ts +2 -0
  60. package/dist/server/entities/ccmp/colshape/CCMPColshape.js +6 -0
  61. package/dist/server/entities/ccmp/marker/CCMPMarker.d.ts +2 -0
  62. package/dist/server/entities/ccmp/marker/CCMPMarker.js +6 -0
  63. package/dist/server/entities/ccmp/object/CCMPObject.d.ts +1 -1
  64. package/dist/server/entities/ccmp/object/CCMPObject.js +3 -5
  65. package/dist/server/entities/ccmp/object/CCMPObjectsManager.js +1 -2
  66. package/dist/server/entities/ccmp/player/CCMPPlayersManager.js +15 -0
  67. package/dist/server/entities/ccmp/vehicle/CCMPVehicle.d.ts +29 -15
  68. package/dist/server/entities/ccmp/vehicle/CCMPVehicle.js +87 -44
  69. package/dist/server/entities/common/colshape/IColshape.d.ts +2 -0
  70. package/dist/server/entities/mock/colshape/MockColshape.d.ts +3 -0
  71. package/dist/server/entities/mock/colshape/MockColshape.js +8 -0
  72. package/dist/server/entities/ragemp/colshape/RageColshape.d.ts +2 -0
  73. package/dist/server/entities/ragemp/colshape/RageColshape.js +6 -0
  74. package/dist/server/entities/ragemp/entity/RageEntity.d.ts +5 -1
  75. package/dist/server/entities/ragemp/entity/RageEntity.js +17 -1
  76. package/dist/server/entities/ragemp/object/RageObjectsManager.js +1 -1
  77. package/dist/server/entities/ragemp/ped/RagePedsManager.js +1 -1
  78. package/dist/server/entities/ragemp/vehicle/RageVehiclesManager.js +1 -1
  79. package/dist/server/net/ccmp/CCMPNetManager.js +0 -5
  80. package/dist/server/net/ccmp/events/CCMPEventsManager.d.ts +6 -2
  81. package/package.json +2 -2
@@ -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
+ }
@@ -6,7 +6,7 @@ export declare class CCMPCamera implements ICamera {
6
6
  private readonly _camera;
7
7
  constructor(_camera: CcmpCamera);
8
8
  get id(): number;
9
- get remoteId(): number;
9
+ get remoteId(): number | null;
10
10
  get type(): BaseObjectType;
11
11
  get isExists(): boolean;
12
12
  get handle(): number;
@@ -8,7 +8,7 @@ export class CCMPCamera {
8
8
  return this._camera.id;
9
9
  }
10
10
  get remoteId() {
11
- return 0;
11
+ return null;
12
12
  }
13
13
  get type() {
14
14
  return BaseObjectType.Camera;
@@ -39,7 +39,8 @@ export class CCMPCameraManager {
39
39
  return camera;
40
40
  }
41
41
  findByRemoteID(remoteId) {
42
- return remoteId === 0 ? null : this.findByID(remoteId);
42
+ void remoteId;
43
+ return null;
43
44
  }
44
45
  deleteById(id) {
45
46
  const camera = this.getByID(id);
@@ -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
+ }
@@ -0,0 +1,31 @@
1
+ import { type CCMPEventsManager } from "../../../net/ccmp/events/CCMPEventsManager";
2
+ import { type ICircleColshapeCreateOptions, type IColshapesManager, type ICuboidColshapeCreateOptions, type ICylinderColshapeCreateOptions, type IRectangleColshapeCreateOptions, type ISphereColshapeCreateOptions } from "../../common/colshape/IColshapesManager";
3
+ import { type IWorldObjectsIterator } from "../../common/worldObject/IWorldObjectsIterator";
4
+ import { CCMPColshape } from "./CCMPColshape";
5
+ export declare class CCMPColshapesManager implements IColshapesManager {
6
+ private readonly _events;
7
+ private readonly _colshapes;
8
+ private readonly _colshapesByRemoteId;
9
+ private readonly _iterator;
10
+ constructor(_events: CCMPEventsManager);
11
+ createCircle(options: ICircleColshapeCreateOptions): CCMPColshape;
12
+ createCuboid(options: ICuboidColshapeCreateOptions): CCMPColshape;
13
+ createCylinder(options: ICylinderColshapeCreateOptions): CCMPColshape;
14
+ createRectangle(options: IRectangleColshapeCreateOptions): CCMPColshape;
15
+ createSphere(options: ISphereColshapeCreateOptions): CCMPColshape;
16
+ syncWithMpPool(): void;
17
+ registerById(id: number): CCMPColshape;
18
+ unregisterById(id: number): CCMPColshape;
19
+ findByID(id: number): CCMPColshape | null;
20
+ getByID(id: number): CCMPColshape;
21
+ findByRemoteID(remoteId: number): CCMPColshape | null;
22
+ getByRemoteID(remoteId: number): CCMPColshape;
23
+ deleteById(id: number): CCMPColshape;
24
+ get iterator(): IWorldObjectsIterator<CCMPColshape>;
25
+ private _register;
26
+ private _unregister;
27
+ private _findRegistered;
28
+ private _registerLifecycleEvents;
29
+ private _filter;
30
+ private _pruneDestroyed;
31
+ }