fix the flashing snow, and snow appearing inside buildings

This commit is contained in:
darkrose 2015-11-04 18:36:36 +10:00
parent df27ac2cd1
commit e49a78af2e
1 changed files with 25 additions and 7 deletions

View File

@ -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<content_t> 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<content_t> 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<content_t> 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) {