diff options
author | keyboard.osh@gmail.com <keyboard.osh@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-05-04 08:25:58 +0200 |
---|---|---|
committer | keyboard.osh@gmail.com <keyboard.osh@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-05-04 08:25:58 +0200 |
commit | c1e6fb454fc6d9e15e93665c9184503c0af6021f (patch) | |
tree | cbbc2d4e25b67250db5d5ae871f0772032dd30d2 /source/World.cpp | |
parent | Added lots of new options in the world config tab. (diff) | |
download | cuberite-c1e6fb454fc6d9e15e93665c9184503c0af6021f.tar cuberite-c1e6fb454fc6d9e15e93665c9184503c0af6021f.tar.gz cuberite-c1e6fb454fc6d9e15e93665c9184503c0af6021f.tar.bz2 cuberite-c1e6fb454fc6d9e15e93665c9184503c0af6021f.tar.lz cuberite-c1e6fb454fc6d9e15e93665c9184503c0af6021f.tar.xz cuberite-c1e6fb454fc6d9e15e93665c9184503c0af6021f.tar.zst cuberite-c1e6fb454fc6d9e15e93665c9184503c0af6021f.zip |
Diffstat (limited to 'source/World.cpp')
-rw-r--r-- | source/World.cpp | 35 |
1 files changed, 4 insertions, 31 deletions
diff --git a/source/World.cpp b/source/World.cpp index 418f078eb..b10f68554 100644 --- a/source/World.cpp +++ b/source/World.cpp @@ -705,37 +705,9 @@ bool cWorld::ForEachFurnaceInChunk(int a_ChunkX, int a_ChunkZ, cFurnaceCallback void cWorld::DoExplosiontAt(float a_ExplosionSize, int a_BlockX, int a_BlockY, int a_BlockZ) { - // TODO: implement explosion using cBlockArea / in cChunkMap, add damage to entities, add support for pickups, and implement block hardiness + // TODO: Add damage to entities, add support for pickups, and implement block hardiness Vector3d explosion_pos = Vector3d(a_BlockX,a_BlockY,a_BlockZ); - cVector3iArray BlocksAffected; - int ExplosionSizeInt = (int)a_ExplosionSize; - BlocksAffected.reserve(8 * ExplosionSizeInt * ExplosionSizeInt * ExplosionSizeInt); - for (int x = 0; x < ExplosionSizeInt; x++) - { - for (int y = 0; y < ExplosionSizeInt; y++) - { - for (int z = 0; z < ExplosionSizeInt; z++) - { - DigBlock(a_BlockX + x, a_BlockY + y, a_BlockZ + z); - DigBlock(a_BlockX + x, a_BlockY - y, a_BlockZ + z); - DigBlock(a_BlockX - x, a_BlockY - y, a_BlockZ - z); - DigBlock(a_BlockX - x, a_BlockY + y, a_BlockZ - z); - DigBlock(a_BlockX + x, a_BlockY + y, a_BlockZ - z); - DigBlock(a_BlockX + x, a_BlockY - y, a_BlockZ - z); - DigBlock(a_BlockX - x, a_BlockY + y, a_BlockZ + z); - DigBlock(a_BlockX - x, a_BlockY - y, a_BlockZ + z); - BlocksAffected.push_back(Vector3i(a_BlockX + x, a_BlockY + y, a_BlockZ + z)); - BlocksAffected.push_back(Vector3i(a_BlockX + x, a_BlockY - y, a_BlockZ + z)); - BlocksAffected.push_back(Vector3i(a_BlockX - x, a_BlockY - y, a_BlockZ - z)); - BlocksAffected.push_back(Vector3i(a_BlockX - x, a_BlockY + y, a_BlockZ - z)); - BlocksAffected.push_back(Vector3i(a_BlockX + x, a_BlockY + y, a_BlockZ - z)); - BlocksAffected.push_back(Vector3i(a_BlockX + x, a_BlockY - y, a_BlockZ - z)); - BlocksAffected.push_back(Vector3i(a_BlockX - x, a_BlockY + y, a_BlockZ + z)); - BlocksAffected.push_back(Vector3i(a_BlockX - x, a_BlockY - y, a_BlockZ + z)); - } - } - - } + cVector3iArray * BlocksAffected = m_ChunkMap->DoExplosiontAt(a_ExplosionSize,a_BlockX,a_BlockY,a_BlockZ); BroadcastSoundEffect("random.explode", a_BlockX * 8, a_BlockY * 8, a_BlockZ * 8, 1.0f, 0.6f); { cCSLock Lock(m_CSPlayers); @@ -757,10 +729,11 @@ void cWorld::DoExplosiontAt(float a_ExplosionSize, int a_BlockX, int a_BlockY, i } distance_explosion.Normalize(); distance_explosion *= power; - ch->SendExplosion(a_BlockX, a_BlockY, a_BlockZ, a_ExplosionSize, BlocksAffected, distance_explosion); + ch->SendExplosion(a_BlockX, a_BlockY, a_BlockZ, a_ExplosionSize, *BlocksAffected, distance_explosion); } } } + delete BlocksAffected; } |