UNPKG

rock-mod

Version:

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

59 lines (58 loc) 2.61 kB
import { RageWorldObjectsManager } from "../worldObject/RageWorldObjectsManager"; import { RageCircleColshape } from "./RageCircleColshape"; import { RageCuboidColshape } from "./RageCuboidColshape"; import { RageCylinderColshape } from "./RageCylinderColshape"; import { RageRectangleColshape } from "./RageRectangleColshape"; import { RageSphereColshape } from "./RageSphereColshape"; export class RageColshapesManager extends RageWorldObjectsManager { constructor() { super({ baseObjectsType: "colshape", }); } createCircle(options) { const { range, position, dimension } = options; const { x, y } = position; const mpEntity = mp.colshapes.newCircle(x, y, range, dimension); mpEntity.isExists = () => mp.colshapes.exists(mpEntity); const colshape = new RageCircleColshape({ mpEntity }); this.registerBaseObject(colshape); return colshape; } createCuboid(options) { const { width, depth, height, position, dimension } = options; const { x, y, z } = position; const mpEntity = mp.colshapes.newCuboid(x, y, z, width, depth, height, dimension); mpEntity.isExists = () => mp.colshapes.exists(mpEntity); const colshape = new RageCuboidColshape({ mpEntity }); this.registerBaseObject(colshape); return colshape; } createCylinder(options) { const { height, range, position, dimension } = options; const { x, y, z } = position; const mpEntity = mp.colshapes.newTube(x, y, z, height, range, dimension); mpEntity.isExists = () => mp.colshapes.exists(mpEntity); const colshape = new RageCylinderColshape({ mpEntity }); this.registerBaseObject(colshape); return colshape; } createRectangle(options) { const { width, height, position, dimension } = options; const { x, y } = position; const mpEntity = mp.colshapes.newRectangle(x, y, width, height, dimension); mpEntity.isExists = () => mp.colshapes.exists(mpEntity); const colshape = new RageRectangleColshape({ mpEntity }); this.registerBaseObject(colshape); return colshape; } createSphere(options) { const { range, position, dimension } = options; const { x, y, z } = position; const mpEntity = mp.colshapes.newSphere(x, y, z, range, dimension); mpEntity.isExists = () => mp.colshapes.exists(mpEntity); const colshape = new RageSphereColshape({ mpEntity }); this.registerBaseObject(colshape); return colshape; } }