From 3d68466ab03c3f7f2879451a57acba65ed5b197f Mon Sep 17 00:00:00 2001 From: Howaner Date: Fri, 8 Aug 2014 18:55:05 +0200 Subject: Send the old slab to the client when the interact cancelled. --- src/Blocks/BlockSlab.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Blocks/BlockSlab.h b/src/Blocks/BlockSlab.h index 214445eda..28fdbe7af 100644 --- a/src/Blocks/BlockSlab.h +++ b/src/Blocks/BlockSlab.h @@ -110,6 +110,17 @@ 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; + } + + a_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, a_Player); + } /// Converts the single-slab blocktype to its equivalent double-slab blocktype -- cgit v1.2.3 From ebfc0fdc676eb4e0e99fc59ab6da6919fa2ef471 Mon Sep 17 00:00:00 2001 From: Howaner Date: Fri, 8 Aug 2014 22:04:53 +0200 Subject: Added comment. --- src/Blocks/BlockSlab.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Blocks/BlockSlab.h b/src/Blocks/BlockSlab.h index 28fdbe7af..49f00c88c 100644 --- a/src/Blocks/BlockSlab.h +++ b/src/Blocks/BlockSlab.h @@ -119,6 +119,9 @@ public: return; } + /* Sends the slab back to the client. + The normal back sending adds the block face to the locations, but this don't work because the Y-Coordinate with the block face + is one higher than the real slab position. */ a_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, a_Player); } -- cgit v1.2.3 From 938bf1df69ae88ecdd85029d20bfd09d4fbf7618 Mon Sep 17 00:00:00 2001 From: Howaner Date: Sun, 10 Aug 2014 17:12:08 +0200 Subject: Changed comment. --- src/Blocks/BlockSlab.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Blocks/BlockSlab.h b/src/Blocks/BlockSlab.h index 49f00c88c..e67f0e8b3 100644 --- a/src/Blocks/BlockSlab.h +++ b/src/Blocks/BlockSlab.h @@ -119,9 +119,7 @@ public: return; } - /* Sends the slab back to the client. - The normal back sending adds the block face to the locations, but this don't work because the Y-Coordinate with the block face - is one higher than the real slab position. */ + // 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); } -- cgit v1.2.3