2014-06-28 19:44:34 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "BlockHandler.h"
|
2019-10-16 08:06:34 +00:00
|
|
|
#include "Mixins.h"
|
2014-06-28 19:44:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-05 10:27:14 +00:00
|
|
|
class cBlockTripwireHookHandler final :
|
2019-10-16 08:06:34 +00:00
|
|
|
public cMetaRotator<cClearMetaOnDrop<cBlockHandler>, 0x03, 0x02, 0x03, 0x00, 0x01>
|
2014-06-28 19:44:34 +00:00
|
|
|
{
|
2020-04-13 16:38:06 +00:00
|
|
|
using Super = cMetaRotator<cClearMetaOnDrop<cBlockHandler>, 0x03, 0x02, 0x03, 0x00, 0x01>;
|
2019-10-16 08:06:34 +00:00
|
|
|
|
2014-06-28 19:44:34 +00:00
|
|
|
public:
|
2019-10-16 08:06:34 +00:00
|
|
|
|
2020-09-20 13:50:52 +00:00
|
|
|
using Super::Super;
|
|
|
|
|
|
|
|
inline static eBlockFace MetadataToDirection(NIBBLETYPE a_Meta)
|
2014-06-28 19:44:34 +00:00
|
|
|
{
|
2020-09-20 13:50:52 +00:00
|
|
|
switch (a_Meta & 0x03)
|
|
|
|
{
|
|
|
|
case 0x1: return BLOCK_FACE_XM;
|
|
|
|
case 0x3: return BLOCK_FACE_XP;
|
|
|
|
case 0x2: return BLOCK_FACE_ZM;
|
|
|
|
case 0x0: return BLOCK_FACE_ZP;
|
|
|
|
default: ASSERT(!"Unhandled tripwire hook metadata!"); return BLOCK_FACE_NONE;
|
|
|
|
}
|
2014-06-28 19:44:34 +00:00
|
|
|
}
|
|
|
|
|
2020-09-20 13:50:52 +00:00
|
|
|
private:
|
2019-10-16 08:06:34 +00:00
|
|
|
|
2021-05-05 13:25:10 +00:00
|
|
|
virtual bool CanBeAt(const cChunk & a_Chunk, const Vector3i a_Position, const NIBBLETYPE a_Meta) const override
|
2014-06-28 19:44:34 +00:00
|
|
|
{
|
2021-05-05 13:25:10 +00:00
|
|
|
const auto RearPosition = AddFaceDirection(a_Position, MetadataToDirection(a_Meta), true);
|
2020-07-25 19:29:55 +00:00
|
|
|
|
|
|
|
BLOCKTYPE NeighborBlockType;
|
|
|
|
if (!a_Chunk.UnboundedRelGetBlockType(RearPosition, NeighborBlockType))
|
2020-04-21 20:19:22 +00:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2020-07-25 19:29:55 +00:00
|
|
|
|
2020-04-21 20:19:22 +00:00
|
|
|
return cBlockInfo::FullyOccupiesVoxel(NeighborBlockType);
|
2014-06-28 19:44:34 +00:00
|
|
|
}
|
2015-06-30 14:50:15 +00:00
|
|
|
|
2019-10-16 08:06:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-20 13:50:52 +00:00
|
|
|
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) const override
|
2015-06-30 14:50:15 +00:00
|
|
|
{
|
|
|
|
UNUSED(a_Meta);
|
|
|
|
return 0;
|
|
|
|
}
|
2014-06-28 19:44:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|