fix: Fixing the MP power bonus + seed maintenance

This commit is contained in:
gauvainboiche
2026-04-03 14:25:19 +02:00
parent b11446cf56
commit d345c025c0
11 changed files with 349 additions and 132 deletions
+6 -3
View File
@@ -1,7 +1,7 @@
import "dotenv/config";
import { createServer } from "http";
import { loadConfigFile, getConfig } from "./configLoader.js";
import { initGameSchema, ensureSeedEpoch } from "./db/gameDb.js";
import { initGameSchema, ensureSeedEpoch, persistCurrentSettings } from "./db/gameDb.js";
import { initUsersSchema } from "./db/usersDb.js";
import app from "./app.js";
import { startEconTick } from "./econTick.js";
@@ -14,9 +14,10 @@ function makeConfigSignature(cfg) {
return JSON.stringify({
dailyActionQuota: cfg.dailyActionQuota,
teamActionQuota: cfg.teamActionQuota,
actionsResetIntervalHours: cfg.actionsResetIntervalHours,
actionsResetIntervalSeconds: cfg.actionsResetIntervalSeconds,
databaseWipeoutIntervalSeconds: cfg.databaseWipeoutIntervalSeconds,
configReloadIntervalSeconds: cfg.configReloadIntervalSeconds,
timingEpochSec: cfg.timingEpochSec ?? 0,
elementWorth: cfg.elementWorth ?? {},
resourceWorth: cfg.resourceWorth ?? { common: {}, rare: {} },
militaryPower: cfg.militaryPower ?? {},
@@ -37,14 +38,16 @@ function scheduleConfigPoll() {
const cfg = getConfig();
const nextSig = makeConfigSignature(cfg);
if (beforeSig && nextSig !== beforeSig) {
await persistCurrentSettings();
broadcast("config-updated", {
worldSeed,
config: {
dailyActionQuota: cfg.dailyActionQuota,
teamActionQuota: cfg.teamActionQuota,
actionsResetIntervalHours: cfg.actionsResetIntervalHours,
actionsResetIntervalSeconds: cfg.actionsResetIntervalSeconds,
databaseWipeoutIntervalSeconds: cfg.databaseWipeoutIntervalSeconds,
configReloadIntervalSeconds: cfg.configReloadIntervalSeconds,
timingEpochSec: cfg.timingEpochSec ?? 0,
elementWorth: cfg.elementWorth ?? {},
resourceWorth: cfg.resourceWorth ?? { common: {}, rare: {} },
militaryPower: cfg.militaryPower ?? {},