Shield Regen Delay
Shield regeneration pauses for shieldRegenDelay seconds (default 4s) after any damage. Once the delay expires, the shield refills over shieldRegenFillTime seconds (default 2s). Any new damage during either phase resets shieldRegenTimer to the full delay and cancels in-progress regen.
Two-phase regen
Implemented in engine/physics/movement.ts::_updateShield:
- Phase 1 — Delay.
shieldRegenTimercounts down fromshieldRegenDelay. Any damage (hull or shield) insideengine/combat/damage.tsresetsshieldRegenTimer = shieldRegenDelayand zeroes_shieldBackgroundRegen. Hull damage continues to apply normally during this phase. - Phase 2 — Background fill. Only enters when
shieldRegenTimer <= 0,shield <= 0, and_shieldRecoveringis true._shieldBackgroundRegenaccumulates atdt / shieldRegenFillTimeper frame. Shield is not active during the fill — damage still routes to hull. Any incoming damage cancels the fill and resets back to Phase 1. - Snap to full. When
_shieldBackgroundRegen >= 1.0, shield is set toshieldMax, recovery flags clear, and_hullPulseclears.
Partial regen path
If shield is still > 0 after a hit (the hit didn’t break it), the legacy rate-based regen applies once shieldRegenTimer reaches 0: shield += shieldRegenRate * 0.5 * dt per frame, clamped to shieldMax. This bypasses the background-fill phase entirely.
Defaults
From engine/core/state.ts (initial player state) and data/run-config.ts:
| Field | Default | Notes |
|---|---|---|
shieldRegenDelay | 4 (s) | Time without damage before regen starts |
shieldRegenFillTime | 2 (s) | Time to fill 0 → 100% once regen starts |
shieldRegenRate | 6 | Used only by partial-regen path, scaled by 0.5 |
shieldRegenTimer | 0 | Current countdown, reset to delay on damage |
_shieldBackgroundRegen | 0 | Progress 0 → 1 during background fill |
Invulnerability
No i-frames are granted at any point during shield recovery. The shield only protects once the fill completes and snaps to shieldMax.
References
engine/combat/damage.ts:1088—ship.shieldRegenTimer = ship.shieldRegenDelayon any damageengine/combat/damage.ts:1043,1089—_shieldBackgroundRegenreset on damageengine/physics/movement.ts:430-455—_updateShield(two-phase fill + partial regen)engine/core/state.ts:251-254— initial defaultsengine/core/types.ts:500-506— type definitionsengine/bridge.ts:793—shieldRegenFillTimeapply from configdata/run-config.ts:71,552— config schema + defaultdata/ships.ts:2495— per-ship override