Move world generation outside the engine and into mods and data files
This commit is contained in:
@@ -22,6 +22,13 @@ import { png_size, texture_size_problem } from "$/common/bmod.ts";
|
||||
import { type TextureJson, validate_texture_json } from "$/common/texture_animation.ts";
|
||||
import { type LootTableJson, validate_loot_table } from "$/common/loot.ts";
|
||||
import { validate_biome } from "$/common/worldgen/biomes.ts";
|
||||
import {
|
||||
validate_biome_source,
|
||||
validate_density_function,
|
||||
validate_noise,
|
||||
validate_noise_settings,
|
||||
} from "$/common/worldgen/data.ts";
|
||||
import { validate_feature } from "$/common/worldgen/features.ts";
|
||||
import { dirname } from "@std/path";
|
||||
|
||||
export { load_order, type LoadedMod, type ModReport };
|
||||
@@ -84,6 +91,11 @@ function load_mod(mods_dir: string, id: string): LoadedMod {
|
||||
tags: [],
|
||||
loot_tables: [],
|
||||
biomes: [],
|
||||
noises: [],
|
||||
density_functions: [],
|
||||
noise_settings: [],
|
||||
biome_sources: [],
|
||||
features: [],
|
||||
textures: [],
|
||||
texture_files: new Map(),
|
||||
texture_json: new Map(),
|
||||
@@ -150,6 +162,11 @@ function load_mod(mods_dir: string, id: string): LoadedMod {
|
||||
load_data("entities", "entity", validate_entity, mod.entities);
|
||||
load_data("effects", "effect", validate_effect, mod.effects);
|
||||
load_data("worldgen/biomes", "biome", validate_biome, mod.biomes);
|
||||
load_data("worldgen/noise", "noise", validate_noise, mod.noises);
|
||||
load_data("worldgen/density_function", "density_function", validate_density_function, mod.density_functions);
|
||||
load_data("worldgen/noise_settings", "noise_settings", validate_noise_settings, mod.noise_settings);
|
||||
load_data("worldgen/biome_source", "biome_source", validate_biome_source, mod.biome_sources);
|
||||
load_data("worldgen/features", "feature", validate_feature, mod.features);
|
||||
|
||||
for (const file of walk(`${dir}/models`, ".geo.json")) {
|
||||
const path = `models/${file}`;
|
||||
|
||||
Reference in New Issue
Block a user