import type { eVehicleSeat } from '../enums/eVehicleSeat'; import { Vector2 } from '../types/Vector2'; import { Vector3 } from '../types/Vector3'; import { Vector4 } from '../types/Vector4'; import { Color } from '../types/Color'; import { BaseTask } from './BaseTask'; import type { Vehicle } from './Vehicle'; 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 VehicleTask extends BaseTask { constructor(entity: Vehicle) { super(entity); } /** * @param p1 */ everyoneLeaveVehicleInOrder(p1: boolean): void { inv('0x6F1C49F275BD25B3', this.entity.handle, p1); } /** * Vehicle Auto Drive (?) * p1/p2/p3: usually 1f, 1f, 0f or 0f, 0f, 0f * Speed: usually 8f * Types: 1148979456 (task with flee), 1148979587 (dismissing the vehicle) * * @param p1 * @param p2 * @param p3 * @param speed * @param type */ vehicleFleeOnCleanup(p1: float, p2: float, p3: float, speed: float, type: string | number): void { inv('0x55CD5FDDD4335C1E', this.entity.handle, f(p1), f(p2), f(p3), f(speed), _h(type)); } /** * @param speed */ vehicleWaypointPlaybackOverrideSpeed(speed: float): void { inv('0x121F0593E0A431D7', this.entity.handle, f(speed)); } /** * @returns */ get VehicleWaypointProgress(): int { return inv('0x9824CFF8FC66E159', this.entity.handle, rai()); } /** * Clears the vehicle's **primary** AI task slot (e.g., scripted drive/nav tasks). */ clearVehicleTasks(): void { inv('0x141BC64C8D7C5529', this.entity.handle); } /** * Sets which seat index acts as the "driver seat" for driving tasks. https://www.youtube.com/watch?v=bjXrHOTgtu0&feature=youtu.be * * @param seatIndex The vehicle modify * @returns The instance for method chaining */ setDrivingSeat(seatIndex: eVehicleSeat = -1): this { inv('0x4BA972D0E5AD8122', this.entity.handle, seatIndex); return this; } /** * @returns Returns the {@link eSeatSeat} */ get DrivingSeat(): int { return inv('0xE62754D09354F6CF', this.entity.handle, rai()); } /** * Works exactly like except that it take a ped parameter (it doesn't give its driver a task), and it removes `p10`. * * @param pos * @param speed * @param drivingFlags * @param p6 * @param stoppingRange1 * @param stoppingRange2 */ vehicleDriveToDestination2(pos: Vector3, speed: float, drivingFlags: int, p6: int, stoppingRange1: float, stoppingRange2: float): void { inv('0x391073B9D3CCE2BA', this.entity.handle, f(pos.x), f(pos.y), f(pos.z), f(speed), drivingFlags, p6, f(stoppingRange1), f(stoppingRange2)); } /** * @returns */ get ActiveVehicleMissionType(): int { return inv('0x534AEBA6E5ED4CAB', this.entity.handle, rai()); } /** * @param destination * @returns */ vehicleIsAtDestination(destination: Vector3): boolean { return !!inv('0x583AE9AF9CEE0958', this.entity.handle, f(destination.x), f(destination.y), f(destination.z), rai()); } /** * @returns */ get VehicleWaypointTargetPoint(): int { return inv('0x416B62AC8B9E5BBD', this.entity.handle, rai()); } vehicleWaypointPlaybackPause(): void { inv('0x8A4E6AC373666BC5', this.entity.handle); } /** * Params: p4 = 3.f or 8.f, p5 = 0.25f, p6 = 0 in R* Scripts * * @param pos * @param p4 * @param p5 * @param p6 */ vehicleDriveToPoint2(pos: Vector3, p4: float, p5: float, p6: any): void { inv('0x6524A8981E8BE7C9', this.entity.handle, f(pos.x), f(pos.y), f(pos.z), f(p4), f(p5), p6); } vehicleWaypointPlaybackUseDefaultSpeed(): void { inv('0x5CEB25A7D2848963', this.entity.handle); } /** * Clears the vehicle's **secondary/aux** AI task slot (aux behaviors/overlays). */ clearVehicleTasksSecondary(): void { inv('0xEBA2081E0A5F4D17', this.entity.handle); } vehicleWaypointPlaybackResume(): void { inv('0xDC04FCAA7839D492', this.entity.handle); } }