rock-mod
Version:
Rock-Mod is a powerful framework designed for creating and managing mods for Grand Theft Auto (GTA) games.
133 lines (132 loc) • 4.82 kB
JavaScript
import { RageEntity } from "../entity/RageEntity";
import { RockMod } from "../../../RockMod";
import { Vector3D } from "../../../../shared/common/utils";
export class RagePlayer extends RageEntity {
get name() {
return this.mpEntity.name;
}
get health() {
return this.mpEntity.health;
}
get armour() {
return this.mpEntity.armour;
}
get isDead() {
return this.mpEntity.health <= 0;
}
constructor(options) {
super(options);
}
get vehicle() {
const vehicle = this.mpEntity.vehicle;
if (!vehicle) {
return null;
}
return RockMod.instance.vehicles.getByID(vehicle.id);
}
get isVoice3DEnabled() {
return Boolean(this.mpEntity.voice3d);
}
get voiceVolume() {
return this.mpEntity.voiceVolume;
}
get isVoiceActive() {
return this.mpEntity.isVoiceActive;
}
setVoice3D(enable) {
this.mpEntity.voice3d = enable;
}
setVoiceVolume(volume) {
this.mpEntity.voiceVolume = volume;
}
get isReloading() {
return this.mpEntity.isReloading();
}
get weapon() {
return this.mpEntity.weapon;
}
getAmmoInClip(weapon) {
return this.mpEntity.getAmmoInClip(weapon);
}
getWeaponAmmo(weapon) {
return mp.game.weapon.getAmmoInPed(this.mpEntity.handle, weapon);
}
getBoneIndex(boneId) {
return this.mpEntity.getBoneIndex(boneId);
}
setDecoration(collection, overlay) {
const collectionHash = mp.game.joaat(collection);
const overlayHash = mp.game.joaat(overlay);
this.mpEntity.setDecoration(collectionHash, overlayHash);
}
removeDecoration(collection, overlay) {
const collectionHash = mp.game.joaat(collection);
const overlayHash = mp.game.joaat(overlay);
// @ts-expect-error TODO test if this works
this.mpEntity.removeDecoration(collectionHash, overlayHash);
}
clearDecorations() {
this.mpEntity.clearDecorations();
}
setHeadBlendData(shapeFirstId, shapeSecondId, shapeThirdId, skinFirstId, skinSecondId, skinThirdId, shapeMix, skinMix, thirdMix, isParent) {
this.mpEntity.setHeadBlendData(shapeFirstId, shapeSecondId, shapeThirdId, skinFirstId, skinSecondId, skinThirdId, shapeMix, skinMix, thirdMix, isParent);
}
setFaceFeature(index, value) {
this.mpEntity.setFaceFeature(index, value);
}
setHeadOverlay(overlayId, index, opacity, firstColor, secondColor) {
this.mpEntity.setHeadOverlay(overlayId, index, opacity, firstColor, secondColor);
}
setHeadOverlayColor(overlayId, colorTypeId, firstColor, secondColor) {
this.mpEntity.setHeadOverlayColor(overlayId, colorTypeId, firstColor, secondColor);
}
setEyeColor(eyeColor) {
this.mpEntity.setEyeColor(eyeColor);
}
setHairColor(colorId, highlightColorId) {
this.mpEntity.setHairColor(colorId, highlightColorId);
}
setComponentVariation(componentId, drawableId, textureId, paletteId) {
this.mpEntity.setComponentVariation(componentId, drawableId, textureId, paletteId);
}
setPropertyVariation(componentId, drawableId, textureId, attach) {
this.mpEntity.setPropIndex(componentId, drawableId, textureId, attach);
}
clearProp(componentId) {
this.mpEntity.clearProp(componentId);
}
get isLocalPlayer() {
return mp.players.local.id === this.mpEntity.id;
}
clearTasks() {
this.mpEntity.clearTasks();
}
clearTasksImmediately() {
mp.game.task.clearPedTasksImmediately(this.handle);
}
stopAnim(dictionary, name, blendOutSpeed) {
mp.game.task.stopAnimTask(this.handle, dictionary, name, blendOutSpeed);
}
resetMovementClipset(blendDuration) {
this.mpEntity.resetMovementClipset(blendDuration);
}
setMovementClipset(clipset, speed) {
this.mpEntity.setMovementClipset(clipset, speed);
}
taskEnterVehicle(vehicleHandle, timeout, seat, speed, flag, p6) {
this.mpEntity.taskEnterVehicle(vehicleHandle, timeout, seat, speed, flag, p6);
}
taskPlayAnim(dictionary, name, blendInSpeed, blendOutSpeed, duration, flag, playbackRate, lockX, lockY, lockZ) {
this.mpEntity.taskPlayAnim(dictionary, name, blendInSpeed, blendOutSpeed, duration, flag, playbackRate, lockX, lockY, lockZ);
}
taskSwapWeapon() {
this.mpEntity.taskSwapWeapon(true);
}
getBoneCoords(boneId, offsetX, offsetY, offsetZ) {
const { x, y, z } = this.mpEntity.getBoneCoords(boneId, offsetX, offsetY, offsetZ);
return new Vector3D(x, y, z);
}
setNoCollision(otherHandle, thisFrameOnly) {
this.mpEntity.setNoCollision(otherHandle, thisFrameOnly);
}
}