Implement main game as a mod

This commit is contained in:
2026-09-24 23:49:34 -03:00
parent bb42dd662e
commit 6458bc0440
131 changed files with 1810 additions and 786 deletions
+10 -1
View File
@@ -1,7 +1,15 @@
import type { ModData, ModListing } from "$/common/mod_loader.ts";
// messages between server/main.ts (the host) and the game server worker
export type HostToGame =
| { type: "init"; save: string | undefined; default_seed: string }
| {
type: "init";
save: string | undefined;
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 }[];
}
| { type: "connect"; conn: number }
| { type: "message"; conn: number; data: string }
| { type: "disconnect"; conn: number }
@@ -10,6 +18,7 @@ export type HostToGame =
export type GameToHost =
| { type: "ready"; seed: string }
| { type: "failed"; error: string }
| { type: "send"; conn: number; data: string }
| { type: "close"; conn: number }
| { type: "save"; data: string; final: boolean };