Improve explosion visuals (#4511)
This commit is contained in:
parent
0a1cfda02c
commit
61a6a18b79
@ -1407,7 +1407,11 @@ void cWorld::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_Blo
|
||||
// TODO: Implement block hardiness
|
||||
cVector3iArray BlocksAffected;
|
||||
m_ChunkMap->DoExplosionAt(a_ExplosionSize, a_BlockX, a_BlockY, a_BlockZ, BlocksAffected);
|
||||
BroadcastSoundEffect("entity.generic.explode", Vector3d(a_BlockX, a_BlockY, a_BlockZ), 1.0f, 0.6f);
|
||||
|
||||
auto & Random = GetRandomProvider();
|
||||
auto SoundPitchMultiplier = 1.0f + (Random.RandReal(1.0f) - Random.RandReal(1.0f)) * 0.2f;
|
||||
|
||||
BroadcastSoundEffect("entity.generic.explode", Vector3d(a_BlockX, a_BlockY, a_BlockZ), 4.0f, SoundPitchMultiplier * 0.7f);
|
||||
|
||||
{
|
||||
cCSLock Lock(m_CSPlayers);
|
||||
@ -1423,6 +1427,18 @@ void cWorld::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_Blo
|
||||
}
|
||||
}
|
||||
|
||||
auto Position = Vector3d(a_BlockX, a_BlockY - 0.5f, a_BlockZ);
|
||||
auto ParticleFormula = a_ExplosionSize * 0.33f;
|
||||
auto Spread = ParticleFormula * 0.5f;
|
||||
auto ParticleCount = std::min((ParticleFormula * 125), 600.0);
|
||||
|
||||
BroadcastParticleEffect("largesmoke", Position, Vector3f{}, static_cast<float>(Spread), static_cast<int>(ParticleCount));
|
||||
|
||||
Spread = ParticleFormula * 0.35f;
|
||||
ParticleCount = std::min((ParticleFormula * 550), 1800.0);
|
||||
|
||||
BroadcastParticleEffect("explode", Position, Vector3f{}, static_cast<float>(Spread), static_cast<int>(ParticleCount));
|
||||
|
||||
cPluginManager::Get()->CallHookExploded(*this, a_ExplosionSize, a_CanCauseFire, a_BlockX, a_BlockY, a_BlockZ, a_Source, a_SourceData);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user