fix: Fixing the MP power bonus + seed maintenance
This commit is contained in:
+6
-3
@@ -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 ?? {},
|
||||
|
||||
Reference in New Issue
Block a user