Workers for chunk generation !
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
import { register_mod_data } from "$/common/mod_loader.ts";
|
||||
import type { ModData, ModListing } from "$/common/mod_loader.ts";
|
||||
import { load_worldgen } from "$/common/worldgen_loader.ts";
|
||||
import { worldgen_bundle } from "$/common/worldgen_bundle.ts";
|
||||
import { GameHost, GameServer } from "./game_server.ts";
|
||||
import type { WorldSave } from "./saves.ts";
|
||||
import { ModRuntime } from "./mod_runtime.ts";
|
||||
@@ -73,6 +74,17 @@ export async function start_game(
|
||||
mods.flatMap((mod) => mod.server_url ? [{ ...script_of(mod), url: mod.server_url }] : []),
|
||||
);
|
||||
runtime.finish_setup();
|
||||
// what a worldgen worker needs to generate the same chunks, see worldgen_pool.ts
|
||||
game.worldgen_bundle = worldgen_bundle(
|
||||
game.world.seed,
|
||||
GENERATOR,
|
||||
mods.map((mod) => ({
|
||||
id: mod.listing.id,
|
||||
data: mod.data,
|
||||
worldgen_url: mod.worldgen_url,
|
||||
engine_access: mod.listing.engine_access,
|
||||
})),
|
||||
);
|
||||
runtime.after.server_start.emit({});
|
||||
|
||||
return game;
|
||||
|
||||
Reference in New Issue
Block a user