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 Builtin { /** * Old name: _LOG10 * * @param value * @returns */ static log10(value: float): float { return inv('0xE816E655DE37FE20', f(value), raf()); } /** * Calculates distance between vectors but does not perform Sqrt operations. (Its way faster) * The value returned will be in RAGE units. * * @param pos1 * @param pos2 * @returns */ static vdist2(pos1: Vector3, pos2: Vector3): float { return inv('0xB7A628320EFF8E47', f(pos1.x), f(pos1.y), f(pos1.z), f(pos2.x), f(pos2.y), f(pos2.z), raf()); } /** * @returns */ static timerb(): int { return inv('0xC9D9444186B5A374', rai()); } /** * @param value * @param bitShift * @returns */ static shiftRight(value: int, bitShift: int): int { return inv('0x97EF1E5BCE9DC075', value, bitShift, rai()); } /** * Gets the current frame time. * * @returns */ static timestep(): float { return inv('0x0000000050597EE2', raf()); } /** * @param value * @returns */ static sin(value: float): float { return inv('0x0BADBFA3B172435F', f(value), raf()); } /** * @param value * @returns */ static sqrt(value: float): float { return inv('0x71D93B57D07F9804', f(value), raf()); } /** * @param value * @returns */ static round(value: float): int { return inv('0xF2DB717A73826179', f(value), rai()); } /** * @param value * @returns */ static cos(value: float): float { return inv('0xD0FFB162F40A139C', f(value), raf()); } /** * @param value * @param bitShift * @returns */ static shiftLeft(value: int, bitShift: int): int { return inv('0xEDD95A39E5544DE8', value, bitShift, rai()); } /** * @param value * @returns */ static toFloat(value: int): float { return inv('0xBBDA792448DB5A89', value, raf()); } /** * @param value */ static settimerb(value: int): void { inv('0x5AE11BC36633DE4E', value); } /** * Rounds a float value up to the next whole number * * @param value * @returns */ static ceil(value: float): int { return inv('0x11E019C8F43ACC8A', f(value), rai()); } /** * Calculates the magnitude of a vector but does not perform Sqrt operations. (Its way faster) * * @param pos * @returns */ static vmag2(pos: Vector3): float { return inv('0xA8CEACB4F35AE058', f(pos.x), f(pos.y), f(pos.z), raf()); } /** * Counts up. Every 1000 is 1 real-time second. Use SETTIMERA(int value) to set the timer (e.g.: SETTIMERA(0)). * * @returns */ static timera(): int { return inv('0x83666F9FB8FEBD4B', rai()); } /** * THREAD_PRIO_HIGHEST = 0 * THREAD_PRIO_NORMAL = 1 * THREAD_PRIO_LOWEST = 2 * THREAD_PRIO_MANUAL_UPDATE = 100 * * @param priority */ static setThisThreadPriority(priority: int): void { inv('0x42B65DEEF2EDF2A1', priority); } /** * @param value */ static settimera(value: int): void { inv('0xC1B1E9A034A63A62', value); } /** * Calculates distance between vectors. * The value returned will be in meters. * * @param pos1 * @param pos2 * @returns */ static vdist(pos1: Vector3, pos2: Vector3): float { return inv('0x2A488C176D52CCA5', f(pos1.x), f(pos1.y), f(pos1.z), f(pos2.x), f(pos2.y), f(pos2.z), raf()); } /** * @param base * @param exponent * @returns */ static pow(base: float, exponent: float): float { return inv('0xE3621CC40F31FE2E', f(base), f(exponent), raf()); } /** * Rounds a float value down to the next whole number * * @param value * @returns */ static floor(value: float): int { return inv('0xF34EE736CF047844', f(value), rai()); } /** * Calculates the magnitude of a vector. * * @param pos * @returns */ static vmag(pos: Vector3): float { return inv('0x652D2EEEF1D3E62C', f(pos.x), f(pos.y), f(pos.z), raf()); } /** * @param ms */ static wait(ms: int): void { inv('0x4EDE34FBADD967A6', ms); } }