PURPOSE

Provides a unified read-only adapter layer over four game-data domains (ships, weapons, enemies, artifacts) for the playground’s right-panel editor. Each adapter exposes a consistent shape so the editor UI can list entities, enumerate tunable stat definitions, and read current numeric values without knowing the underlying data-table format.

OWNS

  • StatConfig interface — describes a single editable stat slot (key, label, min, max, step, category).
  • DataAdapter interface — the common adapter contract (type, getAll, getById, getStatDefs, getStatValue, getSavedValue).
  • Four concrete adapter constants: ShipAdapter, WeaponAdapter, EnemyAdapter, ArtifactAdapter.
  • Three local stat-definition tables: SHIP_STATS, WEAPON_STATS, ENEMY_STATS.
  • The DATA_ADAPTERS registry keyed by adapter type and the DATA_ADAPTER_LIST of registry keys.

READS FROM

  • ../../data/shipsHULL_CLASSES, getShipDef.
  • ../../data/weaponsWEAPONS, WEAPON_MAP.
  • ../../data/enemiesENEMY_TYPES, ENEMY_TYPE_MAP.
  • ../../data/artifactsARTIFACT_DEFS, ARTIFACT_MAP.

PUSHES TO

Nothing. This module is read-only; it exposes adapter objects for consumers to import. There are no writes, no store mutations, no events.

DOES NOT

  • Does not mutate game data tables.
  • Does not persist edits — getSavedValue currently aliases getStatValue for every adapter; there is no separate saved-overrides store.
  • Does not render UI; it only supplies data shape.
  • Does not validate stat ranges against the source data; the min/max/step values are editor hints only.
  • Does not handle hot-reload, level scaling beyond the ship-adapter calling getShipDef(id, 1), or tier traversal beyond the single artifact tier-0 template.

Signals

None. No event emission, no subscriptions. Adapters are pure functions over the imported data.

Entry points

  • DATA_ADAPTERS — registry consumed by the playground editor to pick an adapter by string key ('ships', 'weapons', 'enemies', 'artifacts').
  • DATA_ADAPTER_LIST — list of registry keys.
  • Individual named exports ShipAdapter, WeaponAdapter, EnemyAdapter, ArtifactAdapter for direct imports.
  • StatConfig and DataAdapter types for downstream typing.

Pattern notes

  • All adapters conform to the same DataAdapter shape, letting the editor stay generic over data type.
  • Stat keys may be dotted paths. WeaponAdapter.getStatValue splits on . and walks two levels (e.g. damage.base); ArtifactAdapter uses tierN.<valueKey> and parses the tier index from the prefix.
  • ShipAdapter.getById swallows errors from getShipDef and returns null so missing/invalid ids do not throw.
  • WeaponAdapter.getAll filters out entries marked disabled.
  • EnemyAdapter.getAll de-duplicates by id using a Set while preserving first-seen order from ENEMY_TYPES.
  • ArtifactAdapter.getStatDefs derives stat slots from the first artifact’s tier-0 values keys, converts camelCase to spaced labels via a regex, and uses fixed editor bounds (min: 0, max: 1000, step: 0.1).
  • Methods that need this (e.g. getStatValue calling this.getById) are defined with the function keyword rather than arrow form so the adapter object binds as receiver.
  • getSavedValue is a stub aliasing getStatValue on every adapter — placeholder for a future saved-overrides path.