rock-mod 0.22.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 (28) hide show
  1. package/dist/client/entities/ccmp/object/CCMPObject.d.ts +3 -6
  2. package/dist/client/entities/ccmp/object/CCMPObject.js +33 -102
  3. package/dist/client/entities/ccmp/player/CCMPPlayer.d.ts +14 -16
  4. package/dist/client/entities/ccmp/player/CCMPPlayer.js +85 -92
  5. package/dist/client/entities/ccmp/vehicle/CCMPVehicle.d.ts +32 -49
  6. package/dist/client/entities/ccmp/vehicle/CCMPVehicle.js +117 -198
  7. package/dist/client/entities/ccmp/vehicle/CCMPVehiclesManager.js +2 -1
  8. package/dist/client/game/ccmp/chat/CCMPChatManager.d.ts +2 -22
  9. package/dist/client/game/ccmp/chat/CCMPChatManager.js +6 -34
  10. package/dist/client/game/ccmp/ui/CCMPUiManager.d.ts +0 -29
  11. package/dist/client/game/ccmp/ui/CCMPUiManager.js +5 -41
  12. package/dist/client/net/ccmp/CCMPNetManager.d.ts +0 -7
  13. package/dist/client/net/ccmp/CCMPNetManager.js +0 -26
  14. package/dist/client/net/ccmp/events/CCMPEventsBridge.d.ts +3 -1
  15. package/dist/client/net/ccmp/events/CCMPEventsBridge.js +33 -3
  16. package/dist/server/entities/altv/colshape/AltVColshape.d.ts +2 -0
  17. package/dist/server/entities/altv/colshape/AltVColshape.js +6 -0
  18. package/dist/server/entities/ccmp/player/CCMPPlayersManager.js +15 -0
  19. package/dist/server/entities/ccmp/vehicle/CCMPVehicle.d.ts +27 -13
  20. package/dist/server/entities/ccmp/vehicle/CCMPVehicle.js +82 -39
  21. package/dist/server/entities/common/colshape/IColshape.d.ts +2 -0
  22. package/dist/server/entities/mock/colshape/MockColshape.d.ts +3 -0
  23. package/dist/server/entities/mock/colshape/MockColshape.js +8 -0
  24. package/dist/server/entities/ragemp/colshape/RageColshape.d.ts +2 -0
  25. package/dist/server/entities/ragemp/colshape/RageColshape.js +6 -0
  26. package/dist/server/net/ccmp/CCMPNetManager.js +0 -5
  27. package/dist/server/net/ccmp/events/CCMPEventsManager.d.ts +6 -2
  28. package/package.json +2 -2
@@ -1,23 +1,9 @@
1
+ import { type Vehicle as CcmpVehicle } from "@classic-mp/types/client";
1
2
  import { BaseObjectType } from "../../../../shared/entities";
2
3
  import { type IRGB, type IVector3D, Vector3D } from "../../../../shared/common/utils";
3
4
  import { type IBaseObject } from "../../common/baseObject/IBaseObject";
4
5
  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
