> ## Documentation Index
> Fetch the complete documentation index at: https://docs.czautoz.co.uk/llms.txt
> Use this file to discover all available pages before exploring further.

# Vehicle Cannon

> The BTR-4E's turret cannon: who aims and fires it, the fire key, aiming and the gunner's screen, ammo, firing rules, shell size, shell damage to players, vehicles, zombies and animals, and every cannon setting.

Vehicles Core runs the turret cannon on armed CZ Autoz vehicles. In the range that is the **BTR-4E**, in both the [Offroad Pack](https://docs.czautoz.co.uk/vehicles/packs/offroad-pack.md) and the BTR-4E single mod.

## Who fires it

**Gunner seat (0 = driver, 1 = front passenger)** decides which seat controls the cannon:

* **Driver** (`0`, default): the driver aims and fires while driving
* **Front passenger** (`1`): the front passenger seat is the gunner's seat

Only the player in that seat can aim and fire. The gun follows the server's aim at once: the next gunner doesn't inherit the last aim, and a player who stops being the gunner no longer keeps the barrel at their own aim.

## Firing and aiming

* **Sight:** **Vehicle Cannon: Sight On / Off**, on the **right mouse button** by default, switches the gunner's view to a zoomed sight at the barrel and back to your normal view. Turn it with the mouse and zoom with the **mouse wheel** (x1.5 to x10)
* **Fire:** **Vehicle Cannon: Fire**, on the **left mouse button** by default. A gunner in his own seat fires from the normal view or through the sight. When the gunner seat is the driver's seat (a server setting), the cannon fires **only through the sight**, where the game's own actions (such as **Stop engine**) are switched off, so the driver can't stop the engine by firing. What a press does depends on the **fire mode** (below); **hold** it in BURST or AUTO to keep firing after every pause until you let go. It doesn't fire while a menu is open. All four cannon keys (sight, fire, fire mode and change ammo box) are under **CZ Autoz Vehicles Core** in **Options → Controls**
* **Aim:** the turret follows **where your camera looks** (through the sight, where the sight looks), within its limits: about 160° either side of straight ahead, and from about 10° down to 57° up
* **Turn speed:** **Turret turn speed (deg/s)** sideways (60° a second by default); up and down at 70 % of that
* If the gunner leaves the seat, dies, or sends no aim for 30 seconds (for example with a menu open), the turret goes back to its rest position, pointing straight ahead

## The gunner's screen

Only the player in the gunner's seat sees it.

* **The crosshair** sits where the shell is expected to land. It follows the barrel's real direction, the shell speed, the vehicle's own speed and the drop of the shell, so it trails behind your view while the turret is still turning. It hides when that point is behind you
* **The CANNON panel** at the bottom centre shows the rounds ready to fire against a full box (*20/20*) with your spare ammo boxes under it (*+2 BOXES*), a reload bar (yellow while reloading, green when ready), the turret's **AZ** and **EL** angles and the **RANGE** to the aim point, the sight key (*SIGHT …*), the fire mode (*SINGLE*, *BURST* or *AUTO*) and the state, one of:

| State | Meaning |
| - | - |
| **READY** (green) | Ready to fire |
| **FIRING** (yellow) | A burst is firing |
| **RELOADING** (yellow) | Waiting for the pause after the last shot or burst |
| **LOADING BOX** (yellow) | You are holding the change ammo box key |
| **NO AMMO - HOLD R** (red) | The box in the gun is empty, or there is none. It names your change ammo box key |
| **NO SPARE BOX** (red) | No ammo box with rounds in your inventory or the vehicle's |
| **NO FULLER BOX** (red) | Every spare box holds no more rounds than the one in the gun |
| **BOX CHANGE FAILED** (red) | The box in the gun couldn't be taken out. Nothing changed, so try again |
| **START THE ENGINE** (red) | The engine must be running |
| **SAFE ZONE** (red) | The vehicle is inside a no-damage zone |
| **CANNON OFF** (red) | **Cannon can fire** is off for this vehicle |

## The sight

The sight shows a centre reticle (where the sight looks), the shell crosshair (where the shell will land), the **zoom**, the state, the **HE** rounds (*20/20*), your spare boxes and the fire mode at the top, and the **RANGE**, a reload bar and the **AZ** / **EL** angles at the bottom, with the keys along the bottom edge. It closes when you leave the seat.

## Fire modes

**Vehicle Cannon: Fire Mode** (**V** by default) steps through the ZTM-1's selector. The mode shows on the gunner's panel and in the sight. The server can switch modes off with **Fire modes allowed** (see [Settings](#settings)): the key then skips them.

| Mode | What a press fires | Then waits |
| - | - | - |
| **SINGLE** | One aimed round | 0.6 seconds |
| **BURST** (default) | Up to **Rounds per burst** (5 by default) at the high rate, about 330 a minute | **Pause between bursts (seconds)** (2 by default) |
| **AUTO** | Up to **Rounds per run** (12 by default) at the low rate, about 220 a minute | 1.5 times **Pause between bursts**, while the barrel cools |

Each round has the heavy, low report of a 30 mm automatic cannon, heard a long way off.

## Changing the ammo box

Each **BTR-4E 30mm Ammo Box** is one magazine of 20 rounds. The box in the gun is the loaded magazine, and its rounds are the rounds ready to fire.

To load a box, the gunner holds **Vehicle Cannon: Change Ammo Box** (**R** by default) for **Change ammo box: hold time** (3 seconds by default). It works whenever the box in the gun isn't full, so you can change a part-used box early, like a rifle's magazine. The bar on the panel shows the progress, and letting go early cancels it.

* **Which box goes in:** the fullest box in your own inventory, or, if you carry none, the fullest anywhere in the vehicle's inventory. It must hold more rounds than the box in the gun
* **The box that comes out:** a part-used box goes back into your inventory, or onto the ground beside the vehicle if you have no room, so no rounds are lost. An empty box is thrown away once the new one is in
* A burst stops for the change; press fire again once the new box is in
* With no box anywhere, the panel shows **NO SPARE BOX**; with only boxes that hold fewer rounds than the one in the gun, **NO FULLER BOX**

## Ammo

| | |
| - | - |
| **Item** | `ShellBTR4E`, *BTR-4E 30mm Ammo Box*: a military ammo can holding **20** rounds, 15.5 kg full. Boxes never merge into one stack: each box is one magazine |
| **Slot** | **BTR-4E Ammo Box** on the vehicle. The loaded box isn't drawn on the vehicle |
| **Rounds on the screen** | The rounds in the loaded box against a full box (*20/20*), and how many spare boxes with rounds you and the vehicle hold |

The BTR-4E's ZTM-1 is a 30 mm automatic cannon, fired in SINGLE, BURST or AUTO (see **Fire modes**); let go to stop a burst early. Each round uses one round of ammo. Rounds knock over trees, bushes, fences, poles and signs near where they burst, while the admin panel's knock settings allow it — with them off, nothing falls (never buildings, walls or anything players built, and nothing in a no-damage zone). The ammo box only fits vehicles with a cannon. The cannon fires high-explosive (**HE**) shells only; the **Shell size** setting decides how big the explosion is, and the **Shell damage** settings how much it hurts each kind of target.

## Firing rules

A shot only fires when **all** of these are true:

* **Cannon can fire** is on for the vehicle
* the **engine is running** and the vehicle isn't destroyed
* the wait after the last burst (**Pause between bursts**) has passed
* there is at least one round in the box in the **BTR-4E Ammo Box** slot
* the vehicle is **not inside a no-damage zone**

Each burst is recorded in the vehicle's history as *Cannon fired by …*, when **Keep a driver and event history** is on.

## Shells in flight

* A shell leaves the barrel at **Shell speed (m/s)** plus the vehicle's own speed, and drops with gravity on the way
* It flies up to **Shell range (m)**. A shell that reaches the end of its range disappears **without exploding**
* When it hits something, it explodes. The damage counts as coming from the gunner (or from the vehicle, if the gunner has died)
* A direct hit on a tree fells it
* **No-damage zones:** a shell that lands inside one does no damage and doesn't fell trees
* **Player bases:** with **Shells damage player-built bases** off, shells do no damage to base-building structures

Every player hears the shot and sees the muzzle flash and the shell in flight with its smoke trail. The shell carries a tracer light that only shows at night.

### Shell size

**Shell size** sets how big the blast is and how hard it hits. Full force reaches the blast radius, then fades out to three times that distance.

| Shell size | Full force within | Fades out by | Damage | Shock |
| - | - | - | - | - |
| **1** (light, default) | 3 m | about 9 m | 70 | 25 |
| **2** | 4 m | about 12 m | 110 | 40 |
| **3** | 5 m | about 15 m | 160 | 60 |
| **4** | 6 m | about 18 m | 230 | 80 |
| **5** (very heavy) | 7 m | about 21 m | 330 | 100 |

The blast size can only be changed with **Shell size**.

### Shell damage

Three settings scale what the blast does to each kind of target. Each is a multiplier, so `1` is the damage in the table above, `0.5` is half, `2` is double and `0` means shells never hurt that kind of target.

| Setting | What it scales |
| - | - |
| **Shell damage to players (x)** | Health and shock damage to players |
| **Shell damage to vehicles (x)** | Damage to any vehicle (CZ Autoz, vanilla or another mod's) and its doors, wheels, hood and other fitted parts. On a CZ Autoz car it is multiplied with that car's own **Explosion damage (x)**: a car set to `0.5` hit by a cannon set to `2` takes normal damage. On a fitted part the two are multiplied the same way |
| **Shell damage to zombies and animals (x)** | Damage to zombies and animals |

The setting that counts is the **firing** vehicle's. A kill still counts as the gunner's.

## Recoil

With **Firing pushes the vehicle back** on, each shot pushes the vehicle back along the barrel. The BTR-4E's push strength is set in its own config.

## Settings

These are in the **Cannon** section of the [admin panel](https://docs.czautoz.co.uk/vehicles/core/admin-panel.md#cannon). They only show for a scope that has a turret vehicle (All vehicles, the Offroad Pack, the BTR-4E single mod or the BTR-4E itself) and only do anything on a vehicle with a cannon. Each can be set for all vehicles, a pack or mod, or one vehicle, and is read every time it is used, so changes apply at once.

| Setting | What it does | Default | Range |
| - | - | - | - |
| **Cannon can fire** `CannonEnabled` | Off = the cannon can't fire | On | On/off |
| **Gunner seat (0 = driver, 1 = front passenger)** `CannonGunner` | Which seat controls the cannon: `0` = the driver, `1` = the front passenger | Driver (`0`) | `0` – `1` |
| **Shell size: blast and damage (1 light to 5 heavy)** `CannonPower` | How big the blast is and how hard it hits, see [Shell size](#shell-size) | `1` | `1` – `5` |
| **Shell damage to players (x)** `CannonPlayerDamage` | Scales the blast on players, see [Shell damage](#shell-damage). `0` = shells never hurt players | `1` | `0` – `5` |
| **Shell damage to vehicles (x)** `CannonVehicleDamage` | Scales the blast on vehicles and their fitted parts | `1` | `0` – `5` |
| **Shell damage to zombies and animals (x)** `CannonCreatureDamage` | Scales the blast on zombies and animals | `1` | `0` – `5` |
| **Fire modes allowed (1 Single + 2 Burst + 4 Auto, 7 = all)** `CannonModes` | Add `1` for SINGLE, `2` for BURST, `4` for AUTO: `7` = all three, `3` = SINGLE and BURST, `1` = SINGLE only. The fire mode key skips the others | `7` | `1` – `7` |
| **Rounds per burst (Burst mode)** `CannonBurstRounds` | Most rounds one press fires in BURST | `5` | `1` – `30` |
| **Rounds per run (Auto mode)** `CannonAutoRounds` | Most rounds one press fires in AUTO | `12` | `1` – `50` |
| **Change ammo box: hold time (seconds)** `CannonBoxChangeTime` | How long the gunner holds the change ammo box key | `3` | `1` – `10` |
| **Pause between bursts (seconds)** `CannonReload` | The pause after each burst (AUTO waits 1.5 times this, SINGLE always 0.6 seconds) | `2` | `0.5` – `30` |
| **Shell speed (m/s)** `CannonSpeed` | How fast shells leave the barrel | `970` | `100` – `1500` |
| **Shell range (m)** `CannonRange` | How far a shell flies before it disappears | `2000` | `200` – `4000` |
| **Turret turn speed (deg/s)** `CannonTurnSpeed` | How fast the turret turns sideways | `60` | `10` – `180` |
| **Shells damage player-built bases** `CannonBaseDamage` | On = shells damage player-built bases (walls, gates, towers). Off by default, so raiding with the cannon is the server owner's choice | Off | On/off |
| **Firing pushes the vehicle back** `CannonRecoil` | Off = no push back when firing | On | On/off |

> [!NOTE]
>
> **BTR-4E shell settings file.** If your server profile has `CZAutoz\OffroadPack\ShellBTR4ESettings.json` or `CZAutoz\BTR4E\ShellBTR4ESettings.json`, Core turns its `maxDamage` into the BTR-4E's **Shell size** (up to 80 → 1, up to 150 → 2, up to 250 → 3, up to 400 → 4, higher → 5), unless Shell size is already set for that vehicle, and renames the file to end in `.old`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.