Biome as data

This commit is contained in:
2026-10-08 13:34:32 -03:00
parent 9f0b049148
commit 7e7ac8f6f4
49 changed files with 913 additions and 224 deletions
+5 -4
View File
@@ -3,7 +3,7 @@ import { assert, assertEquals } from "@std/assert";
import { BlockRegistry, EverythingRegistry } from "$/common/everything_registry.ts";
import { CHUNK_AREA, CHUNK_HEIGHT, CHUNK_SIZE } from "$/common/constants.ts";
import { generate_raw_chunk } from "$/common/generation.ts";
import { BIOME_FOLIAGE_COLORS, BIOME_GRASS_COLORS, BIOME_WATER_COLORS } from "$/common/worldgen/biome_colors.ts";
import { get_biome } from "$/common/worldgen/biomes.ts";
import { type LayerMesh, TERRAIN_VERTEX_BYTES } from "$/client/workers/chunk_messages.ts";
import { test_game } from "./helpers.ts";
@@ -121,9 +121,10 @@ Deno.test("every column the overworld generates has a biome with grass, foliage
const { biomes } = generate_raw_chunk(x, z, game.world.seed, block_ids);
assertEquals(biomes.length, CHUNK_AREA);
for (const biome of biomes) {
assert(biome in BIOME_GRASS_COLORS, `${biome} has no grass color`);
assert(biome in BIOME_FOLIAGE_COLORS, `${biome} has no foliage color`);
assert(biome in BIOME_WATER_COLORS, `${biome} has no water color`);
const { colors } = get_biome(biome)!;
assert(colors.grass !== undefined, `${biome} has no grass color`);
assert(colors.foliage !== undefined, `${biome} has no foliage color`);
assert(colors.water !== undefined, `${biome} has no water color`);
}
}
});