mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 19:41:51 +00:00
add 'lowering' generated structures property
This commit is contained in:
parent
d72f758dc5
commit
4b0b643342
6 changed files with 20 additions and 10 deletions
|
|
@ -127,7 +127,7 @@ static VoxelStructureMeta load_structure_meta(
|
|||
) {
|
||||
VoxelStructureMeta meta;
|
||||
meta.name = name;
|
||||
|
||||
config.at("lowering").get(meta.lowering);
|
||||
return meta;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,10 @@ class VoxelFragment;
|
|||
struct GeneratorDef;
|
||||
|
||||
struct VoxelStructureMeta {
|
||||
/// @brief Structure name
|
||||
std::string name;
|
||||
/// @brief Structure lowering on placement
|
||||
int lowering = 0;
|
||||
};
|
||||
|
||||
struct BlocksLayer {
|
||||
|
|
|
|||
|
|
@ -270,10 +270,11 @@ void WorldGenerator::generateStructures(
|
|||
if (height < def.seaLevel) {
|
||||
continue;
|
||||
}
|
||||
auto& structure = *def.structures[structureId]->fragments[rotation];
|
||||
glm::ivec3 position {x, height, z};
|
||||
position.x -= structure.getSize().x / 2;
|
||||
position.z -= structure.getSize().z / 2;
|
||||
auto& structure = *def.structures[structureId];
|
||||
auto& fragment = *structure.fragments[rotation];
|
||||
glm::ivec3 position {x, height-structure.meta.lowering, z};
|
||||
position.x -= fragment.getSize().x / 2;
|
||||
position.z -= fragment.getSize().z / 2;
|
||||
placeStructure(
|
||||
StructurePlacement {
|
||||
structureId,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue