feedback5 R4: content/index.js takes the kit registry from kits/index.js (one guarded import per kit file) instead of loading the six tier shims; KITS is the same object kits/index.js exports — same keys, order and builders, golden unchanged
This commit is contained in:
1 parent
1169102d46
commit
8924007e55
1 file changed
+4
-4
@@ -1,7 +1,7 @@
|
||||
// server/sim/content/index.js — installs all content into a Battle (DESIGN §7).
|
||||
//
|
||||
// installContent(battle, { mode }) — applies the per-battle loadout data view (simdata withUnitLoadouts; DESIGN §16),
|
||||
// then mode 'full' (default): hand-authored kits (kits/tier1..6) with generic
|
||||
// then mode 'full' (default): hand-authored kits (kits/index.js: one file per kit in kits/ops/) with generic
|
||||
// fallback + every domain module's install(battle); 'generic': generic kits only, no domain modules;
|
||||
// 'none': no kits (units never cast skills) and no modules. Every module install runs inside try/catch:
|
||||
// a faulty content module is logged and skipped, never crashing the battle.
|
||||
@@ -33,13 +33,13 @@ async function safeImport(path) {
|
||||
}
|
||||
}
|
||||
|
||||
const TIERS = await Promise.all([1, 2, 3, 4, 5, 6].map((t) => safeImport(`./kits/tier${t}.js`)));
|
||||
const KIT_REGISTRY = await safeImport('./kits/index.js');
|
||||
const DOMAIN_NAMES = ['tokens', 'devices', 'enemies', 'bosses', 'bonds', 'garrisons', 'items', 'bands', 'choices'];
|
||||
const DOMAINS = await Promise.all(DOMAIN_NAMES.map((n) => safeImport(`./${n}.js`)));
|
||||
const tokens = DOMAINS[0];
|
||||
|
||||
/** Merged kit registry: baseChessId → (bb, chess, def) => Kit */
|
||||
export const KITS = Object.freeze(Object.assign({}, ...TIERS.map((m) => (m && m.default && typeof m.default === 'object' ? m.default : {}))));
|
||||
/** Merged kit registry: baseChessId → (bb, chess, def) => Kit (kits/index.js; each kit file is loaded guarded too) */
|
||||
export const KITS = KIT_REGISTRY.KITS ?? Object.freeze({});
|
||||
|
||||
/** Domain modules in install order: tokens, devices, enemies, bosses, bonds, garrisons, items, bands, choices. */
|
||||
export const MODULES = Object.freeze(DOMAIN_NAMES.map((n, i) => [n, DOMAINS[i]]));
|
||||
|
||||
Reference in new issue
Block a user