summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockDoor.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Blocks/BlockDoor.h40
1 files changed, 26 insertions, 14 deletions
diff --git a/src/Blocks/BlockDoor.h b/src/Blocks/BlockDoor.h
index 4773e6f0a..ca2719a8b 100644
--- a/src/Blocks/BlockDoor.h
+++ b/src/Blocks/BlockDoor.h
@@ -52,12 +52,15 @@ public:
return true;
}
-
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
+ if ((a_BlockMeta & 0x08) != 0) // is top part of door
+ {
+ return;
+ }
switch (m_BlockType)
{
- case E_BLOCK_WOODEN_DOOR:
+ case E_BLOCK_OAK_DOOR:
{
a_Pickups.Add(E_ITEM_WOODEN_DOOR);
break;
@@ -100,19 +103,16 @@ public:
}
}
-
virtual bool IsUseable(void) override
{
return true;
}
-
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
{
return ((a_RelY > 0) && CanBeOn(a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ), a_Chunk.GetMeta(a_RelX, a_RelY - 1, a_RelZ)));
}
-
/** Returns true if door can be placed on the specified block type. */
static bool CanBeOn(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
{
@@ -136,7 +136,6 @@ public:
}
}
-
static bool CanReplaceBlock(BLOCKTYPE a_BlockType)
{
switch (a_BlockType)
@@ -156,7 +155,6 @@ public:
return false;
}
-
/** Converts the player's yaw to placed door's blockmeta */
inline static NIBBLETYPE PlayerYawToMetaData(double a_Yaw)
{
@@ -185,7 +183,6 @@ public:
}
}
-
/** Returns a vector pointing one block in the direction the door is facing (where the outside is). */
inline static Vector3i GetRelativeDirectionToOutside(NIBBLETYPE a_BlockMeta)
{
@@ -198,7 +195,6 @@ public:
}
}
-
/** Returns true if the specified blocktype is any kind of door */
inline static bool IsDoorBlockType(BLOCKTYPE a_Block)
{
@@ -210,7 +206,7 @@ public:
case E_BLOCK_IRON_DOOR:
case E_BLOCK_JUNGLE_DOOR:
case E_BLOCK_SPRUCE_DOOR:
- case E_BLOCK_WOODEN_DOOR:
+ case E_BLOCK_OAK_DOOR:
{
return true;
}
@@ -221,7 +217,6 @@ public:
}
}
-
/** Returns true iff the door at the specified coords is open.
The coords may point to either the top part or the bottom part of the door. */
static NIBBLETYPE IsOpen(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
@@ -230,7 +225,6 @@ public:
return ((Meta & 0x04) != 0);
}
-
/** Returns the complete meta composed from the both parts of the door as (TopMeta << 4) | BottomMeta
The coords may point to either part of the door.
The returned value has bit 3 (0x08) set iff the coords point to the top part of the door.
@@ -263,7 +257,6 @@ public:
}
}
-
/** Sets the door to the specified state. If the door is already in that state, does nothing. */
static void SetOpen(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ, bool a_Open)
{
@@ -297,12 +290,31 @@ public:
}
}
-
/** Changes the door at the specified coords from open to close or vice versa */
static void ChangeDoor(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
{
SetOpen(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, !IsOpen(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ));
}
+
+ virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
+ {
+ UNUSED(a_Meta);
+ switch (m_BlockType)
+ {
+ case E_BLOCK_OAK_DOOR: return 13;
+ case E_BLOCK_SPRUCE_DOOR: return 34;
+ case E_BLOCK_BIRCH_DOOR: return 2;
+ case E_BLOCK_JUNGLE_DOOR: return 10;
+ case E_BLOCK_DARK_OAK_DOOR: return 26;
+ case E_BLOCK_ACACIA_DOOR: return 15;
+ case E_BLOCK_IRON_DOOR: return 6;
+ default:
+ {
+ ASSERT(!"Unhandled blocktype in door handler!");
+ return 0;
+ }
+ }
+ }
} ;