Top blocks are now snowed over, either normally, or in deep snow (patch contributed by funmaker, Luksor and Sebi)
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1000 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
@@ -413,6 +413,8 @@ void cChunk::Tick(float a_Dt, MTRand & a_TickRandom)
|
||||
m_IsDirty = ((cFurnaceEntity *)(*itr))->Tick( a_Dt ) | m_IsDirty;
|
||||
}
|
||||
}
|
||||
|
||||
ApplyWeatherToTop(a_TickRandom);
|
||||
}
|
||||
|
||||
|
||||
@@ -522,6 +524,88 @@ void cChunk::TickBlocks(MTRand & a_TickRandom)
|
||||
|
||||
|
||||
|
||||
void cChunk::ApplyWeatherToTop(MTRand & a_TickRandom)
|
||||
{
|
||||
if (
|
||||
(a_TickRandom.randInt(100) != 0) ||
|
||||
(
|
||||
(m_World->GetWeather() != eWeather_Rain) &&
|
||||
(m_World->GetWeather() != eWeather_ThunderStorm)
|
||||
)
|
||||
)
|
||||
{
|
||||
// Not the right weather, or not at this tick; bail out
|
||||
return;
|
||||
}
|
||||
|
||||
int X = a_TickRandom.randInt(15);
|
||||
int Z = a_TickRandom.randInt(15);
|
||||
switch (GetBiomeAt(X, Z))
|
||||
{
|
||||
case biTaiga:
|
||||
case biFrozenOcean:
|
||||
case biFrozenRiver:
|
||||
case biIcePlains:
|
||||
case biIceMountains:
|
||||
case biTaigaHills:
|
||||
{
|
||||
// TODO: Check light levels, don't snow over when the BlockLight is higher than (7?)
|
||||
int Height = GetHeight(X, Z);
|
||||
BLOCKTYPE TopBlock = GetBlock(X, Height, Z);
|
||||
NIBBLETYPE TopMeta = GetMeta (X, Height, Z);
|
||||
if (m_World->IsDeepSnowEnabled() && (TopBlock == E_BLOCK_SNOW))
|
||||
{
|
||||
int MaxSize = 7;
|
||||
BLOCKTYPE BlockType[4];
|
||||
NIBBLETYPE BlockMeta[4];
|
||||
UnboundedRelGetBlock(X - 1, Height, Z, BlockType[0], BlockMeta[0]);
|
||||
UnboundedRelGetBlock(X + 1, Height, Z, BlockType[1], BlockMeta[1]);
|
||||
UnboundedRelGetBlock(X, Height, Z - 1, BlockType[2], BlockMeta[2]);
|
||||
UnboundedRelGetBlock(X, Height, Z + 1, BlockType[3], BlockMeta[3]);
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
switch (BlockType[i])
|
||||
{
|
||||
case E_BLOCK_AIR:
|
||||
{
|
||||
MaxSize = 0;
|
||||
break;
|
||||
}
|
||||
case E_BLOCK_SNOW:
|
||||
{
|
||||
MaxSize = std::min(BlockMeta[i] + 1, MaxSize);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (TopMeta < MaxSize)
|
||||
{
|
||||
FastSetBlock(X, Height, Z, E_BLOCK_SNOW, TopMeta + 1);
|
||||
}
|
||||
else if (TopMeta > MaxSize)
|
||||
{
|
||||
FastSetBlock(X, Height, Z, E_BLOCK_SNOW, TopMeta - 1);
|
||||
}
|
||||
}
|
||||
else if (g_BlockIsSnowable[TopBlock])
|
||||
{
|
||||
SetBlock(X, Height + 1, Z, E_BLOCK_SNOW, 0);
|
||||
}
|
||||
else if ((TopBlock == E_BLOCK_WATER) || (TopBlock == E_BLOCK_STATIONARY_WATER))
|
||||
{
|
||||
SetBlock(X, Height, Z, E_BLOCK_ICE, 0);
|
||||
}
|
||||
break;
|
||||
} // case (snowy biomes)
|
||||
|
||||
// TODO: Rainy biomes should check for farmland and cauldrons
|
||||
} // switch (biome)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cChunk::GrowMelonPumpkin(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, MTRand & a_TickRandom)
|
||||
{
|
||||
// Convert the stem BlockType into produce BlockType
|
||||
|
||||
Reference in New Issue
Block a user