# arenaHazardsKit.api
The storm ring and the burning lanes, stepped every frame on every peer by the game's run loop.
- `step(dt, settings, body, playing)` moves the ring markers, tints the lanes (off, warning, burning) and hurts this peer's player when it stands in the storm or in the burning lane.
- `radiusAt` and `laneAt` are pure timing functions; `outside`, `time`, `reset` read and clear the state.
- `configure` hands in the damage route (`health` module such as SecondWind, or a `damage` callback), the arena centre, lane names, labels and tick lengths; `new` makes an independent runner; `settingsFromPlan` reads an arenaLayoutKit plan.
# Arena Hazards Kit
A storm ring that closes in and lanes that burn in turn, for arena shooters, twin-stick games, brawlers, battle royale rounds and wave survival.
```luau
local Hazards = require("arenaHazardsKit.api")
Hazards.configure({ health = require("SecondWind.api"), arena = "Arena" })
local settings = { shrinkFrom = 19, shrinkTo = 7, shrinkSeconds = 150, lanePeriod = 9, laneOn = 3, laneDamage = 12 }
function update(dt) -- on every peer
Hazards.step(dt, settings, myPlayerBody, roundIsPlaying)
end
```
## What it does
- **Storm ring.** After `shrinkDelay` seconds (20 by default) a ring of glowing markers around the arena centre closes from `shrinkFrom` to `shrinkTo` metres over `shrinkSeconds`. Standing outside costs `shrinkDamage` (10) every `tick` (0.7 s).
- **Burning lanes.** The arena's lane strips (`Lane1..N`, or any names you give) take turns: each slot of `lanePeriod / laneCount` seconds glows amber as a warning, then burns for `laneOn` seconds. Standing in the burning lane costs `laneDamage` per second.
- **Multiplayer for free.** Every peer runs `step` with its own player; nobody sends anything, and everyone takes the same hazards on the same clock.
## API
- `step(dt, settings, body, playing)` runs one frame. The clock only moves while `playing` is true.
- `radiusAt(settings, t)` and `laneAt(settings, t)` are pure: the ring radius, and which lane burns (and whether it is still warning), at any time.
- `outside(settings, pos)` says whether a position is in the storm now; `time()` reads the clock; `reset()` clears the clock and the markers.
- `configure(config)` sets: `health` (a SecondWind-style module with `damage` and `isAlive`), or `damage = fn(body, amount, label, kind)`; `arena` (entity name or fn returning the centre); `lanePrefixes` (lane `i` is the first entity named `prefix .. i`); `laneVisual`; `markerPrefix`, `markerMaterial`, `ringSegments`; `shrinkDelay`, `shrinkDamage`, `tick`; `team`, `stormLabel`, `laneLabel`; `onEnter(kind, body)`.
- `new(config)` makes an independent runner with its own clock, for a second arena.
- `settingsFromPlan(plan)` turns an **arenaLayoutKit** plan's `shrink` and `lanes` into settings.
Damage is handed in rather than looked up, so the package works in any world: give it SecondWind with `configure({ health = require("SecondWind.api") })`, or any function. Without either, hazards still draw and time but warn once and hurt nobody.
The test suite `arenaHazardsKit` covers the timing, the runners, the storm and lane damage.