SpaceNinjaServer/src/controllers/dynamic/worldStateController.ts

16 lines
634 B
TypeScript
Raw Normal View History

2023-05-19 15:22:48 -03:00
import { RequestHandler } from "express";
2025-06-19 22:36:14 +02:00
import { getWorldState, populateFissures } from "@/src/services/worldStateService";
import { version_compare } from "@/src/helpers/inventoryHelpers";
2023-05-19 15:22:48 -03:00
2025-06-19 22:36:14 +02:00
export const worldStateController: RequestHandler = async (req, res) => {
const buildLabel = req.query.buildLabel as string | undefined;
const worldState = getWorldState(buildLabel);
// Omitting void fissures for versions prior to Dante Unbound to avoid script errors.
if (!buildLabel || version_compare(buildLabel, "2024.03.24.20.00") >= 0) {
await populateFissures(worldState);
}
res.json(worldState);
};