summaryrefslogtreecommitdiffstats
path: root/source/Simulator/RedstoneSimulator.cpp
diff options
context:
space:
mode:
authorluksor111@gmail.com <luksor111@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-12-26 18:16:33 +0100
committerluksor111@gmail.com <luksor111@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-12-26 18:16:33 +0100
commit575abe8691bf2f615f17e6212ea5ec6265ffd4ed (patch)
treed37b31c6eac993b643cf0dccd7d38c2fe316ff04 /source/Simulator/RedstoneSimulator.cpp
parentAdjusted the protocol framework to support different types of falling block spawning. (diff)
downloadcuberite-575abe8691bf2f615f17e6212ea5ec6265ffd4ed.tar
cuberite-575abe8691bf2f615f17e6212ea5ec6265ffd4ed.tar.gz
cuberite-575abe8691bf2f615f17e6212ea5ec6265ffd4ed.tar.bz2
cuberite-575abe8691bf2f615f17e6212ea5ec6265ffd4ed.tar.lz
cuberite-575abe8691bf2f615f17e6212ea5ec6265ffd4ed.tar.xz
cuberite-575abe8691bf2f615f17e6212ea5ec6265ffd4ed.tar.zst
cuberite-575abe8691bf2f615f17e6212ea5ec6265ffd4ed.zip
Diffstat (limited to 'source/Simulator/RedstoneSimulator.cpp')
-rw-r--r--source/Simulator/RedstoneSimulator.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/source/Simulator/RedstoneSimulator.cpp b/source/Simulator/RedstoneSimulator.cpp
index 2224d300d..1862537e0 100644
--- a/source/Simulator/RedstoneSimulator.cpp
+++ b/source/Simulator/RedstoneSimulator.cpp
@@ -2,6 +2,7 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "RedstoneSimulator.h"
+#include "../DispenserEntity.h"
#include "../Piston.h"
#include "../World.h"
#include "../BlockID.h"
@@ -387,6 +388,36 @@ void cRedstoneSimulator::HandleChange( const Vector3i & a_BlockPos )
}
} // switch (BlockType)
} // while (m_RefreshPistons[])
+
+ while (!m_RefreshDispensers.empty())
+ {
+ Vector3i pos = m_RefreshDispensers.back();
+ m_RefreshDispensers.pop_back();
+
+ BLOCKTYPE BlockType = m_World->GetBlock(pos);
+ if (BlockType == E_BLOCK_DISPENSER)
+ {
+ if (IsPowered(pos))
+ {
+ class cActivateDispenser :
+ public cDispenserCallback
+ {
+ public:
+ cActivateDispenser()
+ {
+ }
+
+ virtual bool Item(cDispenserEntity * a_Dispenser) override
+ {
+ a_Dispenser->Activate();
+ return false;
+ }
+ } ;
+ cActivateDispenser DispAct;
+ m_World->DoWithDispenserAt(pos.x, pos.y, pos.z, DispAct);
+ }
+ }
+ }
}
@@ -416,6 +447,12 @@ bool cRedstoneSimulator::PowerBlock(const Vector3i & a_BlockPos, const Vector3i
m_RefreshPistons.push_back(a_BlockPos);
break;
}
+
+ case E_BLOCK_DISPENSER:
+ {
+ m_RefreshDispensers.push_back(a_BlockPos);
+ break;
+ }
case E_BLOCK_REDSTONE_REPEATER_OFF:
case E_BLOCK_REDSTONE_REPEATER_ON: