data/weapons.ts

Top-level barrel re-export for the weapons data domain. The legacy import path @/data/weapons is preserved here; the actual implementation, per-weapon specs, helpers, and legendary definitions live under ./weapons/ (a sibling subdirectory). This file declares nothing of its own — it has no runtime logic, no types, no constants, no side effects beyond the re-exports. Consumers should import from data/weapons (this barrel) rather than reaching into data/weapons/* directly.

Source comment is explicit: “Barrel re-export — all weapon types and data now live in ./weapons/. This file preserves the original import path for all existing consumers.”

λ — The crossing surface

Single export { ... } from './weapons/index' block. Every symbol below is a forwarded re-export; nothing originates here.

Type re-exports

SymbolOrigin (inside ./weapons/)Role
WeaponFamily_typesWeapon-family tag union (rifle / shotgun / etc.)
TargetMode_typesTarget-selection mode for WeaponBehavior
CollisionMode_typesProjectile collision rule
WeaponBehavior_typesDiscriminated behavior contract per weapon
ScalingCurve_typesStat-scaling curve identifier (linear / curve remap)
AreaMode_typesArea / radius interpretation mode
WeaponStat_typesSingle-stat record { base, scaling }
SteppedStat_typesStepped stat (level-keyed sparse table)
WeaponCoreSpec_typesFull weapon definition shape (every entry in WEAPONS)
EnemyWeaponDef_typesEnemy-side weapon-spec shape (consumed by enemy shooters)
WeaponTaglegendariesTag identifier used for legendary-pair lookup

Value re-exports — helpers

SymbolOriginPurpose
getEffectiveLevel_helpersRemap level 1..20 through ScalingCurve
getWeaponStatAtLevel_helpersResolve a WeaponStat at a given level
getSteppedStatAtLevel_helpersResolve a SteppedStat at a given level
getProbabilisticSteppedStat_helpersStochastic variant of getSteppedStatAtLevel
getVfxTier_helpersVFX-tier resolution from level
getWeaponDamageMult_helpersDamage multiplier including legendary baseline
LEGENDARY_DAMAGE_BASELINE_MULT_helpersConstant baseline multiplier applied to legendaries

Value re-exports — catalog

SymbolOriginPurpose
WEAPONSweapons/indexFull weapon array (17 canonical + legendaries appended via spread)
WEAPON_MAPweapons/indexRecord<weaponId, WeaponCoreSpec> built from WEAPONS
WEAPON_ORDERweapons/indexOrdered weaponId[] for UI display
getExtraProjectilesweapons/indexBonus-projectile lookup keyed on weaponId × more_projectiles horizontal level
RARITY_COLORSweapons/indexUI border / label color map keyed on rarity string
resolveWeaponRarityweapons/indexReturns 'common' | 'legendary' for a weapon def (flattened rarity)

Value re-exports — enemy weapons

SymbolOriginPurpose
ENEMY_WEAPON_STATS_enemyEnemy-side weapon stat table

Value re-exports — legendaries

SymbolOriginPurpose
LEGENDARY_WEAPONSlegendariesThe 10 merge-result weapon defs
LEGENDARY_PAIR_MAPlegendariesMap keyed by canonical pair key → legendary id
getLegendaryForPairlegendariesLookup helper: two WeaponTags → legendary id (if any)
pairKeylegendariesCanonical key builder for a tag pair
sortTagPairlegendariesSorts a tag pair so pairKey is order-independent

Κ — Consumer contract

  • Import path stability. All existing consumers historically imported from @/data/weapons (or relative equivalents). This barrel exists solely to keep that path valid after the per-weapon split into ./weapons/*.ts. Do not change consumer import paths to reach into ./weapons/index or ./weapons/_types directly.
  • Type-vs-value split. Type re-exports use export { type X, ... } syntax (inline type modifier on each symbol), so they are erased at build and contribute zero to the runtime bundle. Value re-exports forward at runtime.
  • No barrel-private symbols. Anything not in the explicit export { ... } list here is not part of the public surface — consumers must not reach into ./weapons/_types, ./weapons/_helpers, ./weapons/_enemy, ./weapons/legendaries, or per-weapon spec files (./weapons/rifle, ./weapons/shotgun, etc.) from outside this domain.
  • Single source-of-truth file. The full forwarding list lives only at ./weapons/index.ts. This top-level barrel re-exports from ./weapons/index (not from each leaf), so adding or removing a symbol requires editing ./weapons/index.ts, not this file.

Σ — What is not re-exported

./weapons/index.ts exports a superset of what this barrel forwards. Symbols defined in ./weapons/index.ts that are not re-exported through data/weapons.ts:

  • Per-weapon spec named exports (rifle, shotgun, railgun, missile, lightning, revolver, cannon, mortar, disc, flame, defy, sweep, line, barrier, fire_trail, fire_ring, burst, magnetar, coilgun). These are consumed inside ./weapons/index.ts to build the WEAPONS array; external consumers read them indirectly via WEAPON_MAP / WEAPONS.

The barrel surface is intentionally narrower than the internal subdirectory surface.

Π — Where this flows

  • Consumed by: every runtime module that touches weapon data — engine/weapons/*, engine/weapons/archetypes.ts, reward generation, UI ship/weapon screens, mod-grid services, telemetry, balance tooling.
  • Reaches: ./weapons/index.ts exclusively. All other ./weapons/*.ts files are transitively reachable only through that index.
  • No imports. This file imports nothing — it only re-exports. (Compare ./weapons/index.ts, which imports per-weapon specs to assemble WEAPONS.)

EXTRACT-CANDIDATE

  • This file is a one-line barrel (single export { ... } from './weapons/index' block). Once all known consumers have been audited to confirm none rely on the legacy data/weapons path, the file can be deleted and consumers can import from data/weapons/index directly. Until then the file is load-bearing as a compat shim — verify with a repo-wide grep for from .*data/weapons['"] (no trailing /) before removal.
  • The re-export list duplicates the export list inside ./weapons/index.ts. Drift between the two surfaces is possible (adding a symbol in weapons/index.ts without forwarding it here makes it inaccessible at the legacy path). A typecheck-time assertion (e.g., a test that imports both modules and confirms key set equality) would catch drift mechanically.
  • Type re-exports are flagged via the inline type modifier (type WeaponFamily, type TargetMode, …). Equivalent semantics could be expressed with a single export type { ... } block followed by a separate value export { ... } block, which is how ./weapons/index.ts itself is structured. Aligning the two for consistency is cosmetic but reduces cognitive load when comparing files side-by-side.