Region file format

This commit is contained in:
2026-09-27 23:45:07 -03:00
parent a6869eeb59
commit 677ad8115a
18 changed files with 666 additions and 567 deletions
+4 -2
View File
@@ -1,11 +1,12 @@
import type { ModData, ModListing } from "$/common/mod_loader.ts";
import type { WorldSave } from "./saves.ts";
// messages between server/main.ts (the host) and the game server worker
export type HostToGame =
| {
type: "init";
save: string | undefined;
save: WorldSave;
default_seed: string;
// in load order, with the scripts' code since the worker can't read files
mods: { listing: ModListing; data: ModData; server_code?: string; worldgen_code?: string }[];
@@ -23,6 +24,7 @@ export type GameToHost =
| { type: "failed"; error: string }
| { type: "send"; conn: number; data: string }
| { type: "close"; conn: number }
| { type: "save"; data: string; final: boolean }
// level.json and the chunks that changed
| { type: "save"; save: Required<WorldSave>; final: boolean }
// the worker can't use the network, so the host fetches urls for it, like skins
| { type: "download"; id: number; url: string; max_bytes: number };