Player skins !

This commit is contained in:
2026-09-27 12:01:52 -03:00
parent edf4b72dc4
commit 60188ff735
14 changed files with 325 additions and 8 deletions
+7 -1
View File
@@ -41,6 +41,8 @@ export async function test_game(mods_dir: string, save?: string, seed = "test-se
EverythingRegistry.clear();
const outbox = new Map<number, unknown[]>();
const closed = new Set<number>();
// what host.download gives back, by url. other urls fail
const downloads = new Map<string, Uint8Array>();
const host = {
send: (conn: number, data: string) => {
if (!outbox.has(conn)) outbox.set(conn, []);
@@ -49,6 +51,10 @@ export async function test_game(mods_dir: string, save?: string, seed = "test-se
close(conn: number) {
closed.add(conn);
},
download(url: string) {
const bytes = downloads.get(url);
return bytes ? Promise.resolve(bytes) : Promise.reject(new Error("Couldn't download it"));
},
};
const game: GameServer = await start_game(host, save, seed, mod_sources(mods_dir));
// deno-lint-ignore no-explicit-any
@@ -65,7 +71,7 @@ export async function test_game(mods_dir: string, save?: string, seed = "test-se
send(conn, { type: "ready" });
return take(conn).find((m) => m.type === "join");
};
return { game, take, send, join, closed };
return { game, take, send, join, closed, downloads };
}
export function copy_dir(from: string, to: string) {