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. shieldRegenTimer counts down from shieldRegenDelay. Any damage (hull or shield) inside engine/combat/damage.ts resets shieldRegenTimer = shieldRegenDelay and zeroes _shieldBackgroundRegen. Hull damage continues to apply normally during this phase.
  • Phase 2 — Background fill. Only enters when shieldRegenTimer <= 0, shield <= 0, and _shieldRecovering is true. _shieldBackgroundRegen accumulates at dt / shieldRegenFillTime per 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 to shieldMax, recovery flags clear, and _hullPulse clears.

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:

FieldDefaultNotes
shieldRegenDelay4 (s)Time without damage before regen starts
shieldRegenFillTime2 (s)Time to fill 0 → 100% once regen starts
shieldRegenRate6Used only by partial-regen path, scaled by 0.5
shieldRegenTimer0Current countdown, reset to delay on damage
_shieldBackgroundRegen0Progress 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:1088ship.shieldRegenTimer = ship.shieldRegenDelay on any damage
  • engine/combat/damage.ts:1043,1089_shieldBackgroundRegen reset on damage
  • engine/physics/movement.ts:430-455_updateShield (two-phase fill + partial regen)
  • engine/core/state.ts:251-254 — initial defaults
  • engine/core/types.ts:500-506 — type definitions
  • engine/bridge.ts:793shieldRegenFillTime apply from config
  • data/run-config.ts:71,552 — config schema + default
  • data/ships.ts:2495 — per-ship override