> 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-gang/configuration/territory.md).

# Territory, lookout and bell

Configure territory in CAS Advanced Gang System: the influence radius, contests, the Lookout Post and the Alarm Bell.

## Territory

{% code title="config.lua" %}

```lua
Config.DefaultInfluence = 220.0   -- claim radius, metres

Config.Territory = {
  enabled      = true,
  minRaiders   = 2,     -- riders from other gangs needed inside the radius
  clearSeconds = 60,    -- seconds with nobody inside before the camp is clear
  lockStores   = true,  -- lock stash and treasury withdrawals while contested
  sweepSeconds = 5,     -- how often positions are read
}
```

{% endcode %}

| Setting        | Meaning                                                                                                                                        |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `enabled`      | `false` turns contests off, and `contestsHeld` never grows. Take `contestsHeld` out of `Config.Tiers` too, or tiers III to V can't be reached. |
| `minRaiders`   | Riders from other gangs needed inside at once. Riders with no gang never count.                                                                |
| `clearSeconds` | How long the ground must be empty of rivals before it's clear. Stops a camp flickering while someone rides the edge.                           |
| `lockStores`   | `true`: stash and treasury withdrawals are refused while contested, deposits still work. `false`: members are only warned.                     |
| `sweepSeconds` | How often positions are read. One read covers every camp, so the cost doesn't grow with the number of camps.                                   |

What a contest leads to is up to your server. Read it with [`GetGangContest`](/script-documentation/cas-advanced-gang/developers/exports.md#getgangcontest).

## Lookout Post

{% code title="config.lua" %}

```lua
Config.Lookout = {
  enabled      = true,
  range        = 400.0, -- metres from each lookout post
  minRiders    = 1,     -- riders needed before the lookout calls it
  countLoners  = false, -- true = also report riders with no gang
  quietSeconds = 180,   -- empty trail needed before a new approach is reported
}
```

{% endcode %}

| Setting        | Meaning                                                                                             |
| -------------- | --------------------------------------------------------------------------------------------------- |
| `enabled`      | `false` turns the lookout off. The post is then a prop.                                             |
| `range`        | How far each post sees, measured from the post.                                                     |
| `minRiders`    | Riders in range at once before the gang is warned.                                                  |
| `countLoners`  | `false`: only riders from other gangs count, like contests. `true`: anyone outside the gang counts. |
| `quietSeconds` | After a warning, the trail must stay empty this long before a new approach is reported.             |

The lookout uses the same sweep as territory, so it costs no extra reads. It also works with `Config.Territory.enabled = false`.

## Alarm Bell

{% code title="config.lua" %}

```lua
Config.AlarmBell = {
  cooldownSeconds = 60,   -- seconds between rings, per gang
  ringOnContest   = true, -- ring by itself when the camp becomes contested
  reach           = 2.5,  -- prompt range from the bell, metres
  markSeconds     = 120,  -- how long the camp stays marked on members' maps; 0 = no mark
  sound = { name = 'VAL_SINGLE_TOLL', set = 'CHURCH_BELL_SOUNDS', tolls = 3 },
}
```

{% endcode %}

| Setting           | Meaning                                                                                                                                           |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| `cooldownSeconds` | A ring within this time is refused, and the rider is told how long is left.                                                                       |
| `ringOnContest`   | The bell rings by itself when the camp becomes contested. Needs `Config.Territory.enabled`.                                                       |
| `reach`           | How close a rider must stand to get the prompt. The server checks the distance again.                                                             |
| `markSeconds`     | How long the camp stays marked on every member's map after a ring.                                                                                |
| `sound`           | The game soundset for the toll, played `tolls` times. Players within 150 m hear it from the bell. Members further away hear it wherever they are. |
