2013-07-29 07:13:03 -04:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "BlockHandler.h"
|
2014-10-19 09:01:01 -04:00
|
|
|
#include "BlockSlab.h"
|
2013-07-29 07:13:03 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-05 06:27:14 -04:00
|
|
|
class cBlockRedstoneHandler final :
|
2020-03-23 16:07:08 -04:00
|
|
|
public cBlockHandler
|
2013-07-29 07:13:03 -04:00
|
|
|
{
|
2020-04-13 12:38:06 -04:00
|
|
|
using Super = cBlockHandler;
|
2019-10-16 04:06:34 -04:00
|
|
|
|
2013-07-29 07:13:03 -04:00
|
|
|
public:
|
2019-10-16 04:06:34 -04:00
|
|
|
|
2020-09-20 09:50:52 -04:00
|
|
|
using Super::Super;
|
2020-04-21 16:19:22 -04:00
|
|
|
|
2020-09-20 09:50:52 -04:00
|
|
|
private:
|
2020-04-21 16:19:22 -04:00
|
|
|
|
2020-09-20 09:50:52 -04:00
|
|
|
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, const Vector3i a_RelPos, const cChunk & a_Chunk) const override
|
2013-07-29 07:13:03 -04:00
|
|
|
{
|
2020-04-21 16:19:22 -04:00
|
|
|
if (a_RelPos.y <= 0)
|
2014-10-19 09:01:01 -04:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
BLOCKTYPE BelowBlock;
|
|
|
|
NIBBLETYPE BelowBlockMeta;
|
2020-04-21 16:19:22 -04:00
|
|
|
a_Chunk.GetBlockTypeMeta(a_RelPos.addedY(-1), BelowBlock, BelowBlockMeta);
|
2014-10-19 09:01:01 -04:00
|
|
|
|
|
|
|
if (cBlockInfo::FullyOccupiesVoxel(BelowBlock))
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (cBlockSlabHandler::IsAnySlabType(BelowBlock))
|
|
|
|
{
|
|
|
|
// Check if the slab is turned up side down
|
|
|
|
if ((BelowBlockMeta & 0x08) == 0x08)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
2013-07-29 07:13:03 -04:00
|
|
|
}
|
2016-02-05 16:45:45 -05:00
|
|
|
|
2020-04-21 16:19:22 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-23 11:06:27 -04:00
|
|
|
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override
|
2020-03-23 16:07:08 -04:00
|
|
|
{
|
|
|
|
return cItem(E_ITEM_REDSTONE_DUST, 1, 0);
|
|
|
|
}
|
|
|
|
|
2020-04-21 16:19:22 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-20 09:50:52 -04:00
|
|
|
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) const override
|
2015-06-30 10:50:15 -04:00
|
|
|
{
|
|
|
|
UNUSED(a_Meta);
|
|
|
|
return 0;
|
|
|
|
}
|
2013-07-29 07:13:03 -04:00
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|