diff --git a/src/environment.cpp b/src/environment.cpp index 3730817..8170391 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -1173,8 +1173,14 @@ void ServerEnvironment::step(float dtime) MapNode n_top = m_map->getNodeNoEx(p+v3s16(0,1,0)); if (content_features(n_top).air_equivalent) { if (p.Y > (coldzone+10) && p.Y < 1024) { - n.setContent(CONTENT_MUDSNOW); - m_map->addNodeWithEvent(p, n); + // should only change to snow if there's nothing above it + std::vector search; + search.push_back(CONTENT_SNOW); + search.push_back(CONTENT_AIR); + if (!searchNearInv(p,v3s16(0,0,0),v3s16(0,32,0),search,NULL)) { + n.setContent(CONTENT_MUDSNOW); + m_map->addNodeWithEvent(p, n); + } }else if (n_top.getLightBlend(getDayNightRatio()) >= 13) { if (season == ENV_SEASON_AUTUMN || season == ENV_SEASON_WINTER) { n.setContent(CONTENT_GROWING_GRASS_AUTUMN); @@ -1424,8 +1430,14 @@ void ServerEnvironment::step(float dtime) || myrand_range(0,10) == 0 ) ) { - n.setContent(CONTENT_MUDSNOW); - m_map->addNodeWithEvent(p, n); + // should only change to snow if there's nothing above it + std::vector search; + search.push_back(CONTENT_SNOW); + search.push_back(CONTENT_AIR); + if (!searchNearInv(p,v3s16(0,0,0),v3s16(0,32,0),search,NULL)) { + n.setContent(CONTENT_MUDSNOW); + m_map->addNodeWithEvent(p, n); + } }else if ( ( season == ENV_SEASON_WINTER @@ -1478,9 +1490,15 @@ void ServerEnvironment::step(float dtime) if ((season == ENV_SEASON_SPRING && myrand_range(0,10) == 0) || season == ENV_SEASON_SUMMER) { n.setContent(CONTENT_GRASS); m_map->addNodeWithEvent(p,n); - }else if (season == ENV_SEASON_WINTER && (ch > 10 || myrand_range(0,5) == 0)) { - n.setContent(CONTENT_MUDSNOW); - m_map->addNodeWithEvent(p,n); + }else if (season == ENV_SEASON_WINTER && p.Y > (coldzone-10) && (ch > 10 || myrand_range(0,5) == 0)) { + // should only change to snow if there's nothing above it + std::vector search; + search.push_back(CONTENT_SNOW); + search.push_back(CONTENT_AIR); + if (!searchNearInv(p,v3s16(0,0,0),v3s16(0,32,0),search,NULL)) { + n.setContent(CONTENT_MUDSNOW); + m_map->addNodeWithEvent(p, n); + } }else{ int f = (700-(p.Y*2))+10; if (p.Y > 1 && myrand()%f == 0) {