1
0
Fork 0

Cactus can now grow and will be dropped if there is no place to grow.

This commit is contained in:
Lukas Pioch 2019-09-29 09:54:09 +02:00 committed by Mattes D
parent 180a43d097
commit ba664340f3
1 changed files with 17 additions and 4 deletions

View File

@ -1145,7 +1145,7 @@ int cChunk::GrowCactus(int a_RelX, int a_RelY, int a_RelZ, int a_NumBlocks)
for (auto & Coord : Coords)
{
if (
UnboundedRelGetBlockType(a_RelX + Coord.x, Top + 1, a_RelZ + Coord.z, BlockType) &&
UnboundedRelGetBlockType(a_RelX + Coord.x, Top + i, a_RelZ + Coord.z, BlockType) &&
(
cBlockInfo::IsSolid(BlockType) ||
(BlockType == E_BLOCK_LAVA) ||
@ -1153,12 +1153,25 @@ int cChunk::GrowCactus(int a_RelX, int a_RelY, int a_RelZ, int a_NumBlocks)
)
)
{
// Remove the cactus
GetWorld()->DigBlock(a_RelX + GetPosX() * cChunkDef::Width, Top + i, a_RelZ + GetPosZ() * cChunkDef::Width);
// Drop the cactus on the other side of the blocking block
cBlockHandler * Handler = BlockHandler(E_BLOCK_CACTUS);
cChunkInterface ChunkInterface(GetWorld()->GetChunkMap());
cBlockInServerPluginInterface PluginInterface(*GetWorld());
Handler->DropBlock(
ChunkInterface,
*GetWorld(),
PluginInterface,
nullptr,
a_RelX + GetPosX() * cChunkDef::Width - Coord.x,
Top + i,
a_RelZ + GetPosZ() * cChunkDef::Width - Coord.z
);
return false;
}
} // for i - Coords[]
{
GetWorld()->DigBlock(a_RelX + GetPosX() * cChunkDef::Width, Top + i, a_RelZ + GetPosZ() * cChunkDef::Width);
}
}
else
{