rock-mod
Version:
Rock-Mod is a powerful framework designed for creating and managing mods for Grand Theft Auto (GTA) games.
161 lines (160 loc) • 4.13 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MockVehicle = void 0;
const MockEntity_1 = require("../entity/MockEntity");
const utils_1 = require("../../../../shared/common/utils");
const Math_1 = require("../../../../shared/common/utils/math/Math");
class MockVehicle extends MockEntity_1.MockEntity {
_bodyHealth;
_engineHealth;
_engineOn;
_numberPlate;
_isLocked;
_isDead;
_primaryColor;
_secondaryColor;
_customPrimaryColor;
_customSecondaryColor;
_passengers;
_mods;
_neonEnabled;
_neonColor;
_windowTint;
_wheelType;
_plateType;
get bodyHealth() {
return this._bodyHealth;
}
get engineHealth() {
return this._engineHealth;
}
get engineOn() {
return this._engineOn;
}
get numberPlate() {
return this._numberPlate;
}
get isLocked() {
return this._isLocked;
}
get isDead() {
return this._isDead;
}
get primaryColor() {
return this._primaryColor;
}
get secondaryColor() {
return this._secondaryColor;
}
get customPrimaryColor() {
const { r, g, b, a = 255 } = this._customPrimaryColor;
return new utils_1.RGBA(r, g, b, a);
}
get customSecondaryColor() {
const { r, g, b, a } = this._customSecondaryColor;
return new utils_1.RGBA(r, g, b, a);
}
get neonEnabled() {
return this._neonEnabled;
}
get neonColor() {
return this._neonColor;
}
get windowTint() {
return this._windowTint;
}
get wheelType() {
return this._wheelType;
}
get plateType() {
return this._plateType;
}
get driver() {
for (const passenger of this._passengers.values()) {
if (passenger.seat === 0) {
return passenger;
}
}
return null;
}
get passengers() {
return this._passengers;
}
constructor(options) {
super(options);
this._engineOn = options.engine ?? false;
this._bodyHealth = 1000;
this._engineHealth = 1000;
this._numberPlate = "";
this._isLocked = options.locked ?? false;
this._isDead = false;
this._primaryColor = 0;
this._secondaryColor = 0;
this._customPrimaryColor = new utils_1.RGBA(0, 0, 0);
this._customSecondaryColor = new utils_1.RGBA(0, 0, 0);
this._passengers = new Set();
this._mods = new Map();
this._neonEnabled = false;
this._neonColor = { r: 0, g: 0, b: 0 };
this._windowTint = 0;
this._wheelType = 0;
this._plateType = 0;
}
setBodyHealth(value) {
this._bodyHealth = value;
}
setEngineHealth(value) {
this._engineHealth = (0, Math_1.MathClamp)(value, 0, 1000);
}
setEngineOn(value) {
this._engineOn = value;
}
setNumberPlate(value) {
this._numberPlate = value;
}
setLocked(value) {
this._isLocked = value;
}
setPrimaryColor(value) {
this._primaryColor = value;
}
setSecondaryColor(value) {
this._secondaryColor = value;
}
setCustomPrimaryColor(value) {
this._customPrimaryColor = value;
}
setCustomSecondaryColor(value) {
this._customSecondaryColor = value;
}
setMod(modType, modIndex) {
this._mods.set(modType, modIndex);
}
getMod(modType) {
return this._mods.get(modType) ?? -1;
}
setNeonEnabled(enabled) {
this._neonEnabled = enabled;
}
setNeonColor(r, g, b) {
this._neonColor = { r, g, b };
}
setWindowTint(tintType) {
this._windowTint = tintType;
}
setWheelType(wheelType) {
this._wheelType = wheelType;
}
setPlateType(plateType) {
this._plateType = plateType;
}
explode() {
this.setBodyHealth(0);
this.setEngineHealth(0);
}
repair() {
this.setBodyHealth(1000);
this.setEngineHealth(1000);
}
}
exports.MockVehicle = MockVehicle;