summaryrefslogtreecommitdiffstats
path: root/src/Simulator
diff options
context:
space:
mode:
Diffstat (limited to 'src/Simulator')
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator/PistonHandler.h38
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator/RedstoneSimulatorChunkData.h1
2 files changed, 12 insertions, 27 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator/PistonHandler.h b/src/Simulator/IncrementalRedstoneSimulator/PistonHandler.h
index 01742b13c..de001a9e5 100644
--- a/src/Simulator/IncrementalRedstoneSimulator/PistonHandler.h
+++ b/src/Simulator/IncrementalRedstoneSimulator/PistonHandler.h
@@ -36,39 +36,25 @@ public:
virtual cVector3iArray Update(cWorld & a_World, Vector3i a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta, PoweringData a_PoweringData) const override
{
// LOGD("Evaluating pisty the piston (%d %d %d)", a_Position.x, a_Position.y, a_Position.z);
- auto Data = static_cast<cIncrementalRedstoneSimulator *>(a_World.GetRedstoneSimulator())->GetChunkData();
- auto DelayInfo = Data->GetMechanismDelayInfo(a_Position);
- // Delay is used here to prevent an infinite loop (#3168)
- if (DelayInfo == nullptr)
+ bool ShouldBeExtended = (a_PoweringData.PowerLevel != 0);
+ if (ShouldBeExtended == cBlockPistonHandler::IsExtended(a_Meta))
{
- bool ShouldBeExtended = (a_PoweringData.PowerLevel != 0);
- if (ShouldBeExtended != cBlockPistonHandler::IsExtended(a_Meta))
- {
- Data->m_MechanismDelays[a_Position] = std::make_pair(1, ShouldBeExtended);
- }
+ return {};
+ }
+
+ if (ShouldBeExtended)
+ {
+ cBlockPistonHandler::ExtendPiston(a_Position, a_World);
}
else
{
- int DelayTicks;
- bool ShouldBeExtended;
- std::tie(DelayTicks, ShouldBeExtended) = *DelayInfo;
-
- if (DelayTicks == 0)
- {
- if (ShouldBeExtended)
- {
- cBlockPistonHandler::ExtendPiston(a_Position, a_World);
- }
- else
- {
- cBlockPistonHandler::RetractPiston(a_Position, a_World);
- }
-
- Data->m_MechanismDelays.erase(a_Position);
- }
+ cBlockPistonHandler::RetractPiston(a_Position, a_World);
}
+ // It is necessary to delay after a signal to prevent an infinite loop (#3168)
+ // However, that is present as a side effect of the implementation of piston animation in Blocks\BlockPiston.cpp
+
return {};
}
diff --git a/src/Simulator/IncrementalRedstoneSimulator/RedstoneSimulatorChunkData.h b/src/Simulator/IncrementalRedstoneSimulator/RedstoneSimulatorChunkData.h
index 83374e311..f0fd8d512 100644
--- a/src/Simulator/IncrementalRedstoneSimulator/RedstoneSimulatorChunkData.h
+++ b/src/Simulator/IncrementalRedstoneSimulator/RedstoneSimulatorChunkData.h
@@ -60,7 +60,6 @@ public:
/** Structure storing position of mechanism + it's delay ticks (countdown) & if to power on */
std::unordered_map<Vector3i, std::pair<int, bool>, VectorHasher<int>> m_MechanismDelays;
- std::unordered_map<Vector3i, bool, VectorHasher<int>> m_UpdateOncePositions;
private: