import type { Entity } from '../classes/Entity'; import type { Ped } from '../classes/Ped'; 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 Water { /** * Only used in native_son1 R* Script: p1 = 1 * * @param entity * @param p1 */ static N_0x0DCEC6A92E497E17(entity: Entity, p1: int): void { inv('0x0DCEC6A92E497E17', entity.handle, p1); } /** * Only used in fishing_core R* Script * * @param ped */ static N_0xF0FBF193F1F5C0EA(ped: Ped): void { inv('0xF0FBF193F1F5C0EA', ped.handle); } /** * enum eScriptWaterTestResult * { * SCRIPT_WATER_TEST_RESULT_NONE, * SCRIPT_WATER_TEST_RESULT_WATER, * SCRIPT_WATER_TEST_RESULT_BLOCKED, * }; * * @param pos1 * @param pos2 * @param flags * @returns intersectionPos */ static testProbeAgainstAllWater(pos1: Vector3, pos2: Vector3, flags: int): [int, Vector3] { const result = inv<[number, number[]]>('0x8974647ED222EA5F', f(pos1.x), f(pos1.y), f(pos1.z), f(pos2.x), f(pos2.y), f(pos2.z), flags, pvv(), rai()); return [result[0], Vector3.fromArray(result[1])]; } /** * Only used in R* Script guama1 this native allows to modify the ocean water in the guarma island. wave direction accepts 0, 1 and 2 values. * * @param wavesHeight * @param p1 * @param waveDirection * @param p3 * @param waveAmmount * @param p5 * @param waveSpeed * @param wavesStrength * @param p8 */ static setOceanGuarmaWaterQuadrant(wavesHeight: float, p1: float, waveDirection: int, p3: float, waveAmmount: float, p5: float, waveSpeed: float, wavesStrength: float, p8: int): void { inv('0xC63540AEF8384732', f(wavesHeight), f(p1), waveDirection, f(p3), f(waveAmmount), f(p5), f(waveSpeed), f(wavesStrength), p8); } /** * Checks against a global variable that is set by _SET_WORLD_WATER_TYPE. If it's set to 1 (Guarma) it will fail. See TEST_PROBE_AGAINST_ALL_WATER. * * @param pos * @param flags * @returns waterHeight */ static testVerticalProbeAgainstAllWater(pos: Vector3, flags: int): [int, number] { const result = inv<[number, number]>('0x2B3451FA1E3142E2', f(pos.x), f(pos.y), f(pos.z), flags, pvf(), rai()); return [result[0], result[1]]; } /** * Only used in fussar1 / train_robbery2 R* Script */ static N_0xE8126623008372AA(): void { inv('0xE8126623008372AA'); } /** * Only used in guama1 / guama3 R* Script * *REQUEST** or *RESET** */ static resetGuarmaWaterState(): void { inv('0xC63540AEF8384769'); } /** * Called together with REMOVE_EXTRA_CALMING_QUAD in rcm_crackpot1 R* Script: p0 = 0 * *REMOVE** * * @param p0 */ static N_0x09A1C7DFDCE54FBC(p0: int): void { inv('0x09A1C7DFDCE54FBC', p0); } /** * Only used in rcm_crackpot1 R* Script: p0 = 0 * * @param index */ static removeExtraCalmingQuad(index: int): void { inv('0x4BEF8DD75AF6C71C', index); } /** * 0 = World * 1 = Guarma * * @param waterType */ static setWorldWaterType(waterType: int): void { inv('0xE8770EE02AEE45C2', waterType); } /** * Must be called every frame to take full effect. */ static disableWaterLookup(): void { inv('0x754616EC6965D1FB'); } /** * @returns */ static getWorldWaterType(): int { return inv('0x189739A7631C1867', rai()); } /** * @param pos * @returns height */ static getWaterHeightNoWaves(pos: Vector3): [boolean, number] { const result = inv<[boolean, number]>('0xDCF3690AA262C03F', f(pos.x), f(pos.y), f(pos.z), pvf(), rai()); return [!!result[0], result[1]]; } /** * Used in bounty1, fanale3, sean1 R* Scripts * * @param entity */ static N_0xB34A6009A0DB80B8(entity: Entity): void { inv('0xB34A6009A0DB80B8', entity.handle); } static enableWaterLookup(): void { inv('0x754616EC6965D1BF'); } /** * Checks against a global variable that is set by _SET_WORLD_WATER_TYPE. If that is set to one it will fail. Likely not the only issue but part of it. * * @param pos * @returns height */ static getWaterHeight(pos: Vector3): [boolean, number] { const result = inv<[boolean, number]>('0xFCA8B23F28813F69', f(pos.x), f(pos.y), f(pos.z), pvf(), rai()); return [!!result[0], result[1]]; } /** * Only used in fishing_core R* Script */ static N_0xA33F5069B0CB89B8(): void { inv('0xA33F5069B0CB89B8'); } }