rock-mod
Version:
Rock-Mod is a powerful framework designed for creating and managing mods for Grand Theft Auto (GTA) games.
83 lines (82 loc) • 2.48 kB
JavaScript
import { BaseObjectType } from "../../../../shared/entities";
import { Vector3D } from "../../../../shared/common/utils";
const notImplemented = (memberName) => {
throw new Error(`CCMPColshape.${memberName}: not implemented`);
};
export class CCMPColshape {
constructor(_ccmpColshape, _onDestroy = () => { }) {
this._ccmpColshape = _ccmpColshape;
this._onDestroy = _onDestroy;
this._destroyed = false;
}
get id() {
return this._ccmpColshape.id;
}
get remoteId() {
return this._ccmpColshape.remoteId;
}
get type() {
return BaseObjectType.Colshape;
}
get isExists() {
return !this._destroyed && this._ccmpColshape.isExists;
}
get handle() {
return 0;
}
destroy() {
if (this._destroyed)
return;
this._destroyed = true;
this._ccmpColshape.destroy();
this._onDestroy(this);
}
get position() {
const { x, y, z } = this._ccmpColshape.position;
return new Vector3D(x, y, z);
}
get dimension() {
return this._ccmpColshape.dimension;
}
get key() {
return this._ccmpColshape.key;
}
setPosition(_value) {
notImplemented("setPosition");
}
setDimension(_value) {
notImplemented("setDimension");
}
setCoords(_xPos, _yPos, _zPos, _xAxis, _yAxis, _zAxis, _clearArea) {
notImplemented("setCoords");
}
getVariable(name) {
const remoteId = this.remoteId;
if (remoteId === null) {
return null;
}
const value = ccmp.entities.getStreamSyncedMeta(ccmp.entities.ENTITY_TYPE.Colshape, remoteId, name);
return value === undefined ? null : value;
}
getSyncedMeta(key) {
const remoteId = this.remoteId;
if (remoteId === null) {
return undefined;
}
return ccmp.entities.getStreamSyncedMeta(ccmp.entities.ENTITY_TYPE.Colshape, remoteId, key);
}
hasSyncedMeta(key) {
const remoteId = this.remoteId;
if (remoteId === null) {
return false;
}
return ccmp.entities.hasStreamSyncedMeta(ccmp.entities.ENTITY_TYPE.Colshape, remoteId, key);
}
getSyncedMetaKeys() {
const remoteId = this.remoteId;
if (remoteId === null) {
return [];
}
return ccmp.entities.getStreamSyncedMetaKeys(ccmp.entities.ENTITY_TYPE.Colshape, remoteId);
}
}