Block registry api

This commit is contained in:
2026-11-12 20:41:13 -03:00
parent e7fe663746
commit 76802ed430
39 changed files with 499 additions and 100 deletions
-9
View File
@@ -125,12 +125,3 @@ function script_of(mod: ServerModSource) {
config: mod.data.config ?? {},
};
}
export function data_url(code: string) {
const bytes = new TextEncoder().encode(code);
let binary = "";
for (let i = 0; i < bytes.length; i += 0x8000) {
binary += String.fromCharCode(...bytes.subarray(i, i + 0x8000));
}
return `data:application/javascript;base64,${btoa(binary)}`;
}
+2 -1
View File
@@ -7,7 +7,8 @@
import type { GameServer } from "./game_server.ts";
import { GameLoop } from "./game_loop.ts";
import { GameToHost, HostToGame, READ_DONE, READ_HEADER, READ_TOO_SMALL, READ_WAITING } from "./host_protocol.ts";
import { data_url, start_game } from "./load_mods.ts";
import { start_game } from "./load_mods.ts";
import { data_url } from "@/common/mod.ts";
import { type WorkerPort, WorldgenPool } from "./worldgen_pool.ts";
const SAVE_INTERVAL_MS = 30_000;