Move world generation outside the engine and into mods and data files

This commit is contained in:
2026-10-11 00:33:59 -03:00
parent afe6e03d4c
commit 3d2b235f64
118 changed files with 8250 additions and 1108 deletions
+7 -3
View File
@@ -10,8 +10,12 @@ Deno.test("the overworld generates the same way every time, with water only belo
for (let cx = -4; cx < 4; cx++) {
for (let cz = -4; cz < 4; cz++) {
const { blocks } = generate_raw_chunk(cx, cz, "worldgen-test", ids);
assertEquals(blocks, generate_raw_chunk(cx, cz, "worldgen-test", ids).blocks, "same chunk, same blocks");
const { blocks } = generate_raw_chunk(cx, cz, "worldgen-test", ids, game.world.worldgen);
assertEquals(
blocks,
generate_raw_chunk(cx, cz, "worldgen-test", ids, game.world.worldgen).blocks,
"same chunk, same blocks",
);
for (let i = 0; i < CHUNK_AREA; i++) {
assert(blocks[i] !== 0, "the bottom of the world is solid");
@@ -55,7 +59,7 @@ Deno.test("trees grow on the ground, never closer than 4 blocks, even across chu
let spilled_leaves = 0;
for (let cx = -6; cx < 6; cx++) {
for (let cz = -6; cz < 6; cz++) {
const { blocks, spills } = generate_raw_chunk(cx, cz, game.world.seed, ids);
const { blocks, spills } = generate_raw_chunk(cx, cz, game.world.seed, ids, game.world.worldgen);
blocks.forEach((block, i) => {
if (logs.has(block) && ground.has(blocks[i - CHUNK_AREA])) {
const x = cx * 16 + (i % 16);