feat: sync worldstate on config change
All checks were successful
Build / build (pull_request) Successful in 1m12s

This commit is contained in:
2025-11-04 16:47:48 +01:00
parent 2264ae176b
commit 24c9baf363
2 changed files with 3 additions and 1 deletions

View File

@@ -2,7 +2,7 @@ import type { RequestHandler } from "express";
import { config, syncConfigWithDatabase } from "../../services/configService.ts";
import { getAccountForRequest, isAdministrator } from "../../services/loginService.ts";
import { saveConfig } from "../../services/configWriterService.ts";
import { sendWsBroadcastEx } from "../../services/wsService.ts";
import { sendWsBroadcastEx, sendWsBroadcast } from "../../services/wsService.ts";
export const getConfigController: RequestHandler = async (req, res) => {
const account = await getAccountForRequest(req);
@@ -26,6 +26,7 @@ export const setConfigController: RequestHandler = async (req, res) => {
obj[idx] = value;
}
sendWsBroadcastEx({ config_reloaded: true }, undefined, parseInt(String(req.query.wsid)));
sendWsBroadcast({ sync_world_state: true });
syncConfigWithDatabase();
await saveConfig();
res.end();

View File

@@ -92,6 +92,7 @@ interface IWsMsgToClient {
// to game/bootstrapper (https://openwf.io/bootstrapper-manual)
sync_inventory?: boolean;
sync_world_state?: boolean;
tunables?: ITunables;
}