diff options
author | Mattes D <github@xoft.cz> | 2015-05-07 16:14:56 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2015-05-07 16:14:56 +0200 |
commit | 4888f671d15c47cf79b289a72fb5068cc6a6e35b (patch) | |
tree | 462ab2388a09dada48478104553fb9f6fedcb358 /src/Broadcaster.cpp | |
parent | Merge pull request #1953 from mc-server/bearbin-fadwp (diff) | |
parent | Added support for additional data in the ParticleEffect Packet (diff) | |
download | cuberite-4888f671d15c47cf79b289a72fb5068cc6a6e35b.tar cuberite-4888f671d15c47cf79b289a72fb5068cc6a6e35b.tar.gz cuberite-4888f671d15c47cf79b289a72fb5068cc6a6e35b.tar.bz2 cuberite-4888f671d15c47cf79b289a72fb5068cc6a6e35b.tar.lz cuberite-4888f671d15c47cf79b289a72fb5068cc6a6e35b.tar.xz cuberite-4888f671d15c47cf79b289a72fb5068cc6a6e35b.tar.zst cuberite-4888f671d15c47cf79b289a72fb5068cc6a6e35b.zip |
Diffstat (limited to 'src/Broadcaster.cpp')
-rw-r--r-- | src/Broadcaster.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/Broadcaster.cpp b/src/Broadcaster.cpp new file mode 100644 index 000000000..7f2b65d09 --- /dev/null +++ b/src/Broadcaster.cpp @@ -0,0 +1,47 @@ + +#include "Globals.h" +#include "Broadcaster.h" +#include "World.h" +#include "Chunk.h" + +cBroadcaster::cBroadcaster(cWorld * a_World) : + m_World(a_World) +{ +} + + +void cBroadcaster::BroadcastParticleEffect(const AString & a_ParticleName, const Vector3f a_Src, const Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, cClientHandle * a_Exclude) +{ + m_World->DoWithChunkAt(a_Src, + [=](cChunk & a_Chunk) -> bool + { + for (auto&& client : a_Chunk.GetAllClients()) + { + if (client == a_Exclude) + { + continue; + } + client->SendParticleEffect(a_ParticleName, a_Src.x, a_Src.y, a_Src.z, a_Offset.x, a_Offset.y, a_Offset.z, a_ParticleData, a_ParticleAmount); + }; + return true; + }); +} + + +void cBroadcaster::BroadcastParticleEffect(const AString & a_ParticleName, const Vector3f a_Src, const Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, std::array<int, 2> a_Data, cClientHandle * a_Exclude) +{ + m_World->DoWithChunkAt(a_Src, + [=](cChunk & a_Chunk) -> bool + { + for (auto && client : a_Chunk.GetAllClients()) + { + if (client == a_Exclude) + { + continue; + } + client->SendParticleEffect(a_ParticleName, a_Src, a_Offset, a_ParticleData, a_ParticleAmount, a_Data); + }; + return true; + }); +} + |