rock-mod
Version:
Rock-Mod is a powerful framework designed for creating and managing mods for Grand Theft Auto (GTA) games.
199 lines (198 loc) • 6.89 kB
JavaScript
import { BaseObjectType } from "../../../../shared/entities";
import { Vector3D } from "../../../../shared/common/utils";
export class CCMPPed {
constructor(_ccmpPed, _onDestroy = () => { }) {
this._ccmpPed = _ccmpPed;
this._onDestroy = _onDestroy;
this._destroyed = false;
}
get id() {
return this._ccmpPed.id;
}
get remoteId() {
return this._ccmpPed.remoteId;
}
get type() {
return BaseObjectType.Ped;
}
get isExists() {
return !this._destroyed && this._ccmpPed.isAlive;
}
get handle() {
return this._ccmpPed.handle;
}
destroy() {
if (this._destroyed) {
return;
}
this._destroyed = true;
this._ccmpPed.destroy();
this._onDestroy(this);
}
get position() {
const { x, y, z } = this._ccmpPed.position;
return new Vector3D(x, y, z);
}
get dimension() {
return this._ccmpPed.dimension;
}
setPosition(value) {
this._ccmpPed.setPosition(value);
}
setDimension(value) {
this._ccmpPed.setDimension(value);
}
setCoords(xPos, yPos, zPos, xAxis, yAxis, zAxis, clearArea) {
this._ccmpPed.setCoords(xPos, yPos, zPos, xAxis, yAxis, zAxis, clearArea);
}
get model() {
return this._ccmpPed.model;
}
get heading() {
return this._ccmpPed.heading;
}
setHeading(heading) {
this._ccmpPed.setHeading(heading);
}
setModel(value) {
this._ccmpPed.setModel(value);
}
get rotation() {
return new Vector3D(0, 0, this._ccmpPed.heading);
}
setRotation(value) {
this._ccmpPed.setRotation(value);
}
get forwardVector() {
const { x, y, z } = this._ccmpPed.forwardVector;
return new Vector3D(x, y, z);
}
freezePosition(freeze) {
this._ccmpPed.freezePosition(freeze);
}
setCollision(collision, keepPhysics) {
this._ccmpPed.setCollision(collision, keepPhysics);
}
setInvincible(invincible) {
this._ccmpPed.setInvincible(invincible);
}
setVisible(visible) {
this._ccmpPed.setVisible(visible);
}
setAlpha(alpha) {
this._ccmpPed.setAlpha(alpha);
}
get alpha() {
return this._ccmpPed.alpha;
}
resetAlpha() {
this._ccmpPed.resetAlpha();
}
getOffsetFromInWorldCoords(offsetX, offsetY, offsetZ) {
const { x, y, z } = this._ccmpPed.getOffsetFromInWorldCoords(offsetX, offsetY, offsetZ);
return new Vector3D(x, y, z);
}
getBoneIndexByName(boneName) {
return this._ccmpPed.getBoneIndexByName(boneName);
}
getWorldPositionOfBone(boneIndex) {
const { x, y, z } = this._ccmpPed.getWorldPositionOfBone(boneIndex);
return new Vector3D(x, y, z);
}
getVariable(name) {
const remoteId = this.remoteId;
if (remoteId === null) {
return null;
}
const value = ccmp.entities.getStreamSyncedMeta(ccmp.entities.ENTITY_TYPE.Ped, 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.Ped, remoteId, key);
}
hasSyncedMeta(key) {
const remoteId = this.remoteId;
if (remoteId === null) {
return false;
}
return ccmp.entities.hasStreamSyncedMeta(ccmp.entities.ENTITY_TYPE.Ped, remoteId, key);
}
getSyncedMetaKeys() {
const remoteId = this.remoteId;
if (remoteId === null) {
return [];
}
return ccmp.entities.getStreamSyncedMetaKeys(ccmp.entities.ENTITY_TYPE.Ped, remoteId);
}
attachToEntity(target, boneIndex, offset, rotation, p9, useSoftPinning, collision, isPed, vertexIndex, fixedRot) {
this._ccmpPed.attachToEntity(target, boneIndex, offset, rotation, p9, useSoftPinning, collision, isPed, vertexIndex, fixedRot);
}
detach(useDetachVelocity, collision) {
this._ccmpPed.detach(useDetachVelocity, collision);
}
getSpeed() {
return this._ccmpPed.getSpeed();
}
isPlayingAnim(dictionary, name, taskFlag) {
return this._ccmpPed.isPlayingAnim(dictionary, name, taskFlag);
}
setDecoration(collection, overlay) {
this._ccmpPed.setDecoration(collection, overlay);
}
removeDecoration(collection, overlay) {
this._ccmpPed.removeDecoration(collection, overlay);
}
clearDecorations() {
this._ccmpPed.clearDecorations();
}
setHeadBlendData(shapeFirstId, shapeSecondId, shapeThirdId, skinFirstId, skinSecondId, skinThirdId, shapeMix, skinMix, thirdMix, isParent) {
this._ccmpPed.setHeadBlendData(shapeFirstId, shapeSecondId, shapeThirdId, skinFirstId, skinSecondId, skinThirdId, shapeMix, skinMix, thirdMix, isParent);
}
setFaceFeature(index, value) {
this._ccmpPed.setFaceFeature(index, value);
}
setHeadOverlay(overlayId, index, opacity) {
this._ccmpPed.setHeadOverlay(overlayId, index, opacity);
}
setHeadOverlayColor(overlayId, colorTypeId, firstColor, secondColor) {
this._ccmpPed.setHeadOverlayColor(overlayId, colorTypeId, firstColor, secondColor);
}
setEyeColor(eyeColor) {
this._ccmpPed.setEyeColor(eyeColor);
}
setHairColor(colorId, highlightColorId) {
this._ccmpPed.setHairColor(colorId, highlightColorId);
}
setComponentVariation(componentId, drawableId, textureId, paletteId) {
this._ccmpPed.setComponentVariation(componentId, drawableId, textureId, paletteId);
}
setPropertyVariation(componentId, drawableId, textureId, attach) {
this._ccmpPed.setPropertyVariation(componentId, drawableId, textureId, attach);
}
clearProp(componentId) {
this._ccmpPed.clearProp(componentId);
}
getBoneCoords(boneId, offsetX, offsetY, offsetZ) {
const { x, y, z } = this._ccmpPed.getBoneCoords(boneId, offsetX, offsetY, offsetZ);
return new Vector3D(x, y, z);
}
clearTasks() {
this._ccmpPed.clearTasks();
}
taskPlayAnim(dictionary, name, blendInSpeed, blendOutSpeed, duration, flag, playbackRate) {
this._ccmpPed.taskPlayAnim(dictionary, name, blendInSpeed, blendOutSpeed, duration, flag, playbackRate);
}
taskGoToCoordAnyMeans(x, y, z, speed, walkingStyle, drivingFlags) {
this._ccmpPed.taskGoToCoordAnyMeans(x, y, z, speed, walkingStyle, drivingFlags);
}
stopAnim(dictionary, name, blendOutSpeed) {
this._ccmpPed.stopAnim(dictionary, name, blendOutSpeed);
}
setBlockingOfNonTemporaryEvents(blocking) {
this._ccmpPed.setBlockingOfNonTemporaryEvents(blocking);
}
}