Move world generation outside the engine and into mods and data files

This commit is contained in:
2026-10-11 00:33:59 -03:00
parent afe6e03d4c
commit 3d2b235f64
118 changed files with 8250 additions and 1108 deletions
+2 -3
View File
@@ -61,7 +61,6 @@ import {
number,
word,
} from "$/common/commands.ts";
import { estimate_biome } from "$/common/worldgen/overworld.ts";
import { biome_ids, get_biome } from "$/common/worldgen/biomes.ts";
import type { GameLoop } from "./game_loop.ts";
import { update_crafting_result } from "./crafting.ts";
@@ -160,7 +159,7 @@ interface SavedTile {
export interface GameMods {
listings: ModListing[];
recipes: RecipeBook;
worldgen?: WorldgenSetup;
worldgen: WorldgenSetup;
runtime: ModRuntime;
}
@@ -1304,7 +1303,7 @@ export class GameServer {
for (let dz = -ring; dz <= ring; dz++) {
if (Math.max(Math.abs(dx), Math.abs(dz)) !== ring) continue;
const [cx, cz] = [x + dx * LOCATE_STEP, z + dz * LOCATE_STEP];
const found = estimate_biome(this.world.seed, cx, cz);
const found = this.world.estimate_biome(cx, cz);
const distance = Math.hypot(dx, dz);
if (found.biome === biome && (!best || distance < best.distance)) {
best = { x: cx, y: found.y, z: cz, distance };