# Configuration

All config files fields are explained inside the config file in commented code. Some more complicated fields are explained in this page.

## Custom mods

You can create custom modifications in the config files that will affect handling fields or assign variables to vehicles when installed.\
By default custom mods are installed by using an inventory item. If you'd like your own implementation, you could use [Additional Handlings API](/squirrel-bracket-documentation/handling-tuning/api.md#additional-handlings) or edit [#server\_config.lua](#server_config.lua "mention") `Items` section.

You can find custom mods data in [#config.lua](#config.lua "mention")under `Custom Mods` section.

#### Fields

* uniqueId: `string`
  * Required id to be used to identify each mod. Must be unique for each mod.
* itemData: `table`
  * Contains data for inventory item.
    * consume: `boolean`
      * Wether or not the item should be removed from inventory after installing the mod.
    * name: `?string`
      * Item name (not label) that is used to identify your inventory item. If not entered will default to `uniqueId`. <mark style="color:orange;">Make sure to create the items in your database / items config for your inventory for these to work</mark>.
* label: `string`
  * Label that will be shown in tablet. If not entered will default to `identifier`.
* identifier: `string`
  * Same as `slotName`. This will identify what slot the part will be installed to. Meaning that if two different mods will be created with the same `identifier`, only one will be available to be installed at a time.
* save: `boolean`
  * Wether or not to save the part in database. If the part would not be saved in database, it will disappear after respawning the vehicle.
* installedByDefault: `boolean`
  * If set to `true` the part will be installed by default to all vehicles. Might be useful for standalone servers that do not have any inventory item system.
* handlingData: `table`
  * Data that will be assigned to the vehicle.\
    If `key` matches any valid handling field it will affect the vehicle's handling field e.g. `fInitialDriveForce = {value = 0.01}` will increase the `fInitialdriveForce` by `0.01`.\
    If key is equal to `enableHandlingFields` it will make the fields available for adjusting in tuning tablet.\
    Othewise it will assign the variable to vehicle for any other desired implementation.
    * enableHandlingFields: `string[]`
      * Make the fields available for adjusting in tuning tablet
    * \[`'fTractionCurveMax' | 'fInitialDriveForce' | 'fInitialDriveMaxFlatVel' | <...>`]: `{value: ?number, mult: ?number}`
      * Affects the handling value by `value` or adds the multiplier (`mult`) when the mod is installed.
    * \[`string`]: `any`
      * Assigns the variable to vehicle.

#### Example

<pre class="language-lua"><code class="lang-lua">Config.CustomMods = {
    -- ...other mods
<strong>    {
</strong>        uniqueId = 'car_mod_engine_ecu',
        itemData = <a data-footnote-ref href="#user-content-fn-1">{consume = false}</a>,
        label = 'ECU',
        identifier = <a data-footnote-ref href="#user-content-fn-2">'engine_ecu'</a>,
        save = true,
        handlingData = {
            enableHandlingFields =
            {
                <a data-footnote-ref href="#user-content-fn-3">'fInitialDriveForce', 'fInitialDriveMaxFlatVel'</a>
            }, 
            <a data-footnote-ref href="#user-content-fn-4">fInitialDriveForce = {value = 0.01}</a>,
            <a data-footnote-ref href="#user-content-fn-5">fInitialDriveMaxFlatVel = {value = -5}</a>
        },
    },
    -- ...other mods
}
</code></pre>

## Permissions

Permissions will let you set up what is allowed to each group or player. Currently there are a few permissions that will allow or block players from doing certain things with the script.

You can find custom mods data in [#config.lua](#config.lua "mention")under `Permissions` section.

* `readXml`
  * Allows player to preview XML file output in UI.
* `writeXml`
  * Allows player to write XML file data to your server files.
* `writeDefault`
  * Allows player to write default handlings to server database.
* `tabletCommand`
  * Allows player to use chat command to open tablet. *Recommended for servers that do not have inventory system*.
* `driftCommand`
  * Allows player to use command to enable drift mode. This will not require for player to have a small tablet. *Recommended for servers that do not have inventory system*.
* `ignoreLimits`
  * Allows player to change values without strict limits. This is useful if player has to adjust handlings to write them to server files.

#### Config.Permissions

Defines what groups have which permissions. You can find the implementation of permissions in `configs/server_config.lua` or adjust the `getPlayerPemissions` function to your liking.

* type: `'frameworkgroup' | 'identifier' | 'ace'`
  * `'frameworkgroup'` - selects the group that is in `value`.
  * `'identifier'` - selects specific player by identifier. Identifier is entered in `value`.
  * `'ace'` - selects ace permission specified in `value`.
* value: `string`
* permissions: `Permissions`
  * Defines which permissions are assigned to the selected player or group.

## Configuration files

{% tabs %}
{% tab title="config.lua" %}
{% @github-files/github-code-block url="<https://github.com/daZepelin/sb-handlingtuning/blob/master/configs/config.lua>" %}
{% endtab %}

{% tab title="client\_config.lua" %}
{% @github-files/github-code-block url="<https://github.com/daZepelin/sb-handlingtuning/blob/master/configs/client_config.lua>" %}
{% endtab %}

{% tab title="server\_config.lua" %}
{% @github-files/github-code-block url="<https://github.com/daZepelin/sb-handlingtuning/blob/master/configs/server_config.lua>" %}
{% endtab %}

{% tab title="handling\_values.json" %}
{% @github-files/github-code-block url="<https://github.com/daZepelin/sb-handlingtuning/blob/master/configs/handling_values.json>" %}
{% endtab %}
{% endtabs %}

[^1]: As name is not entered, the inventory item name will be uniqueId - 'car\_mod\_engine\_ecu'

[^2]: If you were to create another mod with the same identifier, only one could be installed at a time.

[^3]: Will let `fInitialDriveMaxFlatVel` and `fInitialDriveForce` to be editable if they are disabled in `Config.DisabledFields`.

[^4]: Increases the `fInitialDriveForce` by 0.01

[^5]: Decreases the `fInitialDriveMaxFlatVel` by 50%. E.g originally it is 9.0, with this mod it will be 4.5.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://squirrel-bracket.gitbook.io/squirrel-bracket-documentation/handling-tuning/configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
