diff options
author | Mattes D <github@xoft.cz> | 2016-07-29 07:57:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-29 07:57:30 +0200 |
commit | 28da6ed640367e9d8cb1f6f11c9493faabb470d6 (patch) | |
tree | 47bb2d183d541d5f9611260c12eb3f002a07d6f9 /src/Simulator/IncrementalRedstoneSimulator/PistonHandler.h | |
parent | Merge pull request #3226 from cuberite/redstone (diff) | |
parent | Revert "Redstone fixes" (diff) | |
download | cuberite-28da6ed640367e9d8cb1f6f11c9493faabb470d6.tar cuberite-28da6ed640367e9d8cb1f6f11c9493faabb470d6.tar.gz cuberite-28da6ed640367e9d8cb1f6f11c9493faabb470d6.tar.bz2 cuberite-28da6ed640367e9d8cb1f6f11c9493faabb470d6.tar.lz cuberite-28da6ed640367e9d8cb1f6f11c9493faabb470d6.tar.xz cuberite-28da6ed640367e9d8cb1f6f11c9493faabb470d6.tar.zst cuberite-28da6ed640367e9d8cb1f6f11c9493faabb470d6.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Simulator/IncrementalRedstoneSimulator/PistonHandler.h | 29 |
1 files changed, 3 insertions, 26 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator/PistonHandler.h b/src/Simulator/IncrementalRedstoneSimulator/PistonHandler.h index f82ebdf94..1ee68e521 100644 --- a/src/Simulator/IncrementalRedstoneSimulator/PistonHandler.h +++ b/src/Simulator/IncrementalRedstoneSimulator/PistonHandler.h @@ -39,37 +39,14 @@ public: virtual cVector3iArray Update(const Vector3i & a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta, PoweringData a_PoweringData) override { // LOGD("Evaluating pisty the piston (%d %d %d)", a_Position.x, a_Position.y, a_Position.z); - auto Data = static_cast<cIncrementalRedstoneSimulator *>(m_World.GetRedstoneSimulator())->GetChunkData(); - auto DelayInfo = Data->GetMechanismDelayInfo(a_Position); - // Delay is used here to prevent an infinite loop (#3168) - if (DelayInfo == nullptr) + if (a_PoweringData.PowerLevel > 0) { - bool ShouldBeExtended = (a_PoweringData.PowerLevel != 0); - if (ShouldBeExtended != cBlockPistonHandler::IsExtended(a_Meta)) - { - Data->m_MechanismDelays[a_Position] = std::make_pair(1, ShouldBeExtended); - } + cBlockPistonHandler::ExtendPiston(a_Position, &m_World); } else { - int DelayTicks; - bool ShouldBeExtended; - std::tie(DelayTicks, ShouldBeExtended) = *DelayInfo; - - if (DelayTicks == 0) - { - if (ShouldBeExtended) - { - cBlockPistonHandler::ExtendPiston(a_Position, &m_World); - } - else - { - cBlockPistonHandler::RetractPiston(a_Position, &m_World); - } - - Data->m_MechanismDelays.erase(a_Position); - } + cBlockPistonHandler::RetractPiston(a_Position, &m_World); } return {}; |