summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
authorMat <mail@mathias.is>2020-03-22 16:33:36 +0100
committerGitHub <noreply@github.com>2020-03-22 16:33:36 +0100
commitc968f1f7da722eddb291c8ef474f1e0394621911 (patch)
tree74dbb39578e20e5b3ac9aa648bf093ab4ecf490d /src/World.cpp
parentFix invalid explosion damage (#4529) (diff)
downloadcuberite-c968f1f7da722eddb291c8ef474f1e0394621911.tar
cuberite-c968f1f7da722eddb291c8ef474f1e0394621911.tar.gz
cuberite-c968f1f7da722eddb291c8ef474f1e0394621911.tar.bz2
cuberite-c968f1f7da722eddb291c8ef474f1e0394621911.tar.lz
cuberite-c968f1f7da722eddb291c8ef474f1e0394621911.tar.xz
cuberite-c968f1f7da722eddb291c8ef474f1e0394621911.tar.zst
cuberite-c968f1f7da722eddb291c8ef474f1e0394621911.zip
Diffstat (limited to '')
-rw-r--r--src/World.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/World.cpp b/src/World.cpp
index d5209d69c..8883aae1d 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -2145,7 +2145,7 @@ UInt32 cWorld::SpawnBoat(Vector3d a_Pos, cBoat::eMaterial a_Material)
-UInt32 cWorld::SpawnPrimedTNT(Vector3d a_Pos, int a_FuseTicks, double a_InitialVelocityCoeff)
+UInt32 cWorld::SpawnPrimedTNT(Vector3d a_Pos, int a_FuseTicks, double a_InitialVelocityCoeff, bool a_ShouldPlayFuseSound)
{
auto TNT = cpp14::make_unique<cTNTEntity>(a_Pos, a_FuseTicks);
auto TNTPtr = TNT.get();
@@ -2154,11 +2154,16 @@ UInt32 cWorld::SpawnPrimedTNT(Vector3d a_Pos, int a_FuseTicks, double a_InitialV
return cEntity::INVALID_ID;
}
+ if (a_ShouldPlayFuseSound)
+ {
+ BroadcastSoundEffect("entity.tnt.primed", a_Pos, 1.0f, 1.0f);
+ }
+
auto & Random = GetRandomProvider();
TNTPtr->SetSpeed(
- a_InitialVelocityCoeff * Random.RandInt(-1, 1),
+ a_InitialVelocityCoeff * Random.RandReal(-0.5f, 0.5f),
a_InitialVelocityCoeff * 2,
- a_InitialVelocityCoeff * Random.RandInt(-1, 1)
+ a_InitialVelocityCoeff * Random.RandReal(-0.5f, 0.5f)
);
return TNTPtr->GetUniqueID();
}