Make cactus generare in deserts

This commit is contained in:
2026-10-10 19:41:51 -03:00
parent 20c5e97599
commit b03ad862e0
5 changed files with 102 additions and 9 deletions
+9 -7
View File
@@ -127,12 +127,14 @@ Deno.test("the template's worldgen feature places boulders, the same way every t
const dir = mods_with_template();
const { game } = await test_game(dir, undefined, "boulder-seed");
const worldgen = game.world.worldgen!;
assertEquals(worldgen.features.map((f) => f.id), ["copper_tools:boulders"]);
// after the base game's, in load order
assertEquals(worldgen.features.map((f) => f.id), ["bworld:cactus", "copper_tools:boulders"]);
// compare against generation without mods: boulders are extra stone on top of the surface
// compare against generation without the template: boulders are extra stone on top of the surface
const without = { ...worldgen, features: worldgen.features.filter((f) => f.id !== "copper_tools:boulders") };
let boulders = 0;
for (let cx = 0; cx < 20; cx++) {
const plain = generate_raw_chunk(cx, 0, "boulder-seed", game.world.block_ids);
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;
if (differences > 0) boulders++;
@@ -142,10 +144,10 @@ Deno.test("the template's worldgen feature places boulders, the same way every t
// loading the script again (like a client does) gives the same terrain
const again = await load_worldgen(
[{
mod: "copper_tools",
url: new URL(`file://${Deno.realPathSync(dir)}/copper_tools/scripts/worldgen.ts`).href,
}],
["bworld", "copper_tools"].map((mod) => ({
mod,
url: new URL(`file://${Deno.realPathSync(dir)}/${mod}/scripts/worldgen.ts`).href,
})),
[],
);
for (let cx = 0; cx < 20; cx++) {