diff options
author | Mattes D <github@xoft.cz> | 2014-03-29 22:32:50 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-03-29 22:32:50 +0100 |
commit | 37812813d3bf8011089bc6e117b226a14a844540 (patch) | |
tree | af60ec69801c9bd9a80d7b5328814c490cb6fc47 /src/Entities | |
parent | Renamed lua dll for tolua++.exe. (diff) | |
parent | Fixed the OnProjectileHitBlock hook not stopping projectiles. (diff) | |
download | cuberite-37812813d3bf8011089bc6e117b226a14a844540.tar cuberite-37812813d3bf8011089bc6e117b226a14a844540.tar.gz cuberite-37812813d3bf8011089bc6e117b226a14a844540.tar.bz2 cuberite-37812813d3bf8011089bc6e117b226a14a844540.tar.lz cuberite-37812813d3bf8011089bc6e117b226a14a844540.tar.xz cuberite-37812813d3bf8011089bc6e117b226a14a844540.tar.zst cuberite-37812813d3bf8011089bc6e117b226a14a844540.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Entities/ProjectileEntity.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/Entities/ProjectileEntity.cpp b/src/Entities/ProjectileEntity.cpp index f4ab825f2..a9735a53c 100644 --- a/src/Entities/ProjectileEntity.cpp +++ b/src/Entities/ProjectileEntity.cpp @@ -4,6 +4,7 @@ // Implements the cProjectileEntity class representing the common base class for projectiles, as well as individual projectile types #include "Globals.h" +#include "../Bindings/PluginManager.h" #include "ProjectileEntity.h" #include "../ClientHandle.h" #include "Player.h" @@ -66,6 +67,11 @@ protected: eBlockFace Face; if (bb.CalcLineIntersection(Line1, Line2, LineCoeff, Face)) { + if (cPluginManager::Get()->CallHookProjectileHitBlock(*m_Projectile)) + { + return false; + } + Vector3d Intersection = Line1 + m_Projectile->GetSpeed() * LineCoeff; m_Projectile->OnHitSolidBlock(Intersection, Face); return true; @@ -147,7 +153,11 @@ public: } // TODO: Some entities don't interact with the projectiles (pickups, falling blocks) - // TODO: Allow plugins to interfere about which entities can be hit + if (cPluginManager::Get()->CallHookProjectileHitEntity(*m_Projectile, *a_Entity)) + { + // A plugin disagreed. + return false; + } if (LineCoeff < m_MinCoeff) { |