# corex-redzones

> Five fixed red zones (Zancudo, Humane Labs, Chiliad Peak, Smuggler Port, Paleto Bunker). Aggressive zombie density, loot crates, and environmental health drain force quick extraction.

{% hint style="info" %}
**Depends on:** `corex-core` · **Version:** `1.0.0`
{% endhint %}

## Quick Facts

| Dependencies | Server Exports | Built-in zones | Crate model         |
| ------------ | -------------- | -------------- | ------------------- |
| `corex-core` | 1              | 5              | `prop_mil_crate_01` |

## Overview

Fixed-location high-risk zones. Each has crate spawn points and a single "big box" coordinate. Zombie density is elevated and the type pool is restricted to elite variants (`Config.StrongZombieTypes`). Players inside take periodic environmental damage from `Config.HealthDrain`.

## Quick Start

```cfg
ensure corex-core
ensure corex-redzones
```

Zones are defined in config — they spawn automatically on resource start.

## Configuration

### Timing

| Key                                | Default     | Description                      |
| ---------------------------------- | ----------- | -------------------------------- |
| `Config.Debug`                     | `false`     | Enable verbose red-zone logging  |
| `Config.CheckInterval`             | `500`       | Ms between membership checks     |
| `Config.RefillMinutes.min` / `max` | `30` / `60` | Random cadence for crate refills |

### Crates

| Key                             | Default               | Description                   |
| ------------------------------- | --------------------- | ----------------------------- |
| `Config.CrateModel`             | `'prop_mil_crate_01'` | Model for standard crates     |
| `Config.CrateInteractDistance`  | `2.5`                 | Meters to trigger loot prompt |
| `Config.LootItemsPerCrate`      | `{min=5, max=10}`     | Items per crate               |
| `Config.BigLootBox.model`       | `'prop_mil_crate_02'` | Big box model (one per zone)  |
| `Config.BigLootBox.itemsPerBox` | `{min=5, max=10}`     | Items per big box             |

### Health drain

`Config.HealthDrain` applies while a player is inside a red zone:

| Field           | Default | Description             |
| --------------- | ------- | ----------------------- |
| `enabled`       | `true`  | Master toggle           |
| `tickInterval`  | `4000`  | Ms between damage ticks |
| `amountPerTick` | `1`     | HP per tick             |

### Visuals & audio

| Key                      | Description                                                        |
| ------------------------ | ------------------------------------------------------------------ |
| `Config.Vignette`        | Red screen tint while inside (`r=120, g=0, b=0, alpha=60`)         |
| `Config.Audio.soundName` | `'Radio_Static_Loop'` — ambient loop                               |
| `Config.Blip`            | Map blip styling (`centerSprite=303`, `labelPrefix='RED ZONE — '`) |

### Strong zombie types

`Config.StrongZombieTypes` — the 7-type pool that spawns inside red zones (subset of `corex-zombies`'s type list, with buffed stats):

* `brute` (health 650, armor 80, damage 48)
* `runner` (buffed)
* `grabber`
* `electric` (with `stunOnHit = 1500`)
* `burning`
* `toxic`
* `stormbringer`

Each entry has the same schema as [corex-zombies Config.ZombieTypes](https://github.com/ABUGIZA/corex-docs/blob/main/content/guides/zombie-variants.md).

### Zombie density

`Config.ZombieDensity`:

| Field                           | Default         | Description                      |
| ------------------------------- | --------------- | -------------------------------- |
| `min` / `max`                   | `30` / `45`     | Zombies per zone                 |
| `refillInterval`                | `6000`          | Ms between density checks        |
| `spawnRingMin` / `spawnRingMax` | `35.0` / `90.0` | Spawn ring (meters) from players |

### Loot tiers (per crate)

`Config.LootTiers` — 4 tiers by rarity:

| Chance | Pool                                                                               |
| ------ | ---------------------------------------------------------------------------------- |
| 0.45   | Ammo + medical (rifle\_ammo, medkit, antidote, canned\_food, …)                    |
| 0.35   | Weapons (CARBINERIFLE, ASSAULTRIFLE\_MK2, SPECIALCARBINE, COMBATSHOTGUN, SMG\_MK2) |
| 0.15   | Blueprints + rare weapons (blueprint\_medkit, blueprint\_antidote, TECPISTOL)      |
| 0.05   | Minigun / RPG / rifle blueprint                                                    |

`Config.BigLootBox.tiers` has its own 4-tier structure with similar shape but generally higher quantities.

### Zones

`Config.Zones` — the five fixed red zones:

| id              | Name                 | coords              | radius | crates |
| --------------- | -------------------- | ------------------- | ------ | ------ |
| `zancudo`       | Fort Zancudo         | `(-2300, 3400, 32)` | 150    | 4      |
| `humane_labs`   | Humane Labs          | `(3600, 3700, 30)`  | 150    | 3      |
| `chiliad_peak`  | Mount Chiliad Peak   | `(450, 5570, 780)`  | 120    | 3      |
| `smuggler_port` | Smuggler Port        | `(1200, -3100, 5)`  | 150    | 4      |
| `paleto_bunker` | Paleto Forest Bunker | `(-800, 5800, 35)`  | 140    | 3      |

Each has a `bigBox` coord for the special big loot box.

## Server Exports

### `GetZoneManifest()`

Returns the full runtime manifest — zones, crate states, next refill times.

```lua
local manifest = exports['corex-redzones']:GetZoneManifest()
for _, zone in ipairs(manifest) do
    print(zone.id, zone.name, #zone.crates)
end
```

## Events

Server-side:

* `corex-redzones:server:requestManifest` — client asks for zone data
* `corex-redzones:server:enteredZone(source, zoneId)` — entry
* `corex-redzones:server:leftZone(source, zoneId)` — exit
* `corex-redzones:server:searchCrate` — client tries to loot a crate

Client-side:

* `corex-redzones:client:manifest(data)` — server pushes the manifest
* `corex-redzones:client:searchCrate` — start search flow
* `corex-redzones:client:setSpawnHost` — ownership assignment for a zone

{% hint style="info" %}
High-level "crate looted" signals aren't emitted as events; observe via the crate-search result flow or hook `corex-inventory:server:itemAdded` path (if you implement one).
{% endhint %}

## Troubleshooting

**Players take damage even briefly — feels unfair.** → `tickInterval` is short (`4000` = every 4 seconds). Raise it if you want more relaxed pacing.

**Crates never refill.** → Refill is randomized in `Config.RefillMinutes`. At `max = 60`, a crate can go an hour. Reduce the upper bound if needed.

**Zombie density feels wrong.** → `Config.ZombieDensity` caps at `max = 45` per zone — this is independent of the global zombie cap in `corex-zombies`. Tune both.

**Custom zones.** → Append to `Config.Zones` with your own `id`, `coords`, `radius`, `crates` array, and `bigBox` coord. No code changes needed.

## Further reading

* [Resources → corex-zombies](https://corex-zombies.gitbook.io/corex-docs/resources/world/corex-zombies) — the type definitions `StrongZombieTypes` shares schema with
* [Guides → Safe & Red Zones](https://github.com/ABUGIZA/corex-docs/blob/main/content/guides/safe-red-zones.md) — entry/exit event handling


---

# 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://corex-zombies.gitbook.io/corex-docs/resources/world/corex-redzones.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.
