Danger, protection, supplies, medical effects
CBRN simulation internals
A per-client simulation. Every player machine evaluates its own exposure from fog, zones or a custom provider; there is no authoritative server hazard state, so no network tick is spent on it.
1. The local tick
cbrnStart installs a CBA frame handler and ACE actions for the local unit. Each tick obtains a fresh
configuration with cbrnGetConfig and exits early when the unit is dead, the soul sequence is running, or
the simulation was stopped. Delta time is clamped to five seconds so a frame hitch cannot drain a whole filter.
2. Danger resolution
- Safe predicate — a mission callback can declare an interior safe.
- Custom provider — if present it replaces everything below and must return a number without suspension.
- Fog layer — when
followWorldFogis true, danger is derived from livefogParamsscaled by altitude, then mapped betweenfogDangerStartandfogDangerFull. A ceiling (fogTopASLorfogTopProvider) fades danger out overfogTransitionmetres. - Zones — each zone contributes full strength inside
innerRadiusand fades linearly toradius, filtered by min/max ASL. Zone danger and fog danger are combined withmax. - Clamp — the result is clamped to
maxDanger.
Occupants of a vehicle and Zeus players are treated as sheltered: danger and supply drain are dropped, exposure recovers, load traits and radio range are restored, and the HUD hides. The tick keeps running so effects resume immediately on exit.
3. Protection modes
| Mode | Requires | Drain |
|---|---|---|
air | Connected SCBA backpack | airUseRate plus fatigue; multiplied by scbaUseMultiplier. |
backpackFilter | Connected combination backpack with cartridge minutes | Filter rate plus hazard plus a low-stamina bonus based on ACE anaerobic reserve. |
maskFilter | Fitted filter in compatible facewear | Filter rate plus hazard; stamina does not change filter use. |
none | — | No protection: exposure accumulates. |
cbrnGetProtection tracks the fitted mask family independently of the two visual APR classes, so switching
the NATO respirator between filter and no-filter models does not reset the remaining minutes. Backpack supplies are
stored on the backpack container, which survives a respawn when the loadout is preserved.
4. Exposure, pain and stamina
Effective danger is reduced by a worn CBRN suit; with filtration and no suit, suitLeak of the danger
remains as skin exposure. Exposure accumulates as danger/maxDanger * dt and decays with
recoveryRate. Crossing damageThreshold applies damageAmount ACE body damage and
subtracts the threshold. Pain is applied per second from painRate, and is skipped for filtered players
unless missingSuitPainEnabled is on.
A separate breathing-stress value ramps up while unfiltered and decays after filtration resumes. It drives a
loadCoef multiplier (the original trait is restored on stop), a stamina cap and extra blur. The multiplier
is recomputed from the current trait, so ACE or another system can recalculate load without being overwritten blindly.
5. State and cleanup
- Per-unit keys:
FF_horror_cbrnExposure,cbrnDanger,cbrnBreathStress,cbrnMaskMinutes,cbrnConnected,cbrnConnectedBackpack,cbrnAppliedLoadCoef. - Backpack key:
FF_horror_cbrnMinutes— also used by refill stations. - Machine state: blur handle, HUD control, previous TFAR coefficient, warning timers, last published danger/protection.
cbrnStopdestroys the blur, restores TFAR and load traits, clears the HUD and removes inactivity state.
6. Extension points
dangerProviderfor a reactor, scripted plume or mission-specific sensor network.onDangerChanged/onProtectionChangedfor HUDs, audio and mission triggers.- Class arrays for gear, so mods with their own respirators and suits work without code changes.
cbrnGiveItemandcbrnUseItemfor scripted filter installation and refills.
Related functions
FF_cbrn_fnc_cbrnGetConfig— Builds effective CBRN settings from CBA defaults and mission overrides.FF_cbrn_fnc_cbrnGetDanger— Returns local chemical danger from a custom provider, altitude layer, and zones.FF_cbrn_fnc_cbrnGetProtection— Resolves facewear, backpack, and remaining filter or air protection.FF_cbrn_fnc_cbrnStart— Starts local CBRN simulation, ACE actions, and detector effects for the player.FF_cbrn_fnc_cbrnStop— Stops local CBRN simulation and releases detector/HUD effects.FF_cbrn_fnc_cbrnTick— Advances local CBRN exposure, filtration, ACE effects, supply bar, and detector.FF_cbrn_fnc_cbrnUseItem— Connects a respirator or consumes a matching FF_Horror replacement filter.FF_cbrn_fnc_cbrnDecontaminate— Clears accumulated local CBRN exposure after a mission decontamination action.