diff options
Diffstat (limited to '')
-rw-r--r-- | src/ClientHandle.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 86e90aa8b..098a67afd 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -2637,7 +2637,7 @@ void cClientHandle::SendEntityVelocity(const cEntity & a_Entity) -void cClientHandle::SendExplosion(const Vector3d a_Pos, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d a_PlayerMotion) +void cClientHandle::SendExplosion(const Vector3f a_Position, const float a_Power) { if (m_NumExplosionsThisTick > MAX_EXPLOSIONS_PER_TICK) { @@ -2648,7 +2648,27 @@ void cClientHandle::SendExplosion(const Vector3d a_Pos, float a_Radius, const cV // Update the statistics: m_NumExplosionsThisTick++; - m_Protocol->SendExplosion(a_Pos.x, a_Pos.y, a_Pos.z, a_Radius, a_BlocksAffected, a_PlayerMotion); + auto & Random = GetRandomProvider(); + const auto SoundPitchMultiplier = 1.0f + (Random.RandReal() - Random.RandReal()) * 0.2f; + + // Sound: + SendSoundEffect("entity.generic.explode", a_Position, 4.0f, SoundPitchMultiplier * 0.7f); + + const auto ParticleFormula = a_Power * 0.33f; + auto Spread = ParticleFormula * 0.5f; + auto ParticleCount = std::min(static_cast<int>(ParticleFormula * 125), 600); + + // Dark smoke particles: + SendParticleEffect("largesmoke", a_Position.x, a_Position.y, a_Position.z, 0, 0, 0, Spread, static_cast<int>(ParticleCount)); + + Spread = ParticleFormula * 0.35f; + ParticleCount = std::min(static_cast<int>(ParticleFormula * 550), 1800); + + // Light smoke particles: + SendParticleEffect("explode", a_Position.x, a_Position.y, a_Position.z, 0, 0, 0, Spread, static_cast<int>(ParticleCount)); + + // Shockwave effect: + m_Protocol->SendExplosion(a_Position, a_Power); } |