summaryrefslogtreecommitdiffstats
path: root/src/Simulator
diff options
context:
space:
mode:
authorPeter Bell <peterbell10@live.co.uk>2020-08-25 20:08:13 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-08-25 22:38:49 +0200
commitfa917259a5017d122378f2eb38bd42df298cca1d (patch)
treec79c707027044cd9fd325a5acaefa404b2754348 /src/Simulator
parentChunkDataSerializer: don't repeatedly mallocate (diff)
downloadcuberite-fa917259a5017d122378f2eb38bd42df298cca1d.tar
cuberite-fa917259a5017d122378f2eb38bd42df298cca1d.tar.gz
cuberite-fa917259a5017d122378f2eb38bd42df298cca1d.tar.bz2
cuberite-fa917259a5017d122378f2eb38bd42df298cca1d.tar.lz
cuberite-fa917259a5017d122378f2eb38bd42df298cca1d.tar.xz
cuberite-fa917259a5017d122378f2eb38bd42df298cca1d.tar.zst
cuberite-fa917259a5017d122378f2eb38bd42df298cca1d.zip
Diffstat (limited to 'src/Simulator')
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator/DoorHandler.h4
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator/SmallGateHandler.h4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator/DoorHandler.h b/src/Simulator/IncrementalRedstoneSimulator/DoorHandler.h
index ce318e0b1..fa5debbbf 100644
--- a/src/Simulator/IncrementalRedstoneSimulator/DoorHandler.h
+++ b/src/Simulator/IncrementalRedstoneSimulator/DoorHandler.h
@@ -40,9 +40,11 @@ namespace DoorHandler
Power = std::max(Power, Callback.Power);
cChunkInterface ChunkInterface(a_Chunk.GetWorld()->GetChunkMap());
+ // Use redstone data rather than block state so players can override redstone control
+ const auto Previous = DataForChunk(a_Chunk).ExchangeUpdateOncePowerData(a_Position, Power);
+ const bool IsOpen = (Previous != 0);
const bool ShouldBeOpen = Power != 0;
const auto AbsolutePosition = cChunkDef::RelativeToAbsolute(a_Position, a_Chunk.GetPos());
- const bool IsOpen = cBlockDoorHandler::IsOpen(ChunkInterface, AbsolutePosition);
if (ShouldBeOpen != IsOpen)
{
diff --git a/src/Simulator/IncrementalRedstoneSimulator/SmallGateHandler.h b/src/Simulator/IncrementalRedstoneSimulator/SmallGateHandler.h
index f0b4a741c..0bd94baa9 100644
--- a/src/Simulator/IncrementalRedstoneSimulator/SmallGateHandler.h
+++ b/src/Simulator/IncrementalRedstoneSimulator/SmallGateHandler.h
@@ -22,8 +22,10 @@ namespace SmallGateHandler
{
// LOGD("Evaluating gateydory the fence gate/trapdoor (%d %d %d)", a_Position.x, a_Position.y, a_Position.z);
+ // Use redstone data rather than block state so players can override redstone control
+ const auto Previous = DataForChunk(a_Chunk).ExchangeUpdateOncePowerData(a_Position, Power);
+ const bool IsOpen = (Previous != 0);
const bool ShouldBeOpen = Power != 0;
- const bool IsOpen = (a_Meta & 0x4) == 0x4;
if (ShouldBeOpen != IsOpen)
{