4WD / Transfer Case Controller
Manages selectable four-wheel-drive and transfer case systems. Controls switching between 2WD/4WD modes, high/low range selection, and differential locking. Used on vehicles with configurable drivetrain modes like trucks and off-road vehicles.
Manages selectable four-wheel-drive and transfer case systems. Controls switching between 2WD/4WD modes, high/low range selection, and differential locking. Used on vehicles with configurable drivetrain modes like trucks and off-road vehicles.
Public API
| Function | Description |
|---|---|
module.toggleDiffs() | Toggles diffs. |
module.toggle4WD() | Toggles 4WD. |
module.set4WDMode(mode) | Sets the 4WD mode. |
module.toggleRange() | Toggles range. |
module.setRangeMode(mode) | Sets the range mode. |
Hooks
| Hook | Description |
|---|---|
module.init(jbeamData) | Initializes the controller from JBeam data. |
module.initLastStage(jbeamData) | Final-stage initialization after all controllers and powertrains are ready. |
module.updateGFX(dt) | Per-frame update for visual state and UI synchronization. |
Usage Example
-- Toggle between 2WD and 4WD
controller.getController("4wd").toggle4WD()
-- Set specific 4WD mode
controller.getController("4wd").set4WDMode("4H")
-- Switch to low range for off-road
controller.getController("4wd").toggleRange()See Also
- Drive Modes — Vehicle-wide driving profiles
- Vehicle Controller — Main powertrain control logic
- Active Center Diff — Electronic center differential control
Wheels Module Reference
Module defined in `lua/vehicle/wheels.lua`. This module manages the physical simulation, thermal state, and braking logic for wheels and non-tire rotators. It acts as the final interface between the [
Advanced Coupler Control
Manages automated coupling and decoupling of trailer hitches and tow connections. Handles coupler state machines, latch detection, and electrics integration for advanced towing setups.