From 4adbd69a3701608876b50665ed3f7a150750d26e Mon Sep 17 00:00:00 2001 From: paramat Date: Thu, 4 Feb 2016 01:03:31 +0000 Subject: 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 --- src/mapgen_v6.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/mapgen_v6.cpp') 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) -- cgit v1.2.3