mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Biomes/decorations/ores: Make relative to 'water_level' setting
Add 'biome_zero_level' argument to 'generateBiomes()', 'deco_zero_level' argument to 'placeAllDecos()' and 'ore_zero_level' to 'placeAllOres()' to allow mapgens to vertically shift the registered biomes, decorations and ores per-mapchunk. Will also allow many realm possibilities in future mapgens.
This commit is contained in:
parent
ef285b2815
commit
8299e4b67e
14 changed files with 90 additions and 43 deletions
|
@ -621,7 +621,7 @@ MapgenBasic::~MapgenBasic()
|
|||
}
|
||||
|
||||
|
||||
MgStoneType MapgenBasic::generateBiomes()
|
||||
MgStoneType MapgenBasic::generateBiomes(s16 biome_zero_level)
|
||||
{
|
||||
// can't generate biomes without a biome generator!
|
||||
assert(biomegen);
|
||||
|
@ -673,7 +673,10 @@ MgStoneType MapgenBasic::generateBiomes()
|
|||
(air_above || !biome);
|
||||
|
||||
if (is_stone_surface || is_water_surface) {
|
||||
biome = biomegen->getBiomeAtIndex(index, y);
|
||||
// Limit to +-MAX MAP GENERATION LIMIT to work with biome y_min / y_max.
|
||||
s32 relative_y = rangelim(y - biome_zero_level,
|
||||
-MAX_MAP_GENERATION_LIMIT, MAX_MAP_GENERATION_LIMIT);
|
||||
biome = biomegen->getBiomeAtIndex(index, relative_y);
|
||||
|
||||
if (biomemap[index] == BIOME_NONE && is_stone_surface)
|
||||
biomemap[index] = biome->index;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue