summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
authorSTRWarrior <STRWarrior@users.noreply.github.com>2014-08-30 22:42:38 +0200
committerSTRWarrior <STRWarrior@users.noreply.github.com>2014-08-30 22:42:38 +0200
commit9f321e29cf50c5cdd828fa1bbce1de2f0cbbc58e (patch)
treea6ad2990fdaff104c3663a8655be26ad55dc1ccc /src/World.cpp
parentWSSAnvil: Removed leftover debugging code. (diff)
parentFixed style. (diff)
downloadcuberite-9f321e29cf50c5cdd828fa1bbce1de2f0cbbc58e.tar
cuberite-9f321e29cf50c5cdd828fa1bbce1de2f0cbbc58e.tar.gz
cuberite-9f321e29cf50c5cdd828fa1bbce1de2f0cbbc58e.tar.bz2
cuberite-9f321e29cf50c5cdd828fa1bbce1de2f0cbbc58e.tar.lz
cuberite-9f321e29cf50c5cdd828fa1bbce1de2f0cbbc58e.tar.xz
cuberite-9f321e29cf50c5cdd828fa1bbce1de2f0cbbc58e.tar.zst
cuberite-9f321e29cf50c5cdd828fa1bbce1de2f0cbbc58e.zip
Diffstat (limited to 'src/World.cpp')
-rw-r--r--src/World.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/World.cpp b/src/World.cpp
index b01e53638..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);
}