feat: New features (research, invest, gambling, new game+, trophies)

This commit is contained in:
gauvainboiche
2026-10-08 14:03:00 +02:00
parent 1caa4d92b9
commit fc0d5e3ba4
56 changed files with 4332 additions and 249 deletions
+3 -5
View File
@@ -1,17 +1,15 @@
import { readFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
import { buildContext } from '../public/js/engine/context.js';
import { DATA_FILES } from '../public/js/services/data.js';
export const PUBLIC_DIR = fileURLToPath(new URL('../public/', import.meta.url));
export const readJson = (relativePath) => JSON.parse(readFileSync(PUBLIC_DIR + relativePath, 'utf8'));
export function loadContext() {
return buildContext({
rules: readJson('data/rules.json'),
generators: readJson('data/generators.json'),
upgrades: readJson('data/upgrades.json'),
});
const entries = Object.entries(DATA_FILES).map(([key, file]) => [key, readJson(`data/${file}.json`)]);
return buildContext(Object.fromEntries(entries));
}
/** Flatten nested locale JSON to dotted keys, like services/i18n.js does. */