diff options
Diffstat (limited to '')
-rw-r--r-- | src/ChunkMap.cpp | 2 | ||||
-rw-r--r-- | src/Entities/Entity.cpp | 2 | ||||
-rw-r--r-- | src/Entities/TNTEntity.cpp | 2 | ||||
-rw-r--r-- | src/Items/ItemLighter.h | 1 | ||||
-rw-r--r-- | src/Simulator/FireSimulator.cpp | 2 | ||||
-rw-r--r-- | src/Simulator/IncrementalRedstoneSimulator/TNTHandler.h | 3 | ||||
-rw-r--r-- | src/World.cpp | 11 | ||||
-rw-r--r-- | src/World.h | 6 |
8 files changed, 16 insertions, 13 deletions
diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp index 98d63df94..6edcf3d54 100644 --- a/src/ChunkMap.cpp +++ b/src/ChunkMap.cpp @@ -1199,7 +1199,7 @@ void cChunkMap::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_ { // Activate the TNT, with a random fuse between 10 to 30 game ticks int FuseTime = GetRandomProvider().RandInt(10, 30); - m_World->SpawnPrimedTNT({a_BlockX + x + 0.5, a_BlockY + y + 0.5, a_BlockZ + z + 0.5}, FuseTime); + m_World->SpawnPrimedTNT({a_BlockX + x + 0.5, a_BlockY + y + 0.5, a_BlockZ + z + 0.5}, FuseTime, 1, false); // Initial velocity, no fuse sound area.SetBlockTypeMeta(bx + x, by + y, bz + z, E_BLOCK_AIR, 0); a_BlocksAffected.push_back(Vector3i(bx + x, by + y, bz + z)); break; diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 99f8b56b8..90683271a 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -972,7 +972,7 @@ void cEntity::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) } } } - else + else if (!(IsMinecart() || IsTNT())) { // Push out entity. BLOCKTYPE GotBlock; diff --git a/src/Entities/TNTEntity.cpp b/src/Entities/TNTEntity.cpp index a86aa40e3..6ee56b92a 100644 --- a/src/Entities/TNTEntity.cpp +++ b/src/Entities/TNTEntity.cpp @@ -36,7 +36,7 @@ void cTNTEntity::Explode(void) m_FuseTicks = 0; Destroy(); FLOGD("BOOM at {0}", GetPosition()); - m_World->DoExplosionAt(4.0, GetPosX() + 0.49, GetPosY() + 0.49, GetPosZ() + 0.49, true, esPrimedTNT, this); + m_World->DoExplosionAt(4.0, GetPosX(), GetPosY(), GetPosZ(), true, esPrimedTNT, this); } diff --git a/src/Items/ItemLighter.h b/src/Items/ItemLighter.h index 5255e17f0..241e0511e 100644 --- a/src/Items/ItemLighter.h +++ b/src/Items/ItemLighter.h @@ -56,7 +56,6 @@ public: case E_BLOCK_TNT: { // Activate the TNT: - a_World->BroadcastSoundEffect("entity.tnt.primed", Vector3d(a_BlockX, a_BlockY, a_BlockZ), 1.0f, 1.0f); a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0); a_World->SpawnPrimedTNT({a_BlockX + 0.5, a_BlockY + 0.5, a_BlockZ + 0.5}); // 80 ticks to boom break; diff --git a/src/Simulator/FireSimulator.cpp b/src/Simulator/FireSimulator.cpp index 2b603315e..304450b3c 100644 --- a/src/Simulator/FireSimulator.cpp +++ b/src/Simulator/FireSimulator.cpp @@ -385,7 +385,7 @@ void cFireSimulator::RemoveFuelNeighbors(cChunk * a_Chunk, Vector3i a_RelPos) if (BlockType == E_BLOCK_TNT) { neighbor->SetBlock(relPos, E_BLOCK_AIR, 0); - m_World.SpawnPrimedTNT(absPos, 0); + m_World.SpawnPrimedTNT(Vector3d(absPos) + Vector3d(0.5, 0.5, 0.5)); // 80 ticks to boom return; } diff --git a/src/Simulator/IncrementalRedstoneSimulator/TNTHandler.h b/src/Simulator/IncrementalRedstoneSimulator/TNTHandler.h index b7a4664cc..5c739baba 100644 --- a/src/Simulator/IncrementalRedstoneSimulator/TNTHandler.h +++ b/src/Simulator/IncrementalRedstoneSimulator/TNTHandler.h @@ -37,9 +37,8 @@ public: // LOGD("Evaluating explodinator the trinitrotoluene (%d %d %d)", a_Position.x, a_Position.y, a_Position.z); if (a_PoweringData.PowerLevel != 0) { - a_World.BroadcastSoundEffect("entity.tnt.primed", a_Position, 0.5f, 0.6f); a_World.SetBlock(a_Position.x, a_Position.y, a_Position.z, E_BLOCK_AIR, 0); - a_World.SpawnPrimedTNT(a_Position + Vector3d(0.5, 0.5, 0.5)); // 80 ticks to boom + a_World.SpawnPrimedTNT(Vector3d(a_Position) + Vector3d(0.5, 0.5, 0.5)); // 80 ticks to boom } return {}; } 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(); } diff --git a/src/World.h b/src/World.h index 4363804c6..165578e07 100644 --- a/src/World.h +++ b/src/World.h @@ -625,16 +625,16 @@ public: // tolua_begin // DEPRECATED, use the vector-parametered version instead. - UInt32 SpawnPrimedTNT(double a_X, double a_Y, double a_Z, int a_FuseTimeInSec = 80, double a_InitialVelocityCoeff = 1) + UInt32 SpawnPrimedTNT(double a_X, double a_Y, double a_Z, int a_FuseTimeInSec = 80, double a_InitialVelocityCoeff = 1, bool a_ShouldPlayFuseSound = true) { LOGWARNING("cWorld::SpawnPrimedTNT(double, double, double) is deprecated, use cWorld::SpawnPrimedTNT(Vector3d) instead."); - return SpawnPrimedTNT({a_X, a_Y, a_Z}, a_FuseTimeInSec, a_InitialVelocityCoeff); + return SpawnPrimedTNT({a_X, a_Y, a_Z}, a_FuseTimeInSec, a_InitialVelocityCoeff, a_ShouldPlayFuseSound); } /** Spawns a new primed TNT entity at the specified block coords and specified fuse duration. Initial velocity is given based on the relative coefficient provided. Returns the UniqueID of the created entity, or cEntity::INVALID_ID on failure. */ - UInt32 SpawnPrimedTNT(Vector3d a_Pos, int a_FuseTimeInSec = 80, double a_InitialVelocityCoeff = 1); + UInt32 SpawnPrimedTNT(Vector3d a_Pos, int a_FuseTimeInSec = 80, double a_InitialVelocityCoeff = 1, bool a_ShouldPlayFuseSound = true); // tolua_end |