From 429117c1f6131df407246a46bc75a724eca0da54 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Mon, 28 Sep 2020 22:04:57 +0100 Subject: Doors: check power & toggle correctly * Fixed upper half ignoring its updates * Fixes #4945 * Fixed doors playing sound effects when they didn't actually toggle --- src/Blocks/BlockDoor.h | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'src/Blocks/BlockDoor.h') diff --git a/src/Blocks/BlockDoor.h b/src/Blocks/BlockDoor.h index 36dc788aa..ee511a290 100644 --- a/src/Blocks/BlockDoor.h +++ b/src/Blocks/BlockDoor.h @@ -96,6 +96,14 @@ 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 bool IsOpen(cChunkInterface & a_ChunkInterface, const Vector3i a_BlockPos) + { + const auto Meta = GetCompleteDoorMeta(a_ChunkInterface, a_BlockPos); + return (Meta & 0x04) != 0; + } + /** Sets the door to the specified state. If the door is already in that state, does nothing. */ static void SetOpen(cChunkInterface & a_ChunkInterface, const Vector3i a_BlockPos, bool a_Open) { @@ -237,18 +245,6 @@ private: - /** 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, const Vector3i a_BlockPos) - { - NIBBLETYPE Meta = GetCompleteDoorMeta(a_ChunkInterface, a_BlockPos); - 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. -- cgit v1.2.3