1
0

Fix explosion knockback issues and tweak knockback strength (#4590)

This commit is contained in:
peterbell10
2020-04-02 08:29:42 +01:00
committed by GitHub
parent 25d5e1bfe1
commit 59e38d1a46
4 changed files with 21 additions and 22 deletions

View File

@@ -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);
}
}