Move trees out of cubi

This commit is contained in:
2026-11-13 22:55:30 -03:00
parent d48fa8cca5
commit c74ddedd6e
23 changed files with 69 additions and 208 deletions
+1 -8
View File
@@ -19,7 +19,6 @@ const PLAIN = { id: "my_mod:flat", surface: { top: "bworld:grass_block", filler:
Deno.test("the bworld mod registers every biome the overworld picks", async () => {
await test_game("mods");
assertEquals(biome_ids().length, 26);
assertEquals(get_biome("bworld:dark_forest")?.trees?.wood.big_oak, "dark_oak");
assertEquals(get_biome("bworld:river")?.surface.underwater_top, "bworld:sand");
});
@@ -49,22 +48,16 @@ Deno.test("a biome follows the calendar unless it says otherwise", async () => {
});
Deno.test("a biome's surface defaults: underwater is its filler, cliffs aren't bare", () => {
const { surface, colors, trees } = biome_from_json(PLAIN);
const { surface, colors } = biome_from_json(PLAIN);
assertEquals(surface.underwater_top, "bworld:dirt");
assertEquals(surface.underwater_filler, "bworld:dirt");
assertEquals(surface.bare_cliffs, false);
assertEquals(colors, { grass: undefined, foliage: undefined, water: undefined });
assertEquals(trees, undefined);
});
Deno.test("bad biome json is reported", () => {
assertEquals(validate_biome(PLAIN), []);
assert(validate_biome({ ...PLAIN, season: "monsoon" }).some((p) => p.startsWith("season")));
assert(validate_biome({ ...PLAIN, colors: { grass: "green" } }).some((p) => p.startsWith("colors.grass")));
// which kinds of tree there are is up to the trees feature, see tests/wood_test.ts
assertEquals(validate_biome({ ...PLAIN, trees: { chance: 2, kinds: ["palm"] } }), [
"trees.chance must be at most 1",
]);
assert(validate_biome({ ...PLAIN, trees: { chance: 1, kinds: [] } }).some((p) => p.startsWith("trees.kinds")));
assert(validate_biome({ id: "my_mod:flat" }).some((p) => p.startsWith("surface")));
});