diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-09-02 20:11:38 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-09-02 20:11:38 +0200 |
commit | e431bb4e63b03a4137e4264beccfab0fffea6e36 (patch) | |
tree | e5442606b9e5be82070dc733b6162a76ed89ac87 /src/World.cpp | |
parent | Changed the IsEnchantable() comment. (diff) | |
parent | Re-added alternate spellings of darkgraywool. (diff) | |
download | cuberite-e431bb4e63b03a4137e4264beccfab0fffea6e36.tar cuberite-e431bb4e63b03a4137e4264beccfab0fffea6e36.tar.gz cuberite-e431bb4e63b03a4137e4264beccfab0fffea6e36.tar.bz2 cuberite-e431bb4e63b03a4137e4264beccfab0fffea6e36.tar.lz cuberite-e431bb4e63b03a4137e4264beccfab0fffea6e36.tar.xz cuberite-e431bb4e63b03a4137e4264beccfab0fffea6e36.tar.zst cuberite-e431bb4e63b03a4137e4264beccfab0fffea6e36.zip |
Diffstat (limited to 'src/World.cpp')
-rw-r--r-- | src/World.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/World.cpp b/src/World.cpp index 69d1217f1..99e09c658 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -1226,24 +1226,26 @@ void cWorld::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_Blo return; } - // TODO: Add damage to entities and implement block hardiness + // TODO: Implement block hardiness Vector3d explosion_pos = Vector3d(a_BlockX, a_BlockY, a_BlockZ); cVector3iArray BlocksAffected; m_ChunkMap->DoExplosionAt(a_ExplosionSize, a_BlockX, a_BlockY, a_BlockZ, BlocksAffected); BroadcastSoundEffect("random.explode", (double)a_BlockX, (double)a_BlockY, (double)a_BlockZ, 1.0f, 0.6f); + { cCSLock Lock(m_CSPlayers); for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) { cClientHandle * ch = (*itr)->GetClientHandle(); - if ((ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed()) + if (ch == NULL) { continue; } + Vector3d distance_explosion = (*itr)->GetPosition() - explosion_pos; if (distance_explosion.SqrLength() < 4096.0) { - double real_distance = std::max(0.004, sqrt(distance_explosion.SqrLength())); + double real_distance = std::max(0.004, distance_explosion.Length()); double power = a_ExplosionSize / real_distance; if (power <= 1) { @@ -1255,6 +1257,7 @@ void cWorld::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_Blo } } } + cPluginManager::Get()->CallHookExploded(*this, a_ExplosionSize, a_CanCauseFire, a_BlockX, a_BlockY, a_BlockZ, a_Source, a_SourceData); } @@ -3484,14 +3487,16 @@ void cWorld::cChunkGeneratorCallbacks::OnChunkGenerated(cChunkDesc & a_ChunkDesc cChunkDef::BlockNibbles BlockMetas; a_ChunkDesc.CompressBlockMetas(BlockMetas); - m_World->QueueSetChunkData(cSetChunkDataPtr(new cSetChunkData( + cSetChunkDataPtr SetChunkData(new cSetChunkData( a_ChunkDesc.GetChunkX(), a_ChunkDesc.GetChunkZ(), a_ChunkDesc.GetBlockTypes(), BlockMetas, NULL, NULL, // We don't have lighting, chunk will be lighted when needed &a_ChunkDesc.GetHeightMap(), &a_ChunkDesc.GetBiomeMap(), a_ChunkDesc.GetEntities(), a_ChunkDesc.GetBlockEntities(), true - ))); + )); + SetChunkData->RemoveInvalidBlockEntities(); + m_World->QueueSetChunkData(SetChunkData); } |