summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
authorMat <mail@mathias.is>2020-03-21 00:42:16 +0100
committerGitHub <noreply@github.com>2020-03-21 00:42:16 +0100
commit61a6a18b796365f03bdcdccb6eb8f2951c814bc1 (patch)
tree1c69cfacaef73f62495cc98f27d04b3816cfbedf /src/World.cpp
parentClamp teleportation position (#4203) (diff)
downloadcuberite-61a6a18b796365f03bdcdccb6eb8f2951c814bc1.tar
cuberite-61a6a18b796365f03bdcdccb6eb8f2951c814bc1.tar.gz
cuberite-61a6a18b796365f03bdcdccb6eb8f2951c814bc1.tar.bz2
cuberite-61a6a18b796365f03bdcdccb6eb8f2951c814bc1.tar.lz
cuberite-61a6a18b796365f03bdcdccb6eb8f2951c814bc1.tar.xz
cuberite-61a6a18b796365f03bdcdccb6eb8f2951c814bc1.tar.zst
cuberite-61a6a18b796365f03bdcdccb6eb8f2951c814bc1.zip
Diffstat (limited to '')
-rw-r--r--src/World.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/World.cpp b/src/World.cpp
index a80cffbcc..d5209d69c 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -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);
}