UNPKG

rock-mod

Version:

Rock-Mod is a powerful framework designed for creating and managing mods for Grand Theft Auto (GTA) games.

86 lines (85 loc) 2.41 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CCMPMarker = void 0; const CCMPWorldObject_1 = require("../worldObject/CCMPWorldObject"); const shared_1 = require("../../../../shared"); const Vectors_1 = require("../../../../shared/common/utils/math/Vectors"); const RGBA_1 = require("../../../../shared/common/utils/color/RGBA"); class CCMPMarker extends CCMPWorldObject_1.CCMPWorldObject { _ccmpMarker; _onDestroy; get id() { return this._ccmpMarker.id; } get type() { return shared_1.BaseObjectType.Marker; } get isExists() { return this._ccmpMarker.isExists; } get position() { const p = this._ccmpMarker.position; return new Vectors_1.Vector3D(p.x, p.y, p.z); } get dimension() { return this._ccmpMarker.dimension; } get markerType() { return this._ccmpMarker.type; } get visible() { return this._ccmpMarker.visible; } get scale() { return this._ccmpMarker.scale; } get color() { const c = this._ccmpMarker.color; return new RGBA_1.RGBA(c.r, c.g, c.b, c.a); } get rotation() { const r = this._ccmpMarker.rotation; return new Vectors_1.Vector3D(r.x, r.y, r.z); } constructor(options) { super(); this._ccmpMarker = options.ccmpMarker; this._onDestroy = options.onDestroy; } destroy() { if (!this._ccmpMarker.isExists) return; this._ccmpMarker.destroy(); this._onDestroy(this); } setPosition(value) { this._ccmpMarker.position = { x: value.x, y: value.y, z: value.z }; } setDimension(value) { this._ccmpMarker.dimension = value; } getNetData(name) { return this._ccmpMarker.getStreamSyncedMeta(name); } setNetData(name, value) { this._ccmpMarker.setStreamSyncedMeta(name, value); } setVisible(value) { this._ccmpMarker.visible = value; } setScale(value) { this._ccmpMarker.scale = value; } setColor(value) { this._ccmpMarker.color = { r: value.r, g: value.g, b: value.b, a: value.a ?? 255, }; } setRotation(value) { this._ccmpMarker.rotation = { x: value.x, y: value.y, z: value.z }; } } exports.CCMPMarker = CCMPMarker;