Private
Public Access
1
0

feat(gameplay): Adding a military power section to exploit population numbers and steal ennemy tiles

This commit is contained in:
gauvainboiche
2026-03-31 18:27:08 +02:00
parent e04560c7f9
commit 570d83c3c0
10 changed files with 587 additions and 9 deletions

View File

@@ -7,7 +7,7 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
const CONFIG_FILE_PATH =
process.env.CONFIG_FILE_PATH ?? path.join(__dirname, "..", "config", "game.settings.json");
/** @type {{ clickCooldownSeconds: number, databaseWipeoutIntervalSeconds: number, debugModeForTeams: boolean, configReloadIntervalSeconds: number, resourceWorth: object }} */
/** @type {{ clickCooldownSeconds: number, databaseWipeoutIntervalSeconds: number, debugModeForTeams: boolean, configReloadIntervalSeconds: number, resourceWorth: object, militaryPower: object }} */
let cached = {
clickCooldownSeconds: 5,
databaseWipeoutIntervalSeconds: 21600,
@@ -15,6 +15,7 @@ let cached = {
configReloadIntervalSeconds: 30,
elementWorth: {},
resourceWorth: { common: {}, rare: {} },
militaryPower: {},
};
let lastMtimeMs = 0;
@@ -53,8 +54,9 @@ export function loadConfigFile() {
}
if (j.resourceWorth && typeof j.resourceWorth === "object") {
cached.resourceWorth = j.resourceWorth;
}
lastMtimeMs = st.mtimeMs;
} if (j.militaryPower && typeof j.militaryPower === 'object') {
cached.militaryPower = j.militaryPower;
} lastMtimeMs = st.mtimeMs;
} catch (e) {
if (e.code === "ENOENT") {
lastMtimeMs = 0;