Engine entity work

This commit is contained in:
2026-11-21 11:07:22 -03:00
parent e1c2b13d1f
commit edce5bac29
5 changed files with 277 additions and 12 deletions
+4 -2
View File
@@ -38,8 +38,11 @@ export async function start_game(
expose_engine({ common: common_engine(), server: server_engine() });
const recipes = register_mod_data(mods.map((mod) => ({ id: mod.listing.id, data: mod.data })));
const runtime = new ModRuntime();
for (const mod of mods) {
for (const json of mod.data.entities) register_entity_type(json.id, mod_entity_factory(json));
for (const json of mod.data.entities) {
register_entity_type(json.id, mod_entity_factory(json, runtime.entity_behaviors));
}
}
const dimension = default_dimension(mods);
@@ -59,7 +62,6 @@ export async function start_game(
const problem = cell_height_problem(shape, [terrain.cell_height, caves.cell_height]);
if (problem) throw new Error(`dimension ${dimension.id} can't be generated by ${generator}: ${problem}`);
const runtime = new ModRuntime();
// before the world loads, its mobs can have effects
set_effect_types(runtime.effect_types());
const game = new GameServer(host, save, default_seed, {