diff options
Diffstat (limited to 'src/Entities/TNTEntity.cpp')
-rw-r--r-- | src/Entities/TNTEntity.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/Entities/TNTEntity.cpp b/src/Entities/TNTEntity.cpp index aaf3261b4..6aea6e228 100644 --- a/src/Entities/TNTEntity.cpp +++ b/src/Entities/TNTEntity.cpp @@ -8,7 +8,7 @@ -cTNTEntity::cTNTEntity(Vector3d a_Pos, int a_FuseTicks) : +cTNTEntity::cTNTEntity(Vector3d a_Pos, unsigned a_FuseTicks) : Super(etTNT, a_Pos, 0.98, 0.98), m_FuseTicks(a_FuseTicks) { @@ -33,10 +33,14 @@ void cTNTEntity::SpawnOn(cClientHandle & a_ClientHandle) void cTNTEntity::Explode(void) { - m_FuseTicks = 0; - Destroy(); FLOGD("BOOM at {0}", GetPosition()); - m_World->DoExplosionAt(4.0, GetPosX(), GetPosY(), GetPosZ(), true, esPrimedTNT, this); + + // Destroy first so the Explodinator doesn't find us (when iterating through entities): + Destroy(); + + // TODO: provided centred coordinates to all calls to DoExplosionAt, from entities and blocks + // This is to ensure maximum efficiency of explosions + m_World->DoExplosionAt(4.0, GetPosX(), GetPosY() + GetHeight() / 2, GetPosZ(), true, esPrimedTNT, this); } @@ -51,6 +55,7 @@ void cTNTEntity::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) // The base class tick destroyed us return; } + BroadcastMovementUpdate(); m_FuseTicks -= 1; |