World shape for dimension

This commit is contained in:
2026-11-06 22:49:43 -03:00
parent 7458a2d42a
commit 818ce22dd6
60 changed files with 749 additions and 349 deletions
+6 -2
View File
@@ -17,6 +17,10 @@ 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;
const ENGINE_TEXTURES = ["cubi:missing", ...Array.from({ length: 9 }, (_, i) => `cubi:break_${i}`)];
@@ -403,8 +407,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))!);
chunk.blocks[255 * 256] = chunk.palette.push(["bworld:stone", 0]) - 1;
const chunk = decode_chunk((await read_chunk(region, x, z))!, VOLUME);
chunk.blocks[VOLUME - 256] = chunk.palette.push(["bworld:stone", 0]) - 1;
return { x, z, data: encode_chunk(chunk as Required<typeof chunk>) };
})),
);