World sections
This commit is contained in:
@@ -139,7 +139,8 @@ Deno.test("the template's worldgen feature places boulders, the same way every t
|
||||
for (let cx = 0; cx < 20; cx++) {
|
||||
const plain = generate_raw_chunk(cx, 0, "boulder-seed", game.world.block_ids, without);
|
||||
const modded = generate_raw_chunk(cx, 0, "boulder-seed", game.world.block_ids, worldgen);
|
||||
const differences = plain.blocks.filter((b, i) => b !== modded.blocks[i]).length;
|
||||
const [plain_blocks, modded_blocks] = [plain.column.to_flat(), modded.column.to_flat()];
|
||||
const differences = plain_blocks.filter((b, i) => b !== modded_blocks[i]).length;
|
||||
if (differences > 0) boulders++;
|
||||
assert(differences <= 1, `chunk ${cx} changed ${differences} blocks`);
|
||||
}
|
||||
@@ -158,8 +159,8 @@ Deno.test("the template's worldgen feature places boulders, the same way every t
|
||||
});
|
||||
for (let cx = 0; cx < 20; cx++) {
|
||||
assertEquals(
|
||||
generate_raw_chunk(cx, 0, "boulder-seed", game.world.block_ids, again).blocks,
|
||||
generate_raw_chunk(cx, 0, "boulder-seed", game.world.block_ids, worldgen).blocks,
|
||||
generate_raw_chunk(cx, 0, "boulder-seed", game.world.block_ids, again).column.to_flat(),
|
||||
generate_raw_chunk(cx, 0, "boulder-seed", game.world.block_ids, worldgen).column.to_flat(),
|
||||
);
|
||||
}
|
||||
Deno.removeSync(dir, { recursive: true });
|
||||
@@ -186,11 +187,12 @@ Deno.test("mod ores generate into the block they replace", async () => {
|
||||
const ore = game.world.block_ids["copper_tools:example_block"];
|
||||
let found = 0;
|
||||
for (let cx = 0; cx < 4; cx++) {
|
||||
const blocks = generate_raw_chunk(cx, 0, "test-seed", game.world.block_ids, game.world.worldgen).blocks;
|
||||
const raw = generate_raw_chunk(cx, 0, "test-seed", game.world.block_ids, game.world.worldgen);
|
||||
const blocks = raw.column.to_flat();
|
||||
blocks.forEach((b, i) => {
|
||||
if (b === ore) {
|
||||
found++;
|
||||
assert(Math.floor(i / 256) <= 60, "ore above max_y");
|
||||
assert(game.world.shape.min_y + Math.floor(i / 256) <= 60, "ore above max_y");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user