From 439b3304f4c82448b0e1585f8641503691212cac Mon Sep 17 00:00:00 2001 From: LogicParrot Date: Fri, 22 Jan 2016 20:55:46 +0200 Subject: Improved tamed wolf pack cooperation and projectile reactions --- src/Entities/ProjectileEntity.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'src/Entities/ProjectileEntity.cpp') 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(a_Player)->NotifyFriendlyWolves(m_EntityHit); + static_cast(a_Hitter)->NotifyNearbyWolves(m_EntityHit, true); return true; } - } Callback(static_cast(&a_EntityHit)); + } Callback; + Callback.m_EntityHit = static_cast(&a_EntityHit); m_World->DoWithEntityByID(GetCreatorUniqueID(), Callback); } } -- cgit v1.2.3