diff options
author | peterbell10 <peterbell10@live.co.uk> | 2020-04-02 09:29:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-02 09:29:42 +0200 |
commit | 59e38d1a46101252e684e9514bdb912e3e030fec (patch) | |
tree | f9238350265272e8840f3ccb7bcd9bef6cd30386 /src/World.cpp | |
parent | Oops, that wasn't supposed to be negated (diff) | |
download | cuberite-59e38d1a46101252e684e9514bdb912e3e030fec.tar cuberite-59e38d1a46101252e684e9514bdb912e3e030fec.tar.gz cuberite-59e38d1a46101252e684e9514bdb912e3e030fec.tar.bz2 cuberite-59e38d1a46101252e684e9514bdb912e3e030fec.tar.lz cuberite-59e38d1a46101252e684e9514bdb912e3e030fec.tar.xz cuberite-59e38d1a46101252e684e9514bdb912e3e030fec.tar.zst cuberite-59e38d1a46101252e684e9514bdb912e3e030fec.zip |
Diffstat (limited to 'src/World.cpp')
-rw-r--r-- | src/World.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/World.cpp b/src/World.cpp index a08c269d8..9c7928c89 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -1417,17 +1417,20 @@ void cWorld::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_Blo BroadcastSoundEffect("entity.generic.explode", Vector3d(a_BlockX, a_BlockY, a_BlockZ), 4.0f, SoundPitchMultiplier * 0.7f); + Vector3d ExplosionPos(a_BlockX, a_BlockY, a_BlockZ); { cCSLock Lock(m_CSPlayers); - for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + for (auto Player : m_Players) { - cClientHandle * ch = (*itr)->GetClientHandle(); + cClientHandle * ch = Player->GetClientHandle(); if (ch == nullptr) { continue; } - ch->SendExplosion(a_BlockX, a_BlockY, a_BlockZ, static_cast<float>(a_ExplosionSize), BlocksAffected, (*itr)->GetSpeed()); + bool InRange = (Player->GetExplosionExposureRate(ExplosionPos, static_cast<float>(a_ExplosionSize)) > 0); + auto Speed = InRange ? Player->GetSpeed() : Vector3d{}; + ch->SendExplosion(a_BlockX, a_BlockY, a_BlockZ, static_cast<float>(a_ExplosionSize), BlocksAffected, Speed); } } |