diff options
author | paramat <mat.gregory@virginmedia.com> | 2016-02-04 01:03:31 +0000 |
---|---|---|
committer | paramat <mat.gregory@virginmedia.com> | 2016-02-09 07:14:45 +0000 |
commit | 4adbd69a3701608876b50665ed3f7a150750d26e (patch) | |
tree | de3ec585173cbf4e480004c8d64c23489222677f /src/mapgen_v6.cpp | |
parent | 38e712260046f159aa201259569054bdf9793b7f (diff) | |
download | minetest-4adbd69a3701608876b50665ed3f7a150750d26e.tar.gz minetest-4adbd69a3701608876b50665ed3f7a150750d26e.tar.bz2 minetest-4adbd69a3701608876b50665ed3f7a150750d26e.zip |
FindSpawnPos: Let mapgens decide what spawn altitude is suitable
To avoid spawn search failing in new specialised mapgens
Increase spawn search range to 4000 nodes
Add getSpawnLevelAtPoint() functions to EmergeManager, class Mapgen
and all mapgens
Remove getGroundLevelAtPoint() functions from all mapgens except mgv6
(possibly to be re-added later in the correct form to return actual
ground level)
Make mgvalleys flag names consistent with other mapgens
Remove now unused 'vertical spawn range' setting
Diffstat (limited to 'src/mapgen_v6.cpp')
-rw-r--r-- | src/mapgen_v6.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mapgen_v6.cpp b/src/mapgen_v6.cpp index 57d0f59b3..e24083cff 100644 --- a/src/mapgen_v6.cpp +++ b/src/mapgen_v6.cpp @@ -318,6 +318,17 @@ int MapgenV6::getGroundLevelAtPoint(v2s16 p) } +int MapgenV6::getSpawnLevelAtPoint(v2s16 p) +{ + s16 level_at_point = baseTerrainLevelFromNoise(p) + MGV6_AVERAGE_MUD_AMOUNT; + if (level_at_point <= water_level || + level_at_point > water_level + 16) + return MAX_MAP_GENERATION_LIMIT; // Unsuitable spawn point + else + return level_at_point; +} + + //////////////////////// Noise functions float MapgenV6::getMudAmount(v2s16 p) |