2013-07-29 07:13:03 -04:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "BlockHandler.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-05 06:27:14 -04:00
|
|
|
class cBlockDeadBushHandler final :
|
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
|
|
|
|
2020-09-20 09:50:52 -04:00
|
|
|
using Super::Super;
|
2020-04-13 12:38:06 -04:00
|
|
|
|
2020-09-20 09:50:52 -04:00
|
|
|
private:
|
2020-04-13 12:38:06 -04:00
|
|
|
|
2021-05-05 09:25:10 -04:00
|
|
|
virtual bool DoesIgnoreBuildCollision(const cWorld & a_World, const cItem & a_HeldItem, const Vector3i a_Position, const NIBBLETYPE a_Meta, const eBlockFace a_ClickedBlockFace, const bool a_ClickedDirectly) const override
|
2017-03-22 06:04:32 -04:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-04-13 12:38:06 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-05-05 09:25:10 -04:00
|
|
|
virtual bool CanBeAt(const cChunk & a_Chunk, const Vector3i a_Position, const NIBBLETYPE a_Meta) const override
|
2013-07-29 07:13:03 -04:00
|
|
|
{
|
2021-05-05 09:25:10 -04:00
|
|
|
if (a_Position.y <= 0)
|
2014-10-07 12:21:39 -04:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-05-05 09:25:10 -04:00
|
|
|
BLOCKTYPE BelowBlock = a_Chunk.GetBlock(a_Position.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
|
|
|
|
|
|
|
|
2021-03-28 09:41:34 -04:00
|
|
|
virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-20 09:50:52 -04:00
|
|
|
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) const override
|
2019-10-16 04:06:34 -04:00
|
|
|
{
|
|
|
|
UNUSED(a_Meta);
|
|
|
|
return 0;
|
2017-02-26 05:09:06 -05:00
|
|
|
}
|
2013-07-29 07:13:03 -04:00
|
|
|
} ;
|