API ReferenceGE Extensionscoreinput
Vehicle Switching
Provides custom vehicle cycling order for the switch-next/previous-vehicle input actions. Falls back to default engine behavior when no custom order is set.
Provides custom vehicle cycling order for the switch-next/previous-vehicle input actions. Falls back to default engine behavior when no custom order is set.
Public API
| Function | Signature | Description |
|---|---|---|
M.switchCycleVehicle | (player?, dir) | Switches to the next (dir=1) or previous (dir=-1) vehicle for the given player (default 0). Uses custom order if set, otherwise uses be:enterNextVehicle. |
M.setVehicleOrder | (order) | Sets a custom vehicle cycling order. order is an array of vehicle IDs. Pass nil to revert to default behavior. |
Behavior
- If
vehicleOrderis set and non-empty:- Finds the current vehicle's index in the order array.
- Wraps the index forward/backward by
dir. - Enters the vehicle at the new index via
be:enterVehicle. - Fires
extensions.hook('trackNewVeh').
- If custom order fails (vehicle not found, player not in list):
- Logs an error and clears the custom order.
- Falls back to
be:enterNextVehicle(player, dir).
Usage Example
-- Set a custom vehicle rotation for a scenario
local vehIds = {veh1:getId(), veh2:getId(), veh3:getId()}
core_input_vehicleSwitching.setVehicleOrder(vehIds)
-- Switch to next vehicle
core_input_vehicleSwitching.switchCycleVehicle(0, 1)
-- Switch to previous
core_input_vehicleSwitching.switchCycleVehicle(0, -1)
-- Clear custom order
core_input_vehicleSwitching.setVehicleOrder(nil)Key Details
- Used by scenarios and missions to restrict which vehicles the player can cycle through.
lastIndextracks the most recent index for edge-case fallback.- Vehicle existence is verified via
scenetree.findObjectByIdbefore switching.
See Also
- Input Action Filter - Related reference
- Input Actions - Related reference
- Input Bindings - Related reference
- Core Systems Guide - Guide
Deprecated Actions
Static lookup table mapping deprecated input action names to their replacements or marking them as obsolete. Used by `core_input_actions.upgradeAction()` during binding loading.
Vibration Debug
ImGui debug window for tuning force-feedback vibration parameters on the player vehicle. Adjusts wheel-slip and jerk force multipliers/minimums sent to the vehicle's `hydros` system.