Shared state between client and server

This commit is contained in:
2026-10-03 18:45:07 -03:00
parent 63e6248f9f
commit 7417bfd5f1
24 changed files with 656 additions and 193 deletions
+8
View File
@@ -16,6 +16,7 @@ export interface ServerModSource {
// importable urls of the scripts: data: urls in the worker, file urls in tests
server_url?: string;
worldgen_url?: string;
shared_url?: string;
}
export async function start_game(
@@ -44,6 +45,13 @@ export async function start_game(
runtime,
});
// every mod's shared rules first, so server scripts can count on any mod's being there
await runtime.load_shared_scripts(
game,
mods.flatMap((mod) =>
mod.shared_url ? [{ mod: mod.listing.id, version: mod.listing.version, url: mod.shared_url }] : []
),
);
await runtime.load_scripts(
game,
mods.flatMap((mod) =>