2013-07-29 07:13:03 -04:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "BlockHandler.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-13 12:38:06 -04:00
|
|
|
class cBlockDeadBushHandler:
|
2013-07-29 07:13:03 -04:00
|
|
|
public cBlockHandler
|
|
|
|
{
|
2020-04-13 12:38:06 -04:00
|
|
|
using Super = cBlockHandler;
|
|
|
|
|
2013-07-29 07:13:03 -04:00
|
|
|
public:
|
2020-04-13 12:38:06 -04:00
|
|
|
cBlockDeadBushHandler(BLOCKTYPE a_BlockType):
|
|
|
|
Super(a_BlockType)
|
2013-07-29 07:13:03 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-04-13 12:38:06 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-07-07 10:37:53 -04:00
|
|
|
virtual bool DoesIgnoreBuildCollision(cChunkInterface & a_ChunkInterface, Vector3i a_Pos, cPlayer & a_Player, NIBBLETYPE a_Meta) override
|
2017-03-22 06:04:32 -04:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-04-13 12:38:06 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-21 16:19:22 -04:00
|
|
|
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, const Vector3i a_RelPos, const cChunk & a_Chunk) override
|
2013-07-29 07:13:03 -04:00
|
|
|
{
|
2020-04-21 16:19:22 -04:00
|
|
|
if (a_RelPos.y <= 0)
|
2014-10-07 12:21:39 -04:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-04-21 16:19:22 -04:00
|
|
|
BLOCKTYPE BelowBlock = a_Chunk.GetBlock(a_RelPos.addedY(-1));
|
2014-10-07 12:21:39 -04:00
|
|
|
switch (BelowBlock)
|
|
|
|
{
|
|
|
|
case E_BLOCK_CLAY:
|
|
|
|
case E_BLOCK_HARDENED_CLAY:
|
|
|
|
case E_BLOCK_STAINED_CLAY:
|
|
|
|
case E_BLOCK_SAND:
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
default: return false;
|
|
|
|
}
|
2013-07-29 07:13:03 -04:00
|
|
|
}
|
2015-06-30 10:50:15 -04:00
|
|
|
|
2017-02-26 05:09:06 -05:00
|
|
|
|
|
|
|
|
2019-10-16 04:06:34 -04:00
|
|
|
|
|
|
|
|
|
|
|
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, cBlockEntity * a_BlockEntity, const cEntity * a_Digger, const cItem * a_Tool) override
|
2017-02-26 05:09:06 -05:00
|
|
|
{
|
2019-10-16 04:06:34 -04:00
|
|
|
// If cutting down with shears, drop self:
|
|
|
|
if ((a_Tool != nullptr) && (a_Tool->m_ItemType == E_ITEM_SHEARS))
|
2017-02-26 05:09:06 -05:00
|
|
|
{
|
2019-10-16 04:06:34 -04:00
|
|
|
return cItem(m_BlockType, 1, a_BlockMeta);
|
|
|
|
}
|
2017-02-26 05:09:06 -05:00
|
|
|
|
2019-10-16 04:06:34 -04:00
|
|
|
// Drop 0-3 sticks:
|
|
|
|
auto chance = GetRandomProvider().RandInt<char>(3);
|
|
|
|
if (chance > 0)
|
|
|
|
{
|
|
|
|
return cItem(E_ITEM_STICK, chance, 0);
|
|
|
|
}
|
|
|
|
return {};
|
|
|
|
}
|
2017-02-26 05:09:06 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-10-16 04:06:34 -04:00
|
|
|
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
|
|
|
{
|
|
|
|
UNUSED(a_Meta);
|
|
|
|
return 0;
|
2017-02-26 05:09:06 -05:00
|
|
|
}
|
2013-07-29 07:13:03 -04:00
|
|
|
} ;
|