From 8866a28cf835fd3f814d4413ab2b5883999e2065 Mon Sep 17 00:00:00 2001 From: peterbell10 Date: Wed, 27 Sep 2017 22:22:15 +0100 Subject: Fix explosion interaction with block entities. (#4052) * WriteBlockArea: Fix erasing of block entities. * cChunkMap::DoExplosionAt destroys block entities --- src/ChunkMap.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/ChunkMap.cpp') diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp index 30bab923d..d970956f3 100644 --- a/src/ChunkMap.cpp +++ b/src/ChunkMap.cpp @@ -19,6 +19,7 @@ #include "Blocks/ChunkInterface.h" #include "Entities/Pickup.h" #include "DeadlockDetect.h" +#include "BlockEntities/BlockEntity.h" #ifndef _WIN32 #include // abs @@ -1763,6 +1764,18 @@ void cChunkMap::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_ } } + // Destroy any block entities + if (cBlockEntity::IsBlockEntityBlockType(Block)) + { + Vector3i BlockPos(bx + x, by + y, bz + z); + DoWithBlockEntityAt(BlockPos.x, BlockPos.y, BlockPos.z, [](cBlockEntity & a_BE) + { + a_BE.Destroy(); + return true; + } + ); + } + area.SetBlockTypeMeta(bx + x, by + y, bz + z, E_BLOCK_AIR, 0); a_BlocksAffected.push_back(Vector3i(bx + x, by + y, bz + z)); break; -- cgit v1.2.3