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
+10 -1
View File
@@ -13,6 +13,10 @@ import { clear_hooks, expose_engine } from "$/common/hooks.ts";
import { common_engine } from "$/common/engine_modules.ts";
import { server_engine } from "./engine_modules.ts";
// the generator worlds use: a mod's worldgen/noise_settings, the base game's overworld. the server doesn't start
// without it
const GENERATOR = "bworld:overworld";
export interface ServerModSource {
listing: ModListing;
data: ModData;
@@ -42,7 +46,12 @@ export async function start_game(
? [{ mod: mod.listing.id, url: mod.worldgen_url, engine_access: mod.listing.engine_access }]
: []
);
const worldgen = await load_worldgen(worldgen_scripts, recipes.ores);
const worldgen = await load_worldgen({
mods: mods.map((mod) => mod.listing.id),
scripts: worldgen_scripts,
ores: recipes.ores,
generator: GENERATOR,
});
const runtime = new ModRuntime();
// before the world loads, its mobs can have effects