import { MountController, type MountedRider, type MountSeat, type RideableConfig } from "./mount.js"; import type { GameContext } from "../runtime/gameContext.js"; import type { CameraRigKind } from "../game/cameraConfig.js"; import { type CameraRigConfig, type ChaseCameraTuning } from "../runtime/cameraDirector.js"; /** World-space `[x, y, z]` for a vehicle's current position. */ export type VehiclePosition = readonly [number, number, number]; /** A vehicle's world-space position and heading, used for {@link VehicleSeats.exit}'s dismount placement math. */ export interface VehiclePose { position: VehiclePosition; rotationY: number; } /** Options for {@link VehicleSeats.enter}. */ export interface EnterVehicleOptions { /** Specific seat to board; omit to take the first free control seat, else the first free seat. */ seatId?: string; } /** Movement-lock patch for `entities.update(riderId, { movement: { ...current, ...patch } })` (#286.gameplay `movement.frozen`). */ export interface RiderMovementPatch { frozen: boolean; } /** Result of {@link VehicleSeats.enter} — the resolved seat plus the camera/drive/movement patches to apply. */ export type EnterVehicleResult = { ok: true; seat: MountSeat; /** Feed straight into `ctx.camera.follow(...)` — the vehicle while a control seat is taken, else the rider's own id. */ cameraTarget: string; /** Entity this rider's axis input should now drive (`scene/mount`'s `driveTarget`); `null` for a passenger seat. */ driveTarget: string | null; riderMovementPatch: RiderMovementPatch; } | { ok: false; reason: string; }; /** Result of {@link VehicleSeats.exit} — the side-door placement plus the camera/movement patches to apply. */ export type ExitVehicleResult = { ok: true; vehicleId: string; /** Where to `setPose` the rider — alongside the vehicle's side door, facing its heading. */ placement: VehiclePose; cameraTarget: string; riderMovementPatch: RiderMovementPatch; } | { ok: false; reason: "not_seated" | "invalid_pose"; }; /** Where {@link VehicleSeats.exit} steps the rider out, relative to the vehicle's heading. */ export interface DismountOffset { /** Lateral distance from the vehicle's centerline; default 2.2. */ distance?: number; /** Which side of the vehicle to step out on, relative to its heading; default `"right"`. */ side?: "left" | "right"; } /** * Composes `scene/mount`'s control-transfer bookkeeping with the seat/camera/movement-mode transition * every enter/exit-vehicle flow needs (#533.2): boarding resolves a free seat and reports the camera * target, drive target, and rider movement-lock patch in one call; leaving computes a side-door * placement next to the vehicle and reports the same triad in reverse. Pure — no entity/camera side * effects — the caller applies `riderMovementPatch`/`placement`/`cameraTarget` via its own `ctx`. */ export declare class VehicleSeats { private readonly controller; constructor(controller?: MountController); register(config: RideableConfig): void; enter(riderId: string, vehicleId: string, options?: EnterVehicleOptions): EnterVehicleResult; exit(riderId: string, vehiclePose: VehiclePose, offset?: DismountOffset): ExitVehicleResult; isSeated(riderId: string): boolean; driverOf(vehicleId: string): string | null; /** The seated rider's controlled mount; `null` for passengers and unseated riders. */ drivenBy(riderId: string): string | null; snapshot(): MountedRider[]; restore(next: readonly MountedRider[]): void; reset(): void; get mounts(): MountController; } /** * Builds a {@link VehicleSeats}, optionally over an existing `MountController` to share its occupancy. * * @capability vehicle-seats enter, exit and swap seats in a car or mount (GTA-style boarding) with driver and passenger slots */ export declare function createVehicleSeats(controller?: MountController): VehicleSeats; /** Seat selection and optional local camera policy for an explicit rider transition. */ export interface BoardVehicleOptions extends EnterVehicleOptions { /** Presentation policy; `false` applies only rider/occupancy patches for authoritative remote riders. */ camera?: boolean; /** Omit to keep the current rig. `null` restores the configured rig. */ rig?: CameraRigKind | null; config?: CameraRigConfig; chase?: ChaseCameraTuning | null; } /** Exit placement and optional local camera restoration for an explicit rider. */ export interface LeaveVehicleOptions extends DismountOffset { camera?: boolean; /** Supply a last known vehicle pose when its entity has already been removed. */ pose?: VehiclePose; } /** Apply an existing seat transition to the explicitly named rider. Motor/input policy stays caller-owned. * @capability board-vehicle board a rideable, freeze/hide its rider and apply caller camera policy */ export declare function boardVehicle(ctx: GameContext, seats: VehicleSeats, riderId: string, vehicleId: string, options?: BoardVehicleOptions): EnterVehicleResult; /** Apply dismount placement, restore rider movement/visibility and the configured camera rig. * @capability leave-vehicle leave a rideable beside its current pose and restore on-foot camera/movement */ export declare function leaveVehicle(ctx: GameContext, seats: VehicleSeats, riderId: string, options?: LeaveVehicleOptions): ExitVehicleResult | { ok: false; reason: "unknown_rider" | "unknown_vehicle"; };