2024-06-17 03:31:49 +02:00
|
|
|
import { WorldState } from "@/src/models/worldStateModel";
|
|
|
|
|
|
|
|
export const createWorldState = async () => {
|
2024-06-17 01:32:16 +00:00
|
|
|
const worldState = new WorldState();
|
2024-06-17 03:31:49 +02:00
|
|
|
await worldState.save();
|
|
|
|
return worldState;
|
2024-06-17 01:32:16 +00:00
|
|
|
};
|
2024-06-17 03:31:49 +02:00
|
|
|
|
|
|
|
export const getWorldState = async () => {
|
|
|
|
let ws = await WorldState.findOne();
|
|
|
|
if (!ws) {
|
|
|
|
ws = await createWorldState();
|
|
|
|
}
|
|
|
|
|
|
|
|
return ws;
|
2024-06-17 01:32:16 +00:00
|
|
|
};
|