Controller

Controllers are used to simulate various special functions of a vehicle’s using lua. It includes things like digital gauges, drivemodes, lightbars, stability control, etc.

Every vehicle needs at least one main controller, with the main options being “dummy” , and “vehicleController” .

Vanilla controllers can be found inside “\lua\vehicle\controller” in the game’s install folder.

Required arguments

string
type
The name of the controller

Additional arguments are required or available depending on the controller used. See the documentation related to your specific controller for more information.

Simple Example

Definition of the vehicleController along with the beamNavigator and its parameters.

"controller": [
    ["fileName"],
    ["vehicleController", {}],
    ["beamNavigator", {"screenMaterialName": "@etk800_screen", "htmlFilePath": "local://local/vehicles/common/ETK_navi_screen.html", "name":"etk800_navi"}],
],

Advanced Example

Definition of a lightbar controller with a lot of parameters.

"controller": [
    ["fileName"],
    ["lightbar", {
        "defaultModeIndex": 1,
        "modes": [
            ["name", "config"],
            ["Chase", [
                ["electric", "value", "duration"],
                    ["blue_1", 1, 0.15],
                    ["blue_1", 0, 0.2],
                    ["blue_1", 1, 0.1],
                    ["blue_1", 0, 0.25],

                    ["red_1", 0, 0.1],
                    ["red_1", 1, 0.3],
                    ["red_1", 0, 0.1],
                    ["red_1", 1, 0.15],

                    ["white_1", 1, 0.05],
                    ["white_1", 0, 0.1],
                    ["white_1", 1, 0.05],
                    ["white_1", 0, 0.1],
                    ["white_1", 1, 0.05],
                    ["white_1", 0, 0.4],
                ]
            ],
            ["Left Signal", [
                ["electric", "value", "duration"],
                    ["blue_1", 0, 0.3],
                    ["red_1", 0, 0.4],
                    ["white_1", 0, 0.5],

                    ["blue_1", 1, 0.7],
                    ["red_1", 1, 0.6],
                    ["white_1", 1, 0.5],
                ]
            ],
            ["Right Signal", [
                ["electric", "value", "duration"],
                    ["white_1", 0, 0.2],
                    ["red_1", 0, 0.3],
                    ["blue_1", 0, 0.4],
                    
                    ["white_1", 1, 0.8],
                    ["red_1", 1, 0.7],
                    ["blue_1", 1, 0.6],
                ]
            ]
        ]
    }]
],
Last modified: 2/12/2021 20:40

Any further questions?

Join our discord