convert generator parameters naming to the project style

This commit is contained in:
MihailRis 2024-10-14 04:45:11 +03:00
parent 04e490c896
commit e3c6e55a41
5 changed files with 21 additions and 21 deletions

View File

@ -4,20 +4,20 @@ parameters = [
{weight=0.5, value=0.2}
]
layers = [
{below_sea_level=false, height=1, block="base:grass_block"},
{below_sea_level=false, height=7, block="base:dirt"},
{below-sea-level=false, height=1, block="base:grass_block"},
{below-sea-level=false, height=7, block="base:dirt"},
{height=-1, block="base:stone"},
{height=1, block="base:bazalt"}
]
sea_layers = [
sea-layers = [
{height=-1, block="base:water"}
]
plant_chance = 0.4
plant-chance = 0.4
plants = [
{weight=1, block="base:grass"},
{weight=0.03, block="base:flower"}
]
structure_chance = 0.032
structure-chance = 0.032
structures = [
{name="tree0", weight=1},
{name="tree1", weight=1},
@ -36,7 +36,7 @@ layers = [
{height=-1, block="base:stone"},
{height=1, block="base:bazalt"}
]
sea_layers = [
sea-layers = [
{height=-1, block="base:water"}
]
@ -47,20 +47,20 @@ parameters = [
{weight=0.6, value=0.5}
]
layers = [
{below_sea_level=false, height=1, block="base:grass_block"},
{below_sea_level=false, height=5, block="base:dirt"},
{below-sea-level=false, height=1, block="base:grass_block"},
{below-sea-level=false, height=5, block="base:dirt"},
{height=-1, block="base:stone"},
{height=1, block="base:bazalt"}
]
sea_layers = [
sea-layers = [
{height=-1, block="base:water"}
]
plant_chance = 0.3
plant-chance = 0.3
plants = [
{weight=1, block="base:grass"},
{weight=0.03, block="base:flower"}
]
structure_chance=0.0001
structure-chance=0.0001
structures = [
{name="tree0", weight=1},
{name="tree1", weight=1}

View File

@ -1,4 +1,4 @@
# 1 - temperature
# 2 - humidity
biome_parameters = 2
sea_level = 64
biome-parameters = 2
sea-level = 64

View File

@ -3,6 +3,6 @@ parameters = []
layers = [
{height=-1, block="core:obstacle"}
]
sea_layers = [
sea-layers = [
{height=-1, block="core:obstacle"}
]

View File

@ -1 +1 @@
biome_parameters = 0
biome-parameters = 0

View File

@ -16,7 +16,7 @@ static BlocksLayer load_layer(
const auto& name = map["block"].asString();
int height = map["height"].asInteger();
bool belowSeaLevel = true;
map.at("below_sea_level").get(belowSeaLevel);
map.at("below-sea-level").get(belowSeaLevel);
if (hasResizeableLayer) {
lastLayersHeight += height;
@ -75,11 +75,11 @@ static inline BiomeElementList load_biome_element_list(
}
static inline BiomeElementList load_plants(const dv::value& biomeMap) {
return load_biome_element_list(biomeMap, "plant_chance", "plants", "block");
return load_biome_element_list(biomeMap, "plant-chance", "plants", "block");
}
static inline BiomeElementList load_structures(const dv::value map) {
return load_biome_element_list(map, "structure_chance", "structures", "name");
return load_biome_element_list(map, "structure-chance", "structures", "name");
}
static debug::Logger logger("generator-loader");
@ -105,7 +105,7 @@ static inline Biome load_biome(
auto plants = load_plants(biomeMap);
auto groundLayers = load_layers(biomeMap["layers"], "layers");
auto seaLayers = load_layers(biomeMap["sea_layers"], "sea_layers");
auto seaLayers = load_layers(biomeMap["sea-layers"], "sea-layers");
BiomeElementList structures;
if (biomeMap.has("structures")) {
@ -194,10 +194,10 @@ void ContentLoader::loadGenerator(
}
auto map = files::read_toml(generatorsDir / fs::u8path(name + ".toml"));
map.at("caption").get(def.caption);
map.at("biome_parameters").get(def.biomeParameters);
map.at("biome-parameters").get(def.biomeParameters);
map.at("biome-bpd").get(def.biomesBPD);
map.at("heights-bpd").get(def.heightsBPD);
map.at("sea_level").get(def.seaLevel);
map.at("sea-level").get(def.seaLevel);
map.at("wide-structs-chunks-radius").get(def.wideStructsChunksRadius);
auto folder = generatorsDir / fs::u8path(name + ".files");