summaryrefslogtreecommitdiffstats
path: root/source/Simulator
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
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 '')
-rw-r--r--source/Simulator/RedstoneSimulator.cpp37
-rw-r--r--source/Simulator/RedstoneSimulator.h1
2 files changed, 38 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:
diff --git a/source/Simulator/RedstoneSimulator.h b/source/Simulator/RedstoneSimulator.h
index 089b84aeb..0b0333164 100644
--- a/source/Simulator/RedstoneSimulator.h
+++ b/source/Simulator/RedstoneSimulator.h
@@ -71,6 +71,7 @@ private:
BlockList m_BlocksBuffer;
BlockList m_RefreshPistons;
+ BlockList m_RefreshDispensers;
BlockList m_RefreshTorchesAround;