import type { Entity } from '../classes/Entity'; import { Vector2 } from '../types/Vector2'; import { Vector3 } from '../types/Vector3'; import { Vector4 } from '../types/Vector4'; import { Color } from '../types/Color'; import { createFromHandle } from '../types/HandleRegistry'; import { inv, rai, raf, ras, rav, pvi, pvf, pvv, pvii, pvfi, _h, f, int, uint, float, Hash, u8, u16, u32, u64, i8, i16, i32, i64 } from '../types/NativeAliases'; export class Decorator { /** * @param entity * @param propertyName * @param value * @returns */ static decorSetFloat(entity: Entity, propertyName: string, value: float): boolean { return !!inv('0x238F8B0C1C7FE834', entity.handle, propertyName, f(value), rai()); } /** * @param entity * @param propertyName * @returns */ static decorGetFloat(entity: Entity, propertyName: string): float { return inv('0xE5FF70CD842CA9D4', entity.handle, propertyName, raf()); } /** * @param propertyName * @param type * @param p2 */ static decorRegister2(propertyName: string, type: int, p2: boolean): void { inv('0x4587374F88B7F6C2', propertyName, type, p2); } /** * Returns whether or not the specified property is set for the entity. * * @param entity * @param propertyName * @returns */ static decorExistOn(entity: Entity, propertyName: string): boolean { return !!inv('0xD9D1CDBF3464DCDF', entity.handle, propertyName, rai()); } /** * @param entity * @param propertyName * @param value * @returns */ static decorSetUint8(entity: Entity, propertyName: string, value: int): boolean { return !!inv('0x4BDC83150D43772D', entity.handle, propertyName, value, rai()); } /** * Sets property to int. * * @param entity * @param propertyName * @param value * @returns */ static decorSetInt(entity: Entity, propertyName: string, value: int): boolean { return !!inv('0xE88F4D7F52A6090F', entity.handle, propertyName, value, rai()); } /** * type: see DECOR_REGISTER * * @param propertyName * @param type * @returns */ static decorIsRegisteredAsType(propertyName: string, type: int): boolean { return !!inv('0x72355278C069F272', propertyName, type, rai()); } /** * @param entity * @param propertyName * @returns */ static decorGetBool(entity: Entity, propertyName: string): boolean { return !!inv('0xDEF3F1B071ABB197', entity.handle, propertyName, rai()); } /** * @param entity * @param propertyName * @returns */ static decorGetInt(entity: Entity, propertyName: string): int { return inv('0x44DB62727762FD9B', entity.handle, propertyName, rai()); } /** * @param entity * @param propertyName * @returns */ static decorRemove(entity: Entity, propertyName: string): boolean { return !!inv('0x2BA7F5877A088A1D', entity.handle, propertyName, rai()); } /** * @param entity * @param propertyName * @returns */ static decorGetUint8(entity: Entity, propertyName: string): int { return inv('0xB1682B2443F0540B', entity.handle, propertyName, rai()); } /** * @param entity * @returns */ static decorRemoveAll(entity: Entity): boolean { return !!inv('0x88942780E0ADEA42', entity.handle, rai()); } /** * @param entity * @param propertyName * @param value * @returns */ static decorSetString(entity: Entity, propertyName: string, value: string): boolean { return !!inv('0x0671C1A3FF7AFDFC', entity.handle, propertyName, value, rai()); } /** * @param propertyName * @param type */ static decorRegister(propertyName: string, type: int): void { inv('0x0B253D644E3C36B3', propertyName, type); } /** * This function sets metadata of type bool to specified entity. * * @param entity * @param propertyName * @param value * @returns */ static decorSetBool(entity: Entity, propertyName: string, value: boolean): boolean { return !!inv('0xFE26E4609B1C3772', entity.handle, propertyName, value, rai()); } }