- }
6
+ export type ICCMPNativeVehicle = CcmpVehicle;
21
7
  export declare class CCMPVehicle implements IVehicle {
22
8
  private readonly _ccmpVehicle;
23
9
  private readonly _onDestroy;
@@ -31,20 +17,20 @@ export declare class CCMPVehicle implements IVehicle {
31
17
  destroy(): void;
32
18
  get position(): Vector3D;
33
19
  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;
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;
37
23
  get model(): number;
38
24
  get heading(): number;
39
- setHeading(_heading: number): void;
40
- setModel(_value: string): void;
25
+ setHeading(heading: number): void;
26
+ setModel(value: string): void;
41
27
  get rotation(): Vector3D;
42
28
  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;
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;
48
34
  setAlpha(alpha: number): void;
49
35
  get alpha(): number;
50
36
  resetAlpha(): void;
@@ -55,28 +41,28 @@ export declare class CCMPVehicle implements IVehicle {
55
41
  getSyncedMeta(key: string): unknown | undefined;
56
42
  hasSyncedMeta(key: string): boolean;
57
43
  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;
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;
60
46
  getSpeed(): number;
61
- isPlayingAnim(_dictionary: string, _name: string, _taskFlag: number): boolean;
47
+ isPlayingAnim(dictionary: string, name: string, taskFlag: number): boolean;
62
48
  get bodyHealth(): number;
63
49
  get engineHealth(): number;
64
50
  get numberPlate(): string;
65
51
  get isDead(): boolean;
66
- setBodyHealth(_value: number): void;
67
- setEngineHealth(_value: number): void;
68
- setNumberPlate(_value: string): void;
52
+ setBodyHealth(value: number): void;
53
+ setEngineHealth(value: number): void;
54
+ setNumberPlate(value: string): void;
69
55
  explode(): void;
70
56
  getPedInSeat(seat: number): number;
71
- setUndriveable(_toggle: boolean): void;
57
+ setUndriveable(toggle: boolean): void;
72
58
  get maxNumberOfPassengers(): number;
73
59
  get gear(): number;
74
60
  get speed(): number;
75
61
  get isEngineRunning(): boolean;
76
- setEngineOn(_toggle: boolean, _instantly: boolean, _otherwise: boolean): void;
62
+ setEngineOn(toggle: boolean, instantly: boolean, otherwise: boolean): void;
77
63
  get lightsState(): ILightState;
78
64
  get isLocked(): boolean;
79
- setIsLocked(_value: boolean): void;
65
+ setIsLocked(value: boolean): void;
80
66
  setCustomPrimaryColour(color: IRGB): void;
81
67
  setCustomSecondaryColour(color: IRGB): void;
82
68
  get customPrimaryColour(): IRGB;
@@ -90,20 +76,20 @@ export declare class CCMPVehicle implements IVehicle {
90
76
  get windowTint(): number;
91
77
  setWheelType(wheelType: number): void;
92
78
  get wheelType(): number;
93
- setNumberPlateTextIndex(_index: number): void;
79
+ setNumberPlateTextIndex(index: number): void;
94
80
  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;
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;
103
89
  toggleMod(modType: number, toggle: boolean): void;
104
90
  setTyreSmokeColor(r: number, g: number, b: number): void;
105
91
  setModColor1(paintType: number, color: number, p3: number): void;
106
- setExtraColours(_pearlescentColor: number, _wheelColor: number): void;
92
+ setExtraColours(pearlescentColor: number, wheelColor: number): void;
107
93
  setHeadlightColor(colorIndex: number): void;
108
94
  setDashboardColor(colorIndex: number): void;
109
95
  setInteriorColor(colorIndex: number): void;
@@ -111,9 +97,6 @@ export declare class CCMPVehicle implements IVehicle {
111
97
  getAcceleration(): number;
112
98
  getMaxTraction(): number;
113
99
  getModelMaxSpeed(): number;
114
- private _withHandle;
115
- private _withHandleVoid;
116
- private _setModKit;
100
+ private _normalizeHandle;
117
101
  private _getRemoteVehicleExists;
118
- private _getOffsetFromCachedTransform;
119
102
  }
@@ -1,9 +1,5 @@
1
- /* eslint-disable @typescript-eslint/no-unused-vars */
2
1
  import { BaseObjectType } from "../../../../shared/entities";
3
2
  import { Vector3D } from "../../../../shared/common/utils";
4
- const notImplemented = (memberName) => {
5
- throw new Error(`CCMPVehicle.${memberName}: not implemented`);
6
- };
7
3
  export class CCMPVehicle {
8
4
  constructor(_ccmpVehicle, _onDestroy = () => { }) {
9
5
  this._ccmpVehicle = _ccmpVehicle;
@@ -20,17 +16,14 @@ export class CCMPVehicle {
20
16
  return BaseObjectType.Vehicle;
21
17
  }
22
18
  get isExists() {
23
- var _a;
24
19
  if (this._destroyed)
25
20
  return false;
26
- if (this._ccmpVehicle.isRemote) {
21
+ if (this._ccmpVehicle.isRemote)
27
22
  return this._getRemoteVehicleExists();
28
- }
29
- return !this._destroyed && ((_a = this._ccmpVehicle.isExists) !== null && _a !== void 0 ? _a : this._ccmpVehicle.isAlive);
23
+ return this._ccmpVehicle.isExists;
30
24
  }
31
25
  get handle() {
32
- const handle = Number(this._ccmpVehicle.handle);
33
- return Number.isFinite(handle) && handle > 0 ? Math.trunc(handle) : 0;
26
+ return this._normalizeHandle(this._ccmpVehicle.handle);
34
27
  }
35
28
  destroy() {
36
29
  if (this._destroyed)
@@ -46,14 +39,14 @@ export class CCMPVehicle {
46
39
  get dimension() {
47
40
  return this._ccmpVehicle.dimension;
48
41
  }
49
- setPosition(_value) {
50
- notImplemented("setPosition");
42
+ setPosition(value) {
43
+ this._ccmpVehicle.setPosition(value);
51
44
  }
52
- setDimension(_value) {
53
- notImplemented("setDimension");
45
+ setDimension(value) {
46
+ this._ccmpVehicle.setDimension(value);
54
47
  }
55
- setCoords(_xPos, _yPos, _zPos, _xAxis, _yAxis, _zAxis, _clearArea) {
56
- notImplemented("setCoords");
48
+ setCoords(xPos, yPos, zPos, xAxis, yAxis, zAxis, clearArea) {
49
+ this._ccmpVehicle.setCoords(xPos, yPos, zPos, xAxis, yAxis, zAxis, clearArea);
57
50
  }
58
51
  get model() {
59
52
  return this._ccmpVehicle.model;
@@ -61,332 +54,258 @@ export class CCMPVehicle {
61
54
  get heading() {
62
55
  return this._ccmpVehicle.heading;
63
56
  }
64
- setHeading(_heading) {
65
- notImplemented("setHeading");
57
+ setHeading(heading) {
58
+ this._ccmpVehicle.setHeading(heading);
66
59
  }
67
- setModel(_value) {
68
- notImplemented("setModel");
60
+ setModel(value) {
61
+ this._ccmpVehicle.setModel(value);
69
62
  }
70
63
  get rotation() {
71
64
  const { x, y, z } = this._ccmpVehicle.rotation;
72
65
  return new Vector3D(x, y, z);
73
66
  }
74
67
  get forwardVector() {
75
- const headingRad = (this.heading * Math.PI) / 180;
76
- return new Vector3D(-Math.sin(headingRad), Math.cos(headingRad), 0);
68
+ const { x, y, z } = this._ccmpVehicle.forwardVector;
69
+ return new Vector3D(x, y, z);
77
70
  }
78
- setRotation(_value) {
79
- notImplemented("setRotation");
71
+ setRotation(value) {
72
+ this._ccmpVehicle.setRotation(value);
80
73
  }
81
- freezePosition(_freeze) {
82
- notImplemented("freezePosition");
74
+ freezePosition(freeze) {
75
+ this._ccmpVehicle.freezePosition(freeze);
83
76
  }
84
- setCollision(_collision, _keepPhysics) {
85
- notImplemented("setCollision");
77
+ setCollision(collision, keepPhysics) {
78
+ this._ccmpVehicle.setCollision(collision, keepPhysics);
86
79
  }
87
- setInvincible(_invincible) {
88
- notImplemented("setInvincible");
80
+ setInvincible(invincible) {
81
+ this._ccmpVehicle.setInvincible(invincible);
89
82
  }
90
- setVisible(_visible) {
91
- notImplemented("setVisible");
83
+ setVisible(visible) {
84
+ this._ccmpVehicle.setVisible(visible);
92
85
  }
93
86
  setAlpha(alpha) {
94
- this._withHandleVoid((handle) => {
95
- ccmp.natives.entity.setEntityAlpha(handle, alpha, false);
96
- });
87
+ this._ccmpVehicle.setAlpha(alpha);
97
88
  }
98
89
  get alpha() {
99
- return this._withHandle(255, (handle) => ccmp.natives.entity.getEntityAlpha(handle));
90
+ return this._ccmpVehicle.alpha;
100
91
  }
101
92
  resetAlpha() {
102
- this._withHandleVoid((handle) => {
103
- ccmp.natives.entity.resetEntityAlpha(handle);
104
- });
93
+ this._ccmpVehicle.resetAlpha();
105
94
  }
106
95
  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
- });
96
+ const { x, y, z } = this._ccmpVehicle.getOffsetFromInWorldCoords(offsetX, offsetY, offsetZ);
97
+ return new Vector3D(x, y, z);
111
98
  }
112
99
  getBoneIndexByName(boneName) {
113
- return this._withHandle(-1, (handle) => ccmp.natives.entity.getEntityBoneIndexByName(handle, boneName));
100
+ return this._ccmpVehicle.getBoneIndexByName(boneName);
114
101
  }
115
102
  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
- });
103
+ const { x, y, z } = this._ccmpVehicle.getWorldPositionOfBone(boneIndex);
104
+ return new Vector3D(x, y, z);
120
105
  }
121
106
  getVariable(name) {
122
107
  const remoteId = this.remoteId;
123
- if (remoteId === null) {
108
+ if (remoteId === null)
124
109
  return null;
125
- }
126
110
  const value = ccmp.entities.getStreamSyncedMeta(ccmp.entities.ENTITY_TYPE.Vehicle, remoteId, name);
127
111
  return value === undefined ? null : value;
128
112
  }
129
113
  getSyncedMeta(key) {
130
114
  const remoteId = this.remoteId;
131
- if (remoteId === null) {
115
+ if (remoteId === null)
132
116
  return undefined;
133
- }
134
117
  return ccmp.entities.getStreamSyncedMeta(ccmp.entities.ENTITY_TYPE.Vehicle, remoteId, key);
135
118
  }
136
119
  hasSyncedMeta(key) {
137
120
  const remoteId = this.remoteId;
138
- if (remoteId === null) {
121
+ if (remoteId === null)
139
122
  return false;
140
- }
141
123
  return ccmp.entities.hasStreamSyncedMeta(ccmp.entities.ENTITY_TYPE.Vehicle, remoteId, key);
142
124
  }
143
125
  getSyncedMetaKeys() {
144
126
  const remoteId = this.remoteId;
145
- if (remoteId === null) {
127
+ if (remoteId === null)
146
128
  return [];
147
- }
148
129
  return ccmp.entities.getStreamSyncedMetaKeys(ccmp.entities.ENTITY_TYPE.Vehicle, remoteId);
149
130
  }
150
- attachToEntity(_target, _boneIndex, _offset, _rotation, _p9, _useSoftPinning, _collision, _isPed, _vertexIndex, _fixedRot) {
151
- notImplemented("attachToEntity");
131
+ attachToEntity(target, boneIndex, offset, rotation, p9, useSoftPinning, collision, isPed, vertexIndex, fixedRot) {
132
+ this._ccmpVehicle.attachToEntity(target, boneIndex, offset, rotation, p9, useSoftPinning, collision, isPed, vertexIndex, fixedRot);
152
133
  }
153
- detach(_useDetachVelocity, _collision) {
154
- notImplemented("detach");
134
+ detach(useDetachVelocity, collision) {
135
+ this._ccmpVehicle.detach(useDetachVelocity, collision);
155
136
  }
156
137
  getSpeed() {
157
- return notImplemented("getSpeed");
138
+ return this._ccmpVehicle.getSpeed();
158
139
  }
159
- isPlayingAnim(_dictionary, _name, _taskFlag) {
160
- return notImplemented("isPlayingAnim");
140
+ isPlayingAnim(dictionary, name, taskFlag) {
141
+ return this._ccmpVehicle.isPlayingAnim(dictionary, name, taskFlag);
161
142
  }
162
143
  get bodyHealth() {
163
- return notImplemented("bodyHealth");
144
+ return this._ccmpVehicle.bodyHealth;
164
145
  }
165
146
  get engineHealth() {
166
- return notImplemented("engineHealth");
147
+ return this._ccmpVehicle.engineHealth;
167
148
  }
168
149
  get numberPlate() {
169
- var _a;
170
- return (_a = this._ccmpVehicle.numberPlate) !== null && _a !== void 0 ? _a : this._ccmpVehicle.numberPlateText;
150
+ return this._ccmpVehicle.numberPlate;
171
151
  }
172
152
  get isDead() {
173
- return !this.isExists;
153
+ return this._ccmpVehicle.isDead;
174
154
  }
175
- setBodyHealth(_value) {
176
- notImplemented("setBodyHealth");
155
+ setBodyHealth(value) {
156
+ this._ccmpVehicle.setBodyHealth(value);
177
157
  }
178
- setEngineHealth(_value) {
179
- notImplemented("setEngineHealth");
158
+ setEngineHealth(value) {
159
+ this._ccmpVehicle.setEngineHealth(value);
180
160
  }
181
- setNumberPlate(_value) {
182
- notImplemented("setNumberPlate");
161
+ setNumberPlate(value) {
162
+ this._ccmpVehicle.setNumberPlate(value);
183
163
  }
184
164
  explode() {
185
- notImplemented("explode");
165
+ this._ccmpVehicle.explode();
186
166
  }
187
167
  getPedInSeat(seat) {
188
- return this._withHandle(0, (handle) => ccmp.natives.vehicle.getPedInVehicleSeat(handle, seat, false));
168
+ return this._ccmpVehicle.getPedInSeat(seat);
189
169
  }
190
- setUndriveable(_toggle) {
191
- notImplemented("setUndriveable");
170
+ setUndriveable(toggle) {
171
+ this._ccmpVehicle.setUndriveable(toggle);
192
172
  }
193
173
  get maxNumberOfPassengers() {
194
- return notImplemented("maxNumberOfPassengers");
174
+ return this._ccmpVehicle.maxNumberOfPassengers;
195
175
  }
196
176
  get gear() {
197
- return notImplemented("gear");
177
+ return this._ccmpVehicle.gear;
198
178
  }
199
179
  get speed() {
200
- return notImplemented("speed");
180
+ return this._ccmpVehicle.speed;
201
181
  }
202
182
  get isEngineRunning() {
203
- return notImplemented("isEngineRunning");
183
+ return this._ccmpVehicle.isEngineRunning;
204
184
  }
205
- setEngineOn(_toggle, _instantly, _otherwise) {
206
- notImplemented("setEngineOn");
185
+ setEngineOn(toggle, instantly, otherwise) {
186
+ this._ccmpVehicle.setEngineOn(toggle, instantly, otherwise);
207
187
  }
208
188
  get lightsState() {
209
- return notImplemented("lightsState");
189
+ return this._ccmpVehicle.lightsState;
210
190
  }
211
191
  get isLocked() {
212
- return notImplemented("isLocked");
192
+ return this._ccmpVehicle.isLocked;
213
193
  }
214
- setIsLocked(_value) {
215
- notImplemented("setIsLocked");
194
+ setIsLocked(value) {
195
+ this._ccmpVehicle.setIsLocked(value);
216
196
  }
217
197
  setCustomPrimaryColour(color) {
218
- this._withHandleVoid((handle) => {
219
- ccmp.natives.vehicle.setVehicleCustomPrimaryColour(handle, color.r, color.g, color.b);
220
- });
198
+ this._ccmpVehicle.setCustomPrimaryColour(color);
221
199
  }
222
200
  setCustomSecondaryColour(color) {
223
- this._withHandleVoid((handle) => {
224
- ccmp.natives.vehicle.setVehicleCustomSecondaryColour(handle, color.r, color.g, color.b);
225
- });
201
+ this._ccmpVehicle.setCustomSecondaryColour(color);
226
202
  }
227
203
  get customPrimaryColour() {
228
- return this._withHandle({ r: 0, g: 0, b: 0 }, (handle) => ccmp.natives.vehicle.getVehicleCustomPrimaryColour(handle));
204
+ return this._ccmpVehicle.customPrimaryColour;
229
205
  }
230
206
  get customSecondaryColour() {
231
- return this._withHandle({ r: 0, g: 0, b: 0 }, (handle) => ccmp.natives.vehicle.getVehicleCustomSecondaryColour(handle));
207
+ return this._ccmpVehicle.customSecondaryColour;
232
208
  }
233
209
  setMod(modType, modIndex) {
234
- this._withHandleVoid((handle) => {
235
- this._setModKit(handle);
236
- ccmp.natives.vehicle.setVehicleMod(handle, modType, modIndex, false);
237
- });
210
+ this._ccmpVehicle.setMod(modType, modIndex);
238
211
  }
239
212
  getMod(modType) {
240
- return this._withHandle(-1, (handle) => ccmp.natives.vehicle.getVehicleMod(handle, modType));
213
+ return this._ccmpVehicle.getMod(modType);
241
214
  }
242
215
  getNumMods(modType) {
243
- return this._withHandle(0, (handle) => ccmp.natives.vehicle.getNumVehicleMods(handle, modType));
216
+ return this._ccmpVehicle.getNumMods(modType);
244
217
  }
245
218
  setNeonLightEnabled(index, toggle) {
246
- this._withHandleVoid((handle) => {
247
- ccmp.natives.vehicle.setVehicleNeonEnabled(handle, index, toggle);
248
- });
219
+ this._ccmpVehicle.setNeonLightEnabled(index, toggle);
249
220
  }
250
221
  setNeonLightsColour(color) {
251
- this._withHandleVoid((handle) => {
252
- ccmp.natives.vehicle.setVehicleNeonColour(handle, color.r, color.g, color.b);
253
- });
222
+ this._ccmpVehicle.setNeonLightsColour(color);
254
223
  }
255
224
  setWindowTint(tintType) {
256
- this._withHandleVoid((handle) => {
257
- ccmp.natives.vehicle.setVehicleWindowTint(handle, tintType);
258
- });
225
+ this._ccmpVehicle.setWindowTint(tintType);
259
226
  }
260
227
  get windowTint() {
261
- return this._withHandle(0, (handle) => ccmp.natives.vehicle.getVehicleWindowTint(handle));
228
+ return this._ccmpVehicle.windowTint;
262
229
  }
263
230
  setWheelType(wheelType) {
264
- this._withHandleVoid((handle) => {
265
- ccmp.natives.vehicle.setVehicleWheelType(handle, wheelType);
266
- });
231
+ this._ccmpVehicle.setWheelType(wheelType);
267
232
  }
268
233
  get wheelType() {
269
- return this._withHandle(0, (handle) => ccmp.natives.vehicle.getVehicleWheelType(handle));
234
+ return this._ccmpVehicle.wheelType;
270
235
  }
271
- setNumberPlateTextIndex(_index) {
272
- notImplemented("setNumberPlateTextIndex");
236
+ setNumberPlateTextIndex(index) {
237
+ this._ccmpVehicle.setNumberPlateTextIndex(index);
273
238
  }
274
239
  get numberPlateTextIndex() {
275
- return notImplemented("numberPlateTextIndex");
240
+ return this._ccmpVehicle.numberPlateTextIndex;
276
241
  }
277
- setDoorOpen(_doorIndex, _loose, _openInstantly) {
278
- notImplemented("setDoorOpen");
242
+ setDoorOpen(doorIndex, loose, openInstantly) {
243
+ this._ccmpVehicle.setDoorOpen(doorIndex, loose, openInstantly);
279
244
  }
280
- setDoorShut(_doorIndex, _instantly) {
281
- notImplemented("setDoorShut");
245
+ setDoorShut(doorIndex, instantly) {
246
+ this._ccmpVehicle.setDoorShut(doorIndex, instantly);
282
247
  }
283
- setHandling(_field, _value) {
284
- notImplemented("setHandling");
248
+ setHandling(field, value) {
249
+ this._ccmpVehicle.setHandling(field, value);
285
250
  }
286
- getHandling(_field) {
287
- return notImplemented("getHandling");
251
+ getHandling(field) {
252
+ return this._ccmpVehicle.getHandling(field);
288
253
  }
289
- setEnginePowerMultiplier(_value) {
290
- notImplemented("setEnginePowerMultiplier");
254
+ setEnginePowerMultiplier(value) {
255
+ this._ccmpVehicle.setEnginePowerMultiplier(value);
291
256
  }
292
- setEngineTorqueMultiplier(_value) {
293
- notImplemented("setEngineTorqueMultiplier");
257
+ setEngineTorqueMultiplier(value) {
258
+ this._ccmpVehicle.setEngineTorqueMultiplier(value);
294
259
  }
295
- modifyTopSpeed(_value) {
296
- notImplemented("modifyTopSpeed");
260
+ modifyTopSpeed(value) {
261
+ this._ccmpVehicle.modifyTopSpeed(value);
297
262
  }
298
- setCheatPowerIncrease(_value) {
299
- notImplemented("setCheatPowerIncrease");
263
+ setCheatPowerIncrease(value) {
264
+ this._ccmpVehicle.setCheatPowerIncrease(value);
300
265
  }
301
266
  toggleMod(modType, toggle) {
302
- this._withHandleVoid((handle) => {
303
- this._setModKit(handle);
304
- ccmp.natives.vehicle.toggleVehicleMod(handle, modType, toggle);
305
- });
267
+ this._ccmpVehicle.toggleMod(modType, toggle);
306
268
  }
307
269
  setTyreSmokeColor(r, g, b) {
308
- this._withHandleVoid((handle) => {
309
- ccmp.natives.vehicle.setVehicleTyreSmokeColor(handle, r, g, b);
310
- });
270
+ this._ccmpVehicle.setTyreSmokeColor(r, g, b);
311
271
  }
312
272
  setModColor1(paintType, color, p3) {
313
- this._withHandleVoid((handle) => {
314
- ccmp.natives.vehicle.setVehicleModColor1(handle, paintType, color, p3);
315
- });
273
+ this._ccmpVehicle.setModColor1(paintType, color, p3);
316
274
  }
317
- setExtraColours(_pearlescentColor, _wheelColor) {
318
- notImplemented("setExtraColours");
275
+ setExtraColours(pearlescentColor, wheelColor) {
276
+ this._ccmpVehicle.setExtraColours(pearlescentColor, wheelColor);
319
277
  }
320
278
  setHeadlightColor(colorIndex) {
321
- this._withHandleVoid((handle) => {
322
- ccmp.natives.vehicle.setVehicleXenonLightColorIndex(handle, colorIndex);
323
- });
279
+ this._ccmpVehicle.setHeadlightColor(colorIndex);
324
280
  }
325
281
  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
- });
282
+ this._ccmpVehicle.setDashboardColor(colorIndex);
334
283
  }
335
284
  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
- });
285
+ this._ccmpVehicle.setInteriorColor(colorIndex);
344
286
  }
345
287
  getMaxBraking() {
346
- return notImplemented("getMaxBraking");
288
+ return this._ccmpVehicle.getMaxBraking();
347
289
  }
348
290
  getAcceleration() {
349
- return notImplemented("getAcceleration");
291
+ return this._ccmpVehicle.getAcceleration();
350
292
  }
351
293
  getMaxTraction() {
352
- return notImplemented("getMaxTraction");
294
+ return this._ccmpVehicle.getMaxTraction();
353
295
  }
354
296
  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);
297
+ return this._ccmpVehicle.getModelMaxSpeed();
370
298
  }
371
- _setModKit(handle) {
372
- ccmp.natives.vehicle.setVehicleModKit(handle, 0);
299
+ _normalizeHandle(value) {
300
+ const handle = Number(value);
301
+ return Number.isFinite(handle) && handle > 0 ? Math.trunc(handle) : 0;
373
302
  }
374
303
  _getRemoteVehicleExists() {
375
- var _a;
376
304
  try {
377
- return (_a = this._ccmpVehicle.isExists) !== null && _a !== void 0 ? _a : true;
305
+ return this._ccmpVehicle.isExists;
378
306
  }
379
- catch (_b) {
307
+ catch (_a) {
380
308
  return true;
381
309
  }
382
310
  }
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
311
  }
@@ -32,7 +32,8 @@ export class CCMPVehiclesManager {
32
32
  return this._register(ccmpVehicle);
33
33
  }
34
34
  getDisplayNameFromVehicleModel(modelHash) {
35
- return ccmp.natives.vehicle.getDisplayNameFromVehicleModel(modelHash);
35
+ var _a, _b;
36
+ return (_b = (_a = this._getNativeVehiclesApi()) === null || _a === void 0 ? void 0 : _a.getDisplayNameFromModel(modelHash)) !== null && _b !== void 0 ? _b : "";
36
37
  }
37
38
  syncWithMpPool() {
38
39
  this._pruneDestroyed();