Wooooorld files

This commit is contained in:
2026-11-06 23:41:32 -03:00
parent 1fa47c027d
commit 8e14e9842a
9 changed files with 501 additions and 383 deletions
+3 -6
View File
@@ -17,10 +17,7 @@ import { PROTOCOL_VERSION } from "@/common/protocol.ts";
import { decode_level_chunk, type LevelChunk } from "@/common/chunk_streaming.ts";
import { decode_chunk, encode_chunk } from "@/server/game/saves.ts";
import { list_chunks, read_chunk, write_chunks } from "@/server/regions.ts";
import { DEFAULT_SHAPE } from "@/common/world_shape.ts";
// the base game's dimension, which the test worlds play
const VOLUME = DEFAULT_SHAPE.volume;
import { section_index } from "@/common/section.ts";
const ENGINE_TEXTURES = ["cubi:missing", ...Array.from({ length: 9 }, (_, i) => `cubi:break_${i}`)];
@@ -407,8 +404,8 @@ Deno.test({
await write_chunks(
region,
await Promise.all(saved.map(async ([x, z]) => {
const chunk = decode_chunk((await read_chunk(region, x, z))!, VOLUME);
chunk.blocks[VOLUME - 256] = chunk.palette.push(["bworld:stone", 0]) - 1;
const chunk = decode_chunk((await read_chunk(region, x, z))!);
chunk.sections.at(-1)!.set(section_index(0, 15, 0), chunk.palette.push(["bworld:stone", 0]) - 1);
return { x, z, data: encode_chunk(chunk as Required<typeof chunk>) };
})),
);