rock-mod
Version:
Rock-Mod is a powerful framework designed for creating and managing mods for Grand Theft Auto (GTA) games.
122 lines (121 loc) • 3.32 kB
JavaScript
import { BaseObjectType } from "../../../../shared/entities";
import { Vector3D } from "../../../../shared/common/utils";
const notImplemented = (memberName) => {
throw new Error(`CCMPBlip.${memberName}: not implemented`);
};
export class CCMPBlip {
constructor(_ccmpBlip, _onDestroy = () => { }) {
this._ccmpBlip = _ccmpBlip;
this._onDestroy = _onDestroy;
this._destroyed = false;
}
get id() {
return this._ccmpBlip.id;
}
get remoteId() {
return this._ccmpBlip.remoteId;
}
get type() {
return BaseObjectType.Blip;
}
get isExists() {
return !this._destroyed && this._ccmpBlip.isExists;
}
get handle() {
return this._ccmpBlip.handle;
}
destroy() {
if (this._destroyed)
return;
this._destroyed = true;
this._ccmpBlip.destroy();
this._onDestroy(this);
}
get position() {
const { x, y, z } = this._ccmpBlip.position;
return new Vector3D(x, y, z);
}
get dimension() {
return this._ccmpBlip.dimension;
}
setPosition(_value) {
notImplemented("setPosition");
}
setDimension(_value) {
notImplemented("setDimension");
}
setCoords(_xPos, _yPos, _zPos, _xAxis, _yAxis, _zAxis, _clearArea) {
notImplemented("setCoords");
}
get name() {
return this._ccmpBlip.name;
}
get sprite() {
return this._ccmpBlip.sprite;
}
get color() {
return this._ccmpBlip.color;
}
get alpha() {
return this._ccmpBlip.alpha;
}
get scale() {
return this._ccmpBlip.scale;
}
get drawDistance() {
return this._ccmpBlip.drawDistance;
}
get global() {
return this._ccmpBlip.global;
}
get shortRange() {
return this._ccmpBlip.shortRange;
}
get rotation() {
return this._ccmpBlip.rotation;
}
getVariable(name) {
const remoteId = this.remoteId;
if (remoteId === null) {
return null;
}
const value = ccmp.entities.getStreamSyncedMeta(ccmp.entities.ENTITY_TYPE.Blip, 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.Blip, remoteId, key);
}
hasSyncedMeta(key) {
const remoteId = this.remoteId;
if (remoteId === null) {
return false;
}
return ccmp.entities.hasStreamSyncedMeta(ccmp.entities.ENTITY_TYPE.Blip, remoteId, key);
}
getSyncedMetaKeys() {
const remoteId = this.remoteId;
if (remoteId === null) {
return [];
}
return ccmp.entities.getStreamSyncedMetaKeys(ccmp.entities.ENTITY_TYPE.Blip, remoteId);
}
setSprite(_value) {
notImplemented("setSprite");
}
setColor(_value) {
notImplemented("setColor");
}
setAlpha(_value) {
notImplemented("setAlpha");
}
setShowHeadingIndicator(_value) {
notImplemented("setShowHeadingIndicator");
}
setRotation(_value) {
notImplemented("setRotation");
}
}