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
@@ -68,7 +68,8 @@ export class CCMPPlayer {
68
68
  }
69
69
  // -- IEntity --------------------------------------------------------------
70
70
  get model() {
71
- return this._withHandle(0, (handle) => ccmp.natives.entity.getEntityModel(handle));
71
+ var _a, _b;
72
+ return (_b = (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.model) !== null && _b !== void 0 ? _b : 0;
72
73
  }
73
74
  get heading() {
74
75
  var _a, _b;
@@ -78,25 +79,23 @@ export class CCMPPlayer {
78
79
  var _a;
79
80
  (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.setHeading(heading);
80
81
  }
81
- setModel(_value) {
82
- this._warnOnce("setModel");
82
+ setModel(value) {
83
+ var _a;
84
+ (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.setModel(value);
83
85
  }
84
86
  get rotation() {
85
- return this._withHandle(ZERO_VECTOR, (handle) => {
86
- const rotation = ccmp.natives.entity.getEntityRotation(handle, 2);
87
- return new Vector3D(rotation.x, rotation.y, rotation.z);
88
- });
87
+ var _a;
88
+ const rotation = (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.rotation;
89
+ return rotation ? new Vector3D(rotation.x, rotation.y, rotation.z) : ZERO_VECTOR;
89
90
  }
90
91
  setRotation(value) {
91
- this._withHandleVoid((handle) => {
92
- ccmp.natives.entity.setEntityRotation(handle, value.x, value.y, value.z, 2, true);
93
- });
92
+ var _a;
93
+ (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.setRotation(value);
94
94
  }
95
95
  get forwardVector() {
96
- return this._withHandle(ZERO_VECTOR, (handle) => {
97
- const vector = ccmp.natives.entity.getEntityForwardVector(handle);
98
- return new Vector3D(vector.x, vector.y, vector.z);
99
- });
96
+ var _a;
97
+ const vector = (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.forwardVector;
98
+ return vector ? new Vector3D(vector.x, vector.y, vector.z) : ZERO_VECTOR;
100
99
  }
101
100
  freezePosition(freeze) {
102
101
  var _a;
@@ -127,19 +126,18 @@ export class CCMPPlayer {
127
126
  (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.resetAlpha();
128
127
  }
129
128
  getOffsetFromInWorldCoords(offsetX, offsetY, offsetZ) {
130
- return this._withHandle(ZERO_VECTOR, (handle) => {
131
- const position = ccmp.natives.entity.getOffsetFromEntityInWorldCoords(handle, offsetX, offsetY, offsetZ);
132
- return new Vector3D(position.x, position.y, position.z);
133
- });
129
+ var _a;
130
+ const position = (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.getOffsetFromInWorldCoords(offsetX, offsetY, offsetZ);
131
+ return position ? new Vector3D(position.x, position.y, position.z) : ZERO_VECTOR;
134
132
  }
135
133
  getBoneIndexByName(boneName) {
136
- return this._withHandle(-1, (handle) => ccmp.natives.entity.getEntityBoneIndexByName(handle, boneName));
134
+ var _a, _b;
135
+ return (_b = (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.getBoneIndexByName(boneName)) !== null && _b !== void 0 ? _b : -1;
137
136
  }
138
137
  getWorldPositionOfBone(boneIndex) {
139
- return this._withHandle(ZERO_VECTOR, (handle) => {
140
- const position = ccmp.natives.entity.getWorldPositionOfEntityBone(handle, boneIndex);
141
- return new Vector3D(position.x, position.y, position.z);
142
- });
138
+ var _a;
139
+ const position = (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.getWorldPositionOfBone(boneIndex);
140
+ return position ? new Vector3D(position.x, position.y, position.z) : ZERO_VECTOR;
143
141
  }
144
142
  getVariable(name) {
145
143
  const value = ccmp.entities.getStreamSyncedMeta(ccmp.entities.ENTITY_TYPE.Player, this._id, name);
@@ -155,20 +153,20 @@ export class CCMPPlayer {
155
153
  return ccmp.entities.getStreamSyncedMetaKeys(ccmp.entities.ENTITY_TYPE.Player, this._id);
156
154
  }
157
155
  attachToEntity(target, boneIndex, offset, rotation, p9, useSoftPinning, collision, isPed, vertexIndex, fixedRot) {
158
- this._withHandleVoid((handle) => {
159
- ccmp.natives.entity.attachEntityToEntity(handle, target.handle, boneIndex, offset.x, offset.y, offset.z, rotation.x, rotation.y, rotation.z, p9, useSoftPinning, collision, isPed, vertexIndex, fixedRot, 0);
160
- });
156
+ var _a;
157
+ (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.attachToEntity(target, boneIndex, offset, rotation, p9, useSoftPinning, collision, isPed, vertexIndex, fixedRot);
161
158
  }
162
159
  detach(useDetachVelocity, collision) {
163
- this._withHandleVoid((handle) => {
164
- ccmp.natives.entity.detachEntity(handle, useDetachVelocity, collision);
165
- });
160
+ var _a;
161
+ (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.detach(useDetachVelocity, collision);
166
162
  }
167
163
  getSpeed() {
168
- return this._withHandle(0, (handle) => ccmp.natives.entity.getEntitySpeed(handle));
164
+ var _a, _b;
165
+ return (_b = (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.getSpeed()) !== null && _b !== void 0 ? _b : 0;
169
166
  }
170
167
  isPlayingAnim(dictionary, name, taskFlag) {
171
- return this._withHandle(false, (handle) => ccmp.natives.entity.isEntityPlayingAnim(handle, dictionary, name, taskFlag));
168
+ var _a, _b;
169
+ return (_b = (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.isPlayingAnim(dictionary, name, taskFlag)) !== null && _b !== void 0 ? _b : false;
172
170
  }
173
171
  // -- IPlayer --------------------------------------------------------------
174
172
  get name() {
@@ -214,64 +212,83 @@ export class CCMPPlayer {
214
212
  return 0;
215
213
  }
216
214
  getBoneIndex(boneId) {
217
- return this._withHandle(-1, (handle) => ccmp.natives.ped.getPedBoneIndex(handle, boneId));
215
+ var _a, _b;
216
+ return (_b = (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.getBoneIndex(boneId)) !== null && _b !== void 0 ? _b : -1;
218
217
  }
219
- setDecoration(_collection, _overlay) {
220
- this._warnOnce("setDecoration");
218
+ setDecoration(collection, overlay) {
219
+ var _a;
220
+ (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.setDecoration(collection, overlay);
221
221
  }
222
- removeDecoration(_collection, _overlay) {
223
- this._warnOnce("removeDecoration");
222
+ removeDecoration(collection, overlay) {
223
+ var _a;
224
+ (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.removeDecoration(collection, overlay);
224
225
  }
225
226
  clearDecorations() {
226
- this._warnOnce("clearDecorations");
227
+ var _a;
228
+ (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.clearDecorations();
227
229
  }
228
- setHeadBlendData(_shapeFirstId, _shapeSecondId, _shapeThirdId, _skinFirstId, _skinSecondId, _skinThirdId, _shapeMix, _skinMix, _thirdMix, _isParent) {
229
- this._warnOnce("setHeadBlendData");
230
+ setHeadBlendData(shapeFirstId, shapeSecondId, shapeThirdId, skinFirstId, skinSecondId, skinThirdId, shapeMix, skinMix, thirdMix, isParent) {
231
+ var _a;
232
+ (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.setHeadBlendData(shapeFirstId, shapeSecondId, shapeThirdId, skinFirstId, skinSecondId, skinThirdId, shapeMix, skinMix, thirdMix, isParent);
230
233
  }
231
- setFaceFeature(_index, _value) {
232
- this._warnOnce("setFaceFeature");
234
+ setFaceFeature(index, value) {
235
+ var _a;
236
+ (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.setFaceFeature(index, value);
233
237
  }
234
- setHeadOverlay(_overlayId, _index, _opacity, _firstColor, _secondColor) {
235
- this._warnOnce("setHeadOverlay");
238
+ setHeadOverlay(overlayId, index, opacity, _firstColor, _secondColor) {
239
+ var _a;
240
+ (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.setHeadOverlay(overlayId, index, opacity);
236
241
  }
237
- setHeadOverlayColor(_overlayId, _colorTypeId, _firstColor, _secondColor) {
238
- this._warnOnce("setHeadOverlayColor");
242
+ setHeadOverlayColor(overlayId, colorTypeId, firstColor, secondColor) {
243
+ var _a;
244
+ (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.setHeadOverlayColor(overlayId, colorTypeId, firstColor, secondColor);
239
245
  }
240
- setEyeColor(_eyeColor) {
241
- this._warnOnce("setEyeColor");
246
+ setEyeColor(eyeColor) {
247
+ var _a;
248
+ (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.setEyeColor(eyeColor);
242
249
  }
243
- setHairColor(_colorId, _highlightColorId) {
244
- this._warnOnce("setHairColor");
250
+ setHairColor(colorId, highlightColorId) {
251
+ var _a;
252
+ (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.setHairColor(colorId, highlightColorId);
245
253
  }
246
- setComponentVariation(_componentId, _drawableId, _textureId, _paletteId) {
247
- this._warnOnce("setComponentVariation");
254
+ setComponentVariation(componentId, drawableId, textureId, paletteId) {
255
+ var _a;
256
+ (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.setComponentVariation(componentId, drawableId, textureId, paletteId);
248
257
  }
249
- setPropertyVariation(_componentId, _drawableId, _textureId, _attach) {
250
- this._warnOnce("setPropertyVariation");
258
+ setPropertyVariation(componentId, drawableId, textureId, attach) {
259
+ var _a;
260
+ (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.setPropertyVariation(componentId, drawableId, textureId, attach);
251
261
  }
252
- clearProp(_componentId) {
253
- this._warnOnce("clearProp");
262
+ clearProp(componentId) {
263
+ var _a;
264
+ (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.clearProp(componentId);
254
265
  }
255
266
  get isLocalPlayer() {
256
267
  return this._isLocal;
257
268
  }
258
269
  taskSwapWeapon() {
259
- this._warnOnce("taskSwapWeapon");
270
+ var _a;
271
+ (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.taskSwapWeapon(true);
260
272
  }
261
- taskEnterVehicle(_vehicleHandle, _timeout, _seat, _speed, _flag, _p6) {
262
- this._warnOnce("taskEnterVehicle");
273
+ taskEnterVehicle(vehicleHandle, timeout, seat, speed, flag, _p6) {
274
+ var _a;
275
+ (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.taskEnterVehicle(vehicleHandle, timeout, seat, speed, flag);
263
276
  }
264
277
  clearTasks() {
265
- this._warnOnce("clearTasks");
278
+ var _a;
279
+ (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.clearTasks();
266
280
  }
267
281
  clearTasksImmediately() {
268
- this._warnOnce("clearTasksImmediately");
282
+ var _a;
283
+ (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.clearTasksImmediately();
269
284
  }
270
- taskPlayAnim(_dictionary, _name, _blendInSpeed, _blendOutSpeed, _duration, _flag, _playbackRate, _lockX, _lockY, _lockZ) {
271
- this._warnOnce("taskPlayAnim");
285
+ taskPlayAnim(dictionary, name, blendInSpeed, blendOutSpeed, duration, flag, playbackRate, lockX, lockY, lockZ) {
286
+ var _a;
287
+ (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.taskPlayAnim(dictionary, name, blendInSpeed, blendOutSpeed, duration, flag, playbackRate, lockX, lockY, lockZ);
272
288
  }
273
- stopAnim(_dictionary, _name, _blendOutSpeed) {
274
- this._warnOnce("stopAnim");
289
+ stopAnim(dictionary, name, blendOutSpeed) {
290
+ var _a;
291
+ (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.stopAnim(dictionary, name, blendOutSpeed);
275
292
  }
276
293
  setMovementClipset(_clipset, _speed) {
277
294
  this._warnOnce("setMovementClipset");
@@ -280,17 +297,13 @@ export class CCMPPlayer {
280
297
  this._warnOnce("resetMovementClipset");
281
298
  }
282
299
  getBoneCoords(boneId, offsetX, offsetY, offsetZ) {
283
- return this._withHandle(ZERO_VECTOR, (handle) => {
284
- const position = ccmp.natives.ped.getPedBoneCoords(handle, boneId, offsetX, offsetY, offsetZ);
285
- return new Vector3D(position.x, position.y, position.z);
286
- });
300
+ var _a;
301
+ const position = (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.getBoneCoords(boneId, offsetX, offsetY, offsetZ);
302
+ return position ? new Vector3D(position.x, position.y, position.z) : ZERO_VECTOR;
287
303
  }
288
304
  setNoCollision(otherHandle, thisFrameOnly) {
289
- this._withHandleVoid((handle) => {
290
- if (otherHandle !== 0) {
291
- ccmp.natives.entity.setEntityNoCollisionEntity(handle, otherHandle, thisFrameOnly);
292
- }
293
- });
305
+ var _a;
306
+ (_a = this._getNativePlayer()) === null || _a === void 0 ? void 0 : _a.setNoCollision(otherHandle, thisFrameOnly);
294
307
  }
295
308
  _getNativePlayer() {
296
309
  try {
@@ -305,20 +318,6 @@ export class CCMPPlayer {
305
318
  return null;
306
319
  }
307
320
  }
308
- _withHandle(fallback, callback) {
309
- const handle = this.handle;
310
- if (!handle) {
311
- return fallback;
312
- }
313
- return callback(handle);
314
- }
315
- _withHandleVoid(callback) {
316
- const handle = this.handle;
317
- if (!handle) {
318
- return;
319
- }
320
- callback(handle);
321
- }
322
321
  _warnOnce(method) {
323
322
  if (CCMPPlayer._warnedMethods.has(method)) {
324
323
  return;
@@ -9,9 +9,10 @@ import { CCMPPlayer } from "./CCMPPlayer";
9
9
  *
10
10
  * ### Хранилище
11
11
  *
12
- * `Map<id, CCMPPlayer>`. У CCMP нет отдельных `id`/`remoteId` как в RageMP:
13
- * один числовой `id` приходит от сервера, и он же используется везде.
14
- * `findByID`/`findByRemoteID`/`findByRemoteId` маппятся на один lookup.
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>`. У CCMP нет отдельных `id`/`remoteId` как в RageMP:
11
- * один числовой `id` приходит от сервера, и он же используется везде.
12
- * `findByID`/`findByRemoteID`/`findByRemoteId` маппятся на один lookup.
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
- this._ensurePlayer(player.remoteId, player.name, /* isLocal */ true);
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
- this._ensurePlayer(player.remoteId, player.name, /* isLocal */ false);
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 existing = this._players.get(player.remoteId);
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(player.remoteId);
87
+ this._players.delete(remoteId);
75
88
  }
76
89
  },
77
90
  });
@@ -0,0 +1,102 @@
1
+ import { type Vehicle as CcmpVehicle } from "@classic-mp/types/client";
2
+ import { BaseObjectType } from "../../../../shared/entities";
3
+ import { type IRGB, type IVector3D, Vector3D } from "../../../../shared/common/utils";
4
+ import { type IBaseObject } from "../../common/baseObject/IBaseObject";
5
+ import { type ILightState, type IVehicle } from "../../common/vehicle/IVehicle";
6
+ export type ICCMPNativeVehicle = CcmpVehicle;
7
+ export declare class CCMPVehicle implements IVehicle {
8
+ private readonly _ccmpVehicle;
9
+ private readonly _onDestroy;
10
+ private _destroyed;
11
+ constructor(_ccmpVehicle: ICCMPNativeVehicle, _onDestroy?: (vehicle: CCMPVehicle) => void);
12
+ get id(): number;
13
+ get remoteId(): number | null;
14
+ get type(): BaseObjectType;
15
+ get isExists(): boolean;
16
+ get handle(): number;
17
+ destroy(): void;
18
+ get position(): Vector3D;
19
+ get dimension(): number;
20
+ setPosition(value: IVector3D): void;
21
+ setDimension(value: number): void;
22
+ setCoords(xPos: number, yPos: number, zPos: number, xAxis: boolean, yAxis: boolean, zAxis: boolean, clearArea: boolean): void;
23
+ get model(): number;
24
+ get heading(): number;
25
+ setHeading(heading: number): void;
26
+ setModel(value: string): void;
27
+ get rotation(): Vector3D;
28
+ get forwardVector(): Vector3D;
29
+ setRotation(value: IVector3D): void;
30
+ freezePosition(freeze: boolean): void;
31
+ setCollision(collision: boolean, keepPhysics: boolean): void;
32
+ setInvincible(invincible: boolean): void;
33
+ setVisible(visible: boolean): void;
34
+ setAlpha(alpha: number): void;
35
+ get alpha(): number;
36
+ resetAlpha(): void;
37
+ getOffsetFromInWorldCoords(offsetX: number, offsetY: number, offsetZ: number): IVector3D;
38
+ getBoneIndexByName(boneName: string): number;
39
+ getWorldPositionOfBone(boneIndex: number): IVector3D;
40
+ getVariable(name: string): unknown | null;
41
+ getSyncedMeta(key: string): unknown | undefined;
42
+ hasSyncedMeta(key: string): boolean;
43
+ getSyncedMetaKeys(): readonly string[];
44
+ attachToEntity(target: IBaseObject, boneIndex: number, offset: IVector3D, rotation: IVector3D, p9: boolean, useSoftPinning: boolean, collision: boolean, isPed: boolean, vertexIndex: number, fixedRot: boolean): void;
45
+ detach(useDetachVelocity: boolean, collision: boolean): void;
46
+ getSpeed(): number;
47
+ isPlayingAnim(dictionary: string, name: string, taskFlag: number): boolean;
48
+ get bodyHealth(): number;
49
+ get engineHealth(): number;
50
+ get numberPlate(): string;
51
+ get isDead(): boolean;
52
+ setBodyHealth(value: number): void;
53
+ setEngineHealth(value: number): void;
54
+ setNumberPlate(value: string): void;
55
+ explode(): void;
56
+ getPedInSeat(seat: number): number;
57
+ setUndriveable(toggle: boolean): void;
58
+ get maxNumberOfPassengers(): number;
59
+ get gear(): number;
60
+ get speed(): number;
61
+ get isEngineRunning(): boolean;
62
+ setEngineOn(toggle: boolean, instantly: boolean, otherwise: boolean): void;
63
+ get lightsState(): ILightState;
64
+ get isLocked(): boolean;
65
+ setIsLocked(value: boolean): void;
66
+ setCustomPrimaryColour(color: IRGB): void;
67
+ setCustomSecondaryColour(color: IRGB): void;
68
+ get customPrimaryColour(): IRGB;
69
+ get customSecondaryColour(): IRGB;
70
+ setMod(modType: number, modIndex: number): void;
71
+ getMod(modType: number): number;
72
+ getNumMods(modType: number): number;
73
+ setNeonLightEnabled(index: number, toggle: boolean): void;
74
+ setNeonLightsColour(color: IRGB): void;
75
+ setWindowTint(tintType: number): void;
76
+ get windowTint(): number;
77
+ setWheelType(wheelType: number): void;
78
+ get wheelType(): number;
79
+ setNumberPlateTextIndex(index: number): void;
80
+ get numberPlateTextIndex(): number;
81
+ setDoorOpen(doorIndex: number, loose: boolean, openInstantly: boolean): void;
82
+ setDoorShut(doorIndex: number, instantly: boolean): void;
83
+ setHandling(field: string, value: number): void;
84
+ getHandling(field: string): number;
85
+ setEnginePowerMultiplier(value: number): void;
86
+ setEngineTorqueMultiplier(value: number): void;
87
+ modifyTopSpeed(value: number): void;
88
+ setCheatPowerIncrease(value: number): void;
89
+ toggleMod(modType: number, toggle: boolean): void;
90
+ setTyreSmokeColor(r: number, g: number, b: number): void;
91
+ setModColor1(paintType: number, color: number, p3: number): void;
92
+ setExtraColours(pearlescentColor: number, wheelColor: number): void;
93
+ setHeadlightColor(colorIndex: number): void;
94
+ setDashboardColor(colorIndex: number): void;
95
+ setInteriorColor(colorIndex: number): void;
96
+ getMaxBraking(): number;
97
+ getAcceleration(): number;
98
+ getMaxTraction(): number;
99
+ getModelMaxSpeed(): number;
100
+ private _normalizeHandle;
101
+ private _getRemoteVehicleExists;
102
+ }