diff options
Diffstat (limited to 'src/Entities/ProjectileEntity.cpp')
-rw-r--r-- | src/Entities/ProjectileEntity.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/Entities/ProjectileEntity.cpp b/src/Entities/ProjectileEntity.cpp index bb08f38d9..72dccbfb4 100644 --- a/src/Entities/ProjectileEntity.cpp +++ b/src/Entities/ProjectileEntity.cpp @@ -314,26 +314,24 @@ void cProjectileEntity::OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_ void cProjectileEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) { - if (a_EntityHit.IsPawn() && (GetCreatorName() != "")) // If we're hitting a mob or a player and we were created by a player - { + UNUSED(a_HitPos); + // If we were created by a player and we hit a pawn, notify attacking player's wolves + if (a_EntityHit.IsPawn() && (GetCreatorName() != "")) + { class cNotifyWolves : public cEntityCallback { public: cPawn * m_EntityHit; - cNotifyWolves(cPawn * a_Entity) : - m_EntityHit(a_Entity) - { - } - - virtual bool Item(cEntity * a_Player) override + virtual bool Item(cEntity * a_Hitter) override { - static_cast<cPlayer*>(a_Player)->NotifyFriendlyWolves(m_EntityHit); + static_cast<cPlayer*>(a_Hitter)->NotifyNearbyWolves(m_EntityHit, true); return true; } - } Callback(static_cast<cPawn*>(&a_EntityHit)); + } Callback; + Callback.m_EntityHit = static_cast<cPawn*>(&a_EntityHit); m_World->DoWithEntityByID(GetCreatorUniqueID(), Callback); } } |