From 40eba5244ddd7045a9c3539c5f46c9921301ed90 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 8 Aug 2020 18:22:16 +0100 Subject: Remove the redstone solid block handler - Remove cSolidBlockHandler * Functionality now integrated into simulator dispatcher * Fix door double open/close issues, arisen due to the top/bottom halves getting different power + Small migration to block states for redstone wire --- src/Blocks/BlockButton.h | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) (limited to 'src/Blocks/BlockButton.h') diff --git a/src/Blocks/BlockButton.h b/src/Blocks/BlockButton.h index 9d8bf3da1..f4994f193 100644 --- a/src/Blocks/BlockButton.h +++ b/src/Blocks/BlockButton.h @@ -48,7 +48,7 @@ public: const auto SoundToPlay = (m_BlockType == E_BLOCK_STONE_BUTTON) ? "block.stone_button.click_on" : "block.wood_button.click_on"; a_ChunkInterface.SetBlockMeta(a_BlockPos, Meta, false); - WakeUpSimulators(a_WorldInterface, a_BlockPos); + a_WorldInterface.WakeUpSimulators(a_BlockPos); a_WorldInterface.GetBroadcastManager().BroadcastSoundEffect(SoundToPlay, a_BlockPos, 0.5f, 0.6f, a_Player.GetClientHandle()); // Queue a button reset (unpress) @@ -186,7 +186,7 @@ public: } a_World.SetBlockMeta(Pos, Meta | 0x08, false); - WakeUpSimulators(a_World, Pos); + a_World.WakeUpSimulators(Pos); // sound name is ok to be wood, because only wood gets triggered by arrow a_World.GetBroadcastManager().BroadcastSoundEffect("block.wood_button.click_on", Pos, 0.5f, 0.6f); @@ -195,27 +195,6 @@ public: QueueButtonRelease(a_World, Pos, Type); } - /** Notify, mainly the redstone simulator, that this toggle component has updated. */ - template - static void WakeUpSimulators(WorldType & a_World, const Vector3i a_Position) - { - // Contains our direct adjacents - static const Vector3i Offsets[] = - { - { 1, 0, 0 }, - { -1, 0, 0 }, - { 0, 1, 0 }, - { 0, -1, 0 }, - { 0, 0, 1 }, - { 0, 0, -1 } - }; - - for (const auto & Offset : Offsets) - { - a_World.WakeUpSimulators(a_Position + Offset); - } - } - private: /** Schedules a recurring event at appropriate intervals to release a button at a given position. @@ -250,7 +229,7 @@ private: const auto SoundToPlayOnRelease = (Type == E_BLOCK_STONE_BUTTON) ? "block.stone_button.click_off" : "block.wood_button.click_off"; a_World.SetBlockMeta(a_Position, Meta & 0x07, false); - WakeUpSimulators(a_World, a_Position); + a_World.WakeUpSimulators(a_Position); a_World.BroadcastSoundEffect(SoundToPlayOnRelease, a_Position, 0.5f, 0.5f); } ); -- cgit v1.2.3