From 8924007e5588fb6565b5a64803a07443308af867 Mon Sep 17 00:00:00 2001 From: sganggs Date: Mon, 5 Oct 2026 16:14:39 +0800 Subject: [PATCH] =?UTF-8?q?feedback5=20R4:=20content/index.js=20takes=20th?= =?UTF-8?q?e=20kit=20registry=20from=20kits/index.js=20(one=20guarded=20im?= =?UTF-8?q?port=20per=20kit=20file)=20instead=20of=20loading=20the=20six?= =?UTF-8?q?=20tier=20shims;=20KITS=20is=20the=20same=20object=20kits/index?= =?UTF-8?q?.js=20exports=20=E2=80=94=20same=20keys,=20order=20and=20builde?= =?UTF-8?q?rs,=20golden=20unchanged?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/sim/content/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/sim/content/index.js b/server/sim/content/index.js index 39b0a9f2..69e59666 100644 --- a/server/sim/content/index.js +++ b/server/sim/content/index.js @@ -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]]));