3D biomes

This commit is contained in:
2026-11-07 12:13:43 -03:00
parent b726ce9695
commit 22191d260c
53 changed files with 874 additions and 316 deletions
+9 -2
View File
@@ -4,7 +4,14 @@
// a generator: noise settings, and the density functions, noises and biome rules it uses. compiled once for each
// seed, see NoiseTerrain. the data comes from mods' worldgen folders, see docs/modding/worldgen/terrain.md
import { EverythingRegistry } from "../everything_registry.ts";
import type { BiomeRuleJson, BiomeSourceJson, DensityFunctionJson, NoiseJson, NoiseSettingsJson } from "./data.ts";
import {
type BiomeRuleJson,
type BiomeSourceJson,
type DensityFunctionJson,
type NoiseJson,
type NoiseSettingsJson,
RULE_NAMES,
} from "./data.ts";
import type { DensitySources } from "./density.ts";
import { NoiseTerrain } from "./terrain.ts";
@@ -75,7 +82,7 @@ function merge_rules(settings: NoiseSettingsJson, sources: BiomeSourceJson[]): B
rules.splice(rule.before ? at : at + 1, 0, rule);
}
}
const names = new Set([...Object.keys(settings.climate), "surface", "steep"]);
const names = new Set([...Object.keys(settings.climate), ...RULE_NAMES]);
const seen = new Set<string>();
for (const rule of rules) {
if (seen.has(rule.id)) throw new Error(`biome source ${base.id}: two rules are called ${rule.id}`);