UNPKG

rock-mod

Version:

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

35 lines (34 loc) 1.22 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CCMPPedsManager = void 0; const CCMPEntitiesManager_1 = require("../entity/CCMPEntitiesManager"); const CCMPPed_1 = require("./CCMPPed"); class CCMPPedsManager extends CCMPEntitiesManager_1.CCMPEntitiesManager { constructor() { super({ baseObjectsType: "ped", }); } create(options) { const { model, frozen, invincible = false, placeOnGround, position, rotation, dimension } = options; const extras = { dimension, frozen, invincible, }; if (placeOnGround !== undefined) { extras.placeOnGround = placeOnGround; } const ccmpPed = ccmp.peds.create(ccmp.hash(model), position.x, position.y, position.z, rotation.z, extras); if (!ccmpPed) { throw new Error("CCMPPedsManager.create: ccmp.peds.create failed (server full?)"); } const ped = new CCMPPed_1.CCMPPed({ ccmpPed, onDestroy: (p) => this.unregisterBaseObject(p), }); this.registerBaseObject(ped); return ped; } } exports.CCMPPedsManager = CCMPPedsManager;