diff options
-rw-r--r-- | src/Blocks/BlockSlab.h | 12 | ||||
-rw-r--r-- | src/Entities/Player.cpp | 4 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/Blocks/BlockSlab.h b/src/Blocks/BlockSlab.h index 214445eda..e67f0e8b3 100644 --- a/src/Blocks/BlockSlab.h +++ b/src/Blocks/BlockSlab.h @@ -110,6 +110,18 @@ public: { return ((a_BlockType == E_BLOCK_WOODEN_SLAB) || (a_BlockType == E_BLOCK_STONE_SLAB)); } + + + virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override + { + if ((a_BlockFace == BLOCK_FACE_NONE) || (a_Player->GetEquippedItem().m_ItemType != (short)m_BlockType)) + { + return; + } + + // Sends the slab back to the client. It's to refuse a doubleslab placement. + a_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, a_Player); + } /// Converts the single-slab blocktype to its equivalent double-slab blocktype diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index 8fa060a5d..608316e9a 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -906,6 +906,10 @@ void cPlayer::KilledBy(TakeDamageInfo & a_TDI) } GetWorld()->BroadcastChatDeath(Printf("%s %s", GetName().c_str(), DamageText.c_str())); } + else if (a_TDI.Attacker == NULL) // && !m_World->ShouldBroadcastDeathMessages() by fallthrough + { + // no-op + } else if (a_TDI.Attacker->IsPlayer()) { cPlayer * Killer = (cPlayer *)a_TDI.Attacker; |