Prevent spawning in rivers with valleys mapgen. Remove unecessary whitespace.

master
Duane Robertson 2016-01-16 03:53:02 -06:00 committed by paramat
parent a58c0f458d
commit 752d820206
2 changed files with 61 additions and 47 deletions

View File

@ -185,19 +185,19 @@ MapgenValleys::~MapgenValleys()
MapgenValleysParams::MapgenValleysParams() MapgenValleysParams::MapgenValleysParams()
{ {
spflags = MG_VALLEYS_CLIFFS | MG_VALLEYS_RUGGED spflags = MG_VALLEYS_CLIFFS | MG_VALLEYS_RUGGED
| MG_VALLEYS_HUMID_RIVERS | MG_VALLEYS_ALT_CHILL; | MG_VALLEYS_HUMID_RIVERS | MG_VALLEYS_ALT_CHILL;
altitude_chill = 90; // The altitude at which temperature drops by 20C. altitude_chill = 90; // The altitude at which temperature drops by 20C.
// Water in caves will never be higher than this. // Water in caves will never be higher than this.
cave_water_max_height = MAX_MAP_GENERATION_LIMIT; cave_water_max_height = MAX_MAP_GENERATION_LIMIT;
humidity = 50; humidity = 50;
// the maximum humidity around rivers in otherwise dry areas // the maximum humidity around rivers in otherwise dry areas
humidity_break_point = 65; humidity_break_point = 65;
lava_max_height = 0; // Lava will never be higher than this. lava_max_height = 0; // Lava will never be higher than this.
river_depth = 4; // How deep to carve river channels. river_depth = 4; // How deep to carve river channels.
river_size = 5; // How wide to make rivers. river_size = 5; // How wide to make rivers.
temperature = 50; temperature = 50;
water_features = 3; // How often water will occur in caves. water_features = 3; // How often water will occur in caves.
np_cliffs = NoiseParams(0.f, 1.f, v3f(750, 750, 750), 8445, 5, 1.f, 2.f); np_cliffs = NoiseParams(0.f, 1.f, v3f(750, 750, 750), 8445, 5, 1.f, 2.f);
np_corr = NoiseParams(0.f, 1.f, v3f(40, 40, 40), -3536, 4, 1.f, 2.f); np_corr = NoiseParams(0.f, 1.f, v3f(40, 40, 40), -3536, 4, 1.f, 2.f);
@ -285,7 +285,7 @@ void MapgenValleys::makeChunk(BlockMakeData *data)
data->blockpos_requested.Z <= data->blockpos_max.Z); data->blockpos_requested.Z <= data->blockpos_max.Z);
this->generating = true; this->generating = true;
this->vm = data->vmanip; this->vm = data->vmanip;
this->ndef = data->nodedef; this->ndef = data->nodedef;
//TimeTaker t("makeChunk"); //TimeTaker t("makeChunk");
@ -603,9 +603,23 @@ float MapgenValleys::humidityByTerrain(
} }
inline int MapgenValleys::getGroundLevelAtPoint(v2s16 p) int MapgenValleys::getGroundLevelAtPoint(v2s16 p)
{ {
// Base terrain calculation // ***********************************************
// This method (deliberately) does not return correct
// terrain values. This may be a problem in the future.
// ***********************************************
// Since MT doesn't normally deal with rivers, check
// to make sure this isn't a request for a location
// in a river.
float rivers = NoisePerlin2D(&noise_rivers->np, p.X, p.Y, seed);
// If it's wet, return an unusable number.
if (fabs(rivers) < river_size)
return MAX_MAP_GENERATION_LIMIT;
// Otherwise, return the real result.
return terrainLevelAtPoint(p.X, p.Y); return terrainLevelAtPoint(p.X, p.Y);
} }

View File

@ -100,7 +100,7 @@ public:
~MapgenValleys(); ~MapgenValleys();
virtual void makeChunk(BlockMakeData *data); virtual void makeChunk(BlockMakeData *data);
inline int getGroundLevelAtPoint(v2s16 p); int getGroundLevelAtPoint(v2s16 p);
private: private:
EmergeManager *m_emerge; EmergeManager *m_emerge;