4WD

Summary

The 4wd controller enables you to connect and disconnect a driveshaft and allows you to control a rangebox. The configuration needs to provide the correct powertrain device names (shaft and rangeBox) for it to work.

You can also use multiple 4wd controllers at once if desired, each one controlling a different set of devices.


File Info

Filename 4wd.lua
Path /lua/vehicle/controller/4wd.lua
Type Auxiliary
Usage type Multiple

JBeam Properties

string
type
The name of the disconnecting shaft.
string
type
The name of the rangebox device to be controlled.


Public Functions

Function name
Parameters
Description
Function name
toggle4WD
Parameters
Description
Toggles between 2WD and 4WD
Function name
set4WDMode
Parameters
mode
Description
Sets the 4WD mode to either “connected” or “disconnected”
Function name
toggleRange
Parameters
Description
Toggles between High and Low range
Function name
setRangeMode
Parameters
mode
Description
Sets the range to either “high” or “low”
Function name
toggleDiffs
Parameters
Description
Toggles between different states of the controlled differentials

Electrics

Name
Units/Values
Description
Name
modeRangeBox
Units/Values
0 or 1
Description
Indicates if the rangeBox is in low range (1) or high range (0).
Name
mode4WD
Units/Values
0 or 1
Description
Indicates if the transfercase is in 2WD (0) or 4WD (1) mode.

Simple Example

"controller": [
  ["fileName"],
  ["4wd", {"shaftName":"driveshaftF", "rangeBoxName":"rangeBox"}]
],

Last modified: 8/8/2023 12:59

Any further questions?

Join our discord