> For the complete documentation index, see [llms.txt](https://code-after-sex.gitbook.io/script-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://code-after-sex.gitbook.io/script-documentation/cas-advanced-darts-system/configuration.md).

# Configuration

Every option of CAS Advanced Darts System in config/config.lua with its default, grouped like the file, plus the locale file for every text.

Everything is in `config/config.lua`, and every text players see is in `config/locale.lua`. Both files are open in the Escrow build. Restart `cas-darts` after a change (`restart cas-darts`). You never need to restart `cas-darts-assets`.

Distances are in metres, times in seconds unless the name ends in `Ms` (milliseconds), sway and scatter in millimetres on the board.

## Framework and admins

| Option               | Default                     | What it does                                                                                                                                                                                                                |
| -------------------- | --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Config.Framework`   | `'auto'`                    | `'auto'` uses `vorp_core` or `rsg-core`, whichever is started when `cas-darts` starts. `'vorp'` or `'rsg'` forces one. `'standalone'` runs without a framework: no items, no wagers, admins hang boards with `/darts_place` |
| `Config.Debug`       | `false`                     | Extra lines in the server console and the client F8 console                                                                                                                                                                 |
| `Config.AdminAce`    | `'casdarts.admin'`          | Players with this ace are admins                                                                                                                                                                                            |
| `Config.AdminGroups` | `{ 'admin', 'superadmin' }` | VORP user groups, or RSG permissions, that count as admins                                                                                                                                                                  |

## Items and models

| Option                         | Default                | What it does                                                                             |
| ------------------------------ | ---------------------- | ---------------------------------------------------------------------------------------- |
| `Config.Items.wall`            | `'darts_board_wall'`   | The inventory item that hangs a board on a wall. Must exist in your inventory            |
| `Config.Items.stand`           | `'darts_board_stand'`  | The inventory item that sets up a board on a stand. Must exist in your inventory         |
| `Config.Models.board`          | `'cas_darts_board_v1'` | The board with its surround                                                              |
| `Config.Models.oche`           | `'cas_darts_oche_v1'`  | The oche bar on the throw line                                                           |
| `Config.Models.stand`          | `'cas_darts_stand_v1'` | The wooden stand of a stand board                                                        |
| `Config.Models.mat`            | `'cas_darts_mat_v1'`   | The throwing mat from the board past the oche line. Set `mat = false` to leave it out    |
| `Config.MatThickness`          | `0.006`                | Lifts the oche bar onto the mat                                                          |
| `Config.MaxBoardsPerCharacter` | `2`                    | Boards one character may have hung at the same time. Admin and decor boards do not count |

The models come from `cas-darts-assets`. Keep the names unless you stream your own models.

## Distances

| Option                     | Default | What it does                                                                                                                                                                                                                         |
| -------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `Config.StreamDistance`    | `40.0`  | Boards, darts and the house player exist on your client while you are this close                                                                                                                                                     |
| `Config.InteractDistance`  | `2.5`   | Range of the **Darts** prompt around the oche point. The server allows 3 m more for setting up and joining                                                                                                                           |
| `Config.PlaceMaxDistance`  | `4.0`   | A board may be hung at most this far from you                                                                                                                                                                                        |
| `Config.BoardSpacing`      | `1.2`   | Smallest distance between two boards                                                                                                                                                                                                 |
| `Config.BullHeight`        | `1.73`  | Bull centre above the floor (regulation)                                                                                                                                                                                             |
| `Config.OcheDistance`      | `2.37`  | Board face to the front of the oche (regulation)                                                                                                                                                                                     |
| `Config.BoardDepth`        | `0.038` | Board thickness: its face stands this far from the wall                                                                                                                                                                              |
| `Config.OcheZone.ahead`    | `0.25`  | How far over the oche line a thrower may stand                                                                                                                                                                                       |
| `Config.OcheZone.behind`   | `1.2`   | How far back from the oche line a thrower may stand                                                                                                                                                                                  |
| `Config.OcheZone.side`     | `0.9`   | How far to either side of the board's centre line a thrower may stand                                                                                                                                                                |
| `Config.WalkAway.distance` | `20.0`  | A player who stays farther than this from the bull for `seconds` is out: of a lobby with the stake back, of a running match as a loss (the stake stays in the pot). Spectators lose the scoreboard past this distance. Needs OneSync |
| `Config.WalkAway.seconds`  | `3`     | How long a player may stay that far away. A step outside and back does not count                                                                                                                                                     |

{% hint style="info" %}
A board is saved by the position of its bull. The floor, the mat, the oche and the stand are placed `Config.BullHeight` below it. Set `BullHeight` before players hang boards: if you change it later, the props of boards already on the map sit at the wrong height.
{% endhint %}

## Matches

| Option                | Default    | What it does                                                                                                                                                                                                             |
| --------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `Config.MaxPlayers`   | `8`        | Most seats in one match, the house player included. A whole number from 2 to 20: anything outside is moved into that range (Killer gives every player one of the 20 numbers). The board card offers every count up to it |
| `Config.Modes`        | all `true` | `x01`, `cricket`, `clock`, `killer`, `practice`. Set one to `false` to take that game off the card. The server refuses it too                                                                                            |
| `Config.LobbyMinutes` | `10`       | A lobby nobody starts closes after this. Every stake goes back                                                                                                                                                           |
| `Config.VisitSeconds` | `60`       | Time for one visit (three darts). Then the visit ends with the darts thrown so far                                                                                                                                       |
| `Config.PullSeconds`  | `5`        | The thrower pulls the darts (walk up, press **Pull darts**) or they are pulled after this                                                                                                                                |

## The skill throw

`Config.Throw` sets the difficulty for human players. The server sends these values to the thrower at the start of each visit and judges every dart with the same values.

| Option          | Default | What it does                                                                                                                               |
| --------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `amp`           | `10`    | Hand sway amplitude (mm). The reticle wanders up to about this far from the aim point                                                      |
| `breathMax`     | `3.0`   | Seconds of breath a player can hold. Holding steadies the hand to 25 percent of the sway                                                   |
| `breathRecover` | `5.0`   | Seconds to get the whole breath back                                                                                                       |
| `maxBreaths`    | `16`    | Breath holds allowed in one visit                                                                                                          |
| `period`        | `1.1`   | Power meter: seconds from empty to full (then back down)                                                                                   |
| `sweetLo`       | `0.72`  | Bottom of the clean release band of the power meter                                                                                        |
| `sweetHi`       | `0.86`  | Top of the clean release band                                                                                                              |
| `powerScale`    | `250`   | Millimetres the dart drops (too weak) or rises (too strong) per unit of power outside the band. Released at 0.50, the dart lands 55 mm low |
| `lateralScale`  | `30`    | Millimetres a full sideways flick at the release pushes the dart                                                                           |
| `sigma`         | `3.0`   | The server's own random scatter on every dart (mm)                                                                                         |
| `tolerance`     | `0.75`  | Seconds the client's clock may differ from the server's. Raise it if players with a high ping see **Your throw arrived out of time**       |
| `maxAim`        | `330`   | How far from the bull the aim point may go (mm)                                                                                            |
| `minGapMs`      | `400`   | Shortest time between two darts                                                                                                            |

When the breath runs out, the hand shakes at 1.6 times the normal sway until half of the breath is back. A draw held for more than 10 seconds is refused.

Other resources can make a player drunk with the `setDrunk` server export (see [Commands and exports](/script-documentation/cas-advanced-darts-system/commands-and-exports.md)). Fully drunk, the sway is three times `amp`.

| Option                   | Default | What it does                                                                                            |
| ------------------------ | ------- | ------------------------------------------------------------------------------------------------------- |
| `Config.BounceOutChance` | `0.35`  | How often a dart that lands on a wire bounces out (0 to 1). A bounce out scores nothing                 |
| `Config.Flight.speed`    | `9.0`   | Dart flight speed on the clients (m/s). Looks only: the server has already decided where the dart lands |
| `Config.Flight.gravity`  | `9.81`  | Gravity of the flight arc (m/s squared). Looks only                                                     |

### Tuning the difficulty

| To make it             | Change                                                                                             |
| ---------------------- | -------------------------------------------------------------------------------------------------- |
| Easier to aim          | Lower `amp`, raise `breathMax`, lower `breathRecover`                                              |
| Easier to time         | Widen the band (`sweetLo` down, `sweetHi` up), raise `period` (a slower meter), lower `powerScale` |
| More forgiving overall | Lower `sigma`, lower `lateralScale`, lower `Config.BounceOutChance`                                |
| Harder                 | The other way round                                                                                |

## Wagers

| Option                         | Default | What it does                                                                                                     |
| ------------------------------ | ------- | ---------------------------------------------------------------------------------------------------------------- |
| `Config.Wager.enabled`         | `true`  | Money games on or off. Needs VORP or RSG                                                                         |
| `Config.Wager.min`             | `1`     | Smallest stake per player, in dollars                                                                            |
| `Config.Wager.max`             | `250`   | Stake cap per player, in dollars                                                                                 |
| `Config.Wager.houseCutPercent` | `0`     | Percent of the pot kept back when the winner is paid, rounded to the nearest cent. The cut is not paid to anyone |

Stakes are whole dollars of cash. A money game needs 2 seats or more: the card does not offer a stake for 1 player, and the host cannot start a money game alone. Every player puts the same stake in when joining. The winner takes the pot minus the cut. A match that ends without a winner gives every stake back. The house player never plays for money, and practice has no stake. Money the framework refused is tried again every 60 seconds while the player is online, and at their next character load.

## Hit-rate watch

| Option                        | Default | What it does                                                                                |
| ----------------------------- | ------- | ------------------------------------------------------------------------------------------- |
| `Config.AntiCheat.minDarts`   | `300`   | Darts in money games a character must have thrown before the watch can flag them            |
| `Config.AntiCheat.maxBedRate` | `0.90`  | Share of those darts in a treble, a double or the bull above which the character is flagged |

Only darts of money games with two seats or more count. Free games and practice do not. A flagged character cannot play for money until an admin clears it with `/darts_unflag` (see [Commands and exports](/script-documentation/cas-advanced-darts-system/commands-and-exports.md)).

The config explains the default: aiming at a treble or a double, a client that cancels the sway lands about 81 percent of its darts in the bed, and a steady player who holds the breath and times the power meter well lands 75 to 80 percent. The watch cannot tell those two apart, so 0.90 only flags rates no real throw reaches. A lower rate flags sooner, but under 0.85 it can flag your best players. Treat a flag as a reason to look, not as proof.

## The house player

| Option                    | Default                  | What it does                                                                                        |
| ------------------------- | ------------------------ | --------------------------------------------------------------------------------------------------- |
| `Config.Computer.enabled` | `true`                   | Offer the house player on the card. With `false` the server refuses it too                          |
| `Config.Computer.model`   | `'a_m_m_valtownfolk_01'` | His ped model (a local ped on each client)                                                          |
| `Config.Computer.name`    | `'Silas Crane'`          | His name on the scoreboard. A second house player in the same match is `Silas Crane 2`, and so on   |
| `Config.Computer.levels`  | see below                | The three levels and their labels on the card                                                       |
| `Config.Computer.dartMs`  | `1500`                   | Time between two of his darts                                                                       |
| `Config.Computer.walkMs`  | `3200`                   | Time before his first dart (stepping up to the oche)                                                |
| `Config.Computer.pullMs`  | `4400`                   | Time before he pulls his darts (he walks up to the board first; keep it under `Config.PullSeconds`) |
| `Config.Computer.aimMs`   | `450`                    | His arm is up in the aim pose this long before each throw. Keep it under `dartMs`                   |

```lua
levels = {
    { id = 'novice', label = 'Greenhorn' },
    { id = 'regular', label = 'Saloon Regular' },
    { id = 'sharp', label = 'Sharpshooter' },
},
```

You can change the labels and remove a level. The ids are fixed: the server only knows `novice`, `regular` and `sharp`. How tightly each level throws (a scatter of 38, 22 and 12 mm around his target) is set in `shared/ai.lua`, which is only editable in the Open Source build.

## Cameras

The cameras are fixed. They are placed from the thrower's head when the throw starts, and **V** goes through them in the order of the list. The first one is the default. The view a player picks stays for their next throws.

| Option                  | Default                                                        | What it does                                                                                                                               |
| ----------------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `Config.Camera.blendMs` | `600`                                                          | Blend time into, between and out of the views                                                                                              |
| `Config.Camera.holdMs`  | `1500`                                                         | After the last dart of a visit leaves the hand, the view stays this long so the flight and the landing are seen                            |
| `views` `shoulder`      | `fov = 50.0, back = 1.15, side = 0.55, up = 0.05, lead = 0.35` | Behind the right shoulder (`back`, `side`, `up` from the head), looking at a point `lead` metres left of the bull                          |
| `views` `eyes`          | `fov = 42.0, ahead = 0.45, up = 0.05`                          | First person, `ahead` metres in front of the head, looking at the bull. Keep it clear of the hat brim (0.2 put the camera inside the head) |
| `views` `side`          | `fov = 48.0, side = 2.7, along = 1.05, up = 0.05`              | Off the lane on the thrower's right (`side`), level with a point `along` metres down the lane, looking between the thrower and the board   |

Remove an entry from `views` to leave that view out.

## Landing marks

| Option                | Default                | What it does                                                                         |
| --------------------- | ---------------------- | ------------------------------------------------------------------------------------ |
| `Config.Marks.color`  | `{ 255, 214, 102 }`    | Colour of the slice that lights up where a dart lands                                |
| `Config.Marks.alpha`  | `190`                  | Its alpha at its brightest                                                           |
| `Config.Marks.inMs`   | `80`                   | Fade in                                                                              |
| `Config.Marks.holdMs` | `300`                  | Time fully lit                                                                       |
| `Config.Marks.outMs`  | `900`                  | Fade out                                                                             |
| `Config.Marks.tagAt`  | `{ x = 200, y = 200 }` | Where the points tag sits, in board millimetres from the bull (the top right corner) |
| `Config.Marks.tagMs`  | `1600`                 | How long the tag shows                                                               |
| `Config.Marks.near`   | `12.0`                 | Players farther than this from the board see neither                                 |

## Aiming

| Option                       | Default | What it does                                                              |
| ---------------------------- | ------- | ------------------------------------------------------------------------- |
| `Config.Aim.mouseGain`       | `260.0` | Millimetres the aim point moves per unit of mouse input                   |
| `Config.Aim.stickSpeed`      | `160.0` | Millimetres per second the aim point moves on a pad stick                 |
| `Config.Aim.lateralWindowMs` | `90`    | Sideways mouse movement in this window before the release pushes the dart |
| `Config.Aim.lateralFull`     | `0.06`  | The movement (in mouse input units) that counts as a full push            |

## The dart, clips and sounds

| Option                  | Default                                                                                    | What it does                                                                                                                                                 |
| ----------------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `Config.Dart.model`     | `'cas_darts_dart_v1'`                                                                      | The dart prop. Its tip is the model origin and its body runs up +Z, so the dart points along -Z                                                              |
| `Config.Dart.tipDepth`  | `0.012`                                                                                    | How deep the dart sits in the board (m)                                                                                                                      |
| `Config.Anims.aim`      | knife ready clip, `idle_2_aim_fwd_med`                                                     | The aim pose (arm up)                                                                                                                                        |
| `Config.Anims.throw`    | knife throw `release_med_0` (`releaseMs = 60`), then a rock throw clip (`releaseMs = 700`) | Throw clips. The first one that loads is used. `load` is the dictionary to request when it differs from `dict`. `releaseMs` is when the dart leaves the hand |
| `Config.Sounds.turn`    | `NAV_RIGHT`, `HUD_DOMINOS_SOUNDSET`                                                        | Your visit starts                                                                                                                                            |
| `Config.Sounds.refused` | `NO`, `HUD_DOMINOS_SOUNDSET`                                                               | An error notice                                                                                                                                              |
| `Config.Sounds.thunk`   | `PLACE`, `MGDOM_Sounds`                                                                    | A dart sticks                                                                                                                                                |
| `Config.Sounds.bounce`  | `COLLECT`, `MGDOM_Sounds`                                                                  | A dart bounces out                                                                                                                                           |
| `Config.Sounds.win`     | `MONEY`, `HUD_DOMINOS_SOUNDSET`                                                            | A money notice                                                                                                                                               |

The sounds are Rockstar soundsets of the dominoes minigame. Remove an entry to stay silent.

## Commands and leaderboard

| Option                    | Default          | What it does                                                                                                                                                |
| ------------------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Config.Commands.place`   | `'darts_place'`  | Admin: hang a board where you look without an item (`/darts_place wall` or `/darts_place stand`)                                                            |
| `Config.Commands.remove`  | `'darts_remove'` | Admin: take down the nearest board. A match on it is stopped and its stakes go back, a player's board item goes back to its owner, decor boards are refused |
| `Config.Commands.decor`   | `'darts_decor'`  | Admin: write the `Config.DecorBoards` line of the nearest board in the chat, F8 and the server console                                                      |
| `Config.Commands.top`     | `'darts_top'`    | Everyone: stats and leaderboard                                                                                                                             |
| `Config.Commands.unflag`  | `'darts_unflag'` | Admin or console: clear the hit-rate watch                                                                                                                  |
| `Config.Leaderboard.size` | `10`             | Rows on the leaderboard                                                                                                                                     |

## Decor boards

Boards that are always on the map and playable by anyone. Nobody owns them and they cannot be taken down from the card.

```lua
Config.DecorBoards = {
    { id = 'valentine_saloon', kind = 'wall', coords = vector4(-313.35, 805.32, 120.71, 100.0) },
}
```

| Field    | What it is                                                                                                         |
| -------- | ------------------------------------------------------------------------------------------------------------------ |
| `id`     | Unique name. Never change it: the board's row in the database is found by it                                       |
| `kind`   | `'wall'` or `'stand'`                                                                                              |
| `coords` | `x`, `y`, `z` = the bull centre on the board face. `w` = the heading, the way the face looks (towards the thrower) |

The `z` of the bull is 1.73 m above the floor for both kinds. When you move a decor board in the config, it moves on the next start. The line in the shipped config is commented out (an example).

The easy way to get the line: hang a board where you want it, stand at it and type `/darts_decor`. The [FAQ](/script-documentation/cas-advanced-darts-system/faq.md) has the steps.

## Locale

`config/locale.lua` holds every text the players see: the prompts, the game notices, the whole NUI and the error messages.

| Group         | Examples                                                                                                                                                    |
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Prompts       | `play = 'Darts'`, `throwPrompt = 'Throw'`, `pull = 'Pull darts'`, `place = 'Hang board'`, `place_stand = 'Set up board'`, `place_wall = 'Not a wall'`       |
| Game messages | `yourThrow`, `walkedAway`, `wagerWon = 'You won %s'`, `boardReturned`, `flaggedAdmin`, `unflagDone`                                                         |
| Admin lines   | `adminNoBoard`, `adminRemoved`, `adminItemGiven`, `adminItemOwed`, `adminDecorRefused`, `adminDecorLine`                                                    |
| NUI           | `ui_new_match`, `ui_mode_cricket`, `ui_sets_label`, `ui_self_hit`, `ui_mpr`, `ui_desc_killer`, `ui_leaderboard`                                             |
| Errors        | `err_` plus the code the server sends, for example `err_not_your_turn = 'It is not your turn'` or `err_need_two = 'A money game needs two players or more'` |

Keep every `%s` in a text: the script fills them in (an amount, a name, a number). Change the words only, never the keys. The item labels and descriptions are not here: they are in your inventory (the VORP `items` table or the RSG `items.lua`).
