Exemplo n.º 1
0
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
	{

		class cNotifyWolves : public cEntityCallback
		{
		public:
			cPawn * m_EntityHit;

			cNotifyWolves(cPawn * a_Entity) :
				m_EntityHit(a_Entity)
			{
			}

			virtual bool Item(cEntity * a_Player) override
			{
				static_cast<cPlayer*>(a_Player)->NotifyFriendlyWolves(m_EntityHit);
				return true;
			}
		} Callback(static_cast<cPawn*>(&a_EntityHit));

		m_World->DoWithEntityByID(GetCreatorUniqueID(), Callback);
	}
}
Exemplo n.º 2
0
void cProjectileEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos)
{
    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;

            virtual bool Item(cEntity * a_Hitter) override
            {
                static_cast<cPlayer*>(a_Hitter)->NotifyNearbyWolves(m_EntityHit, true);
                return true;
            }
        } Callback;

        Callback.m_EntityHit = static_cast<cPawn*>(&a_EntityHit);
        m_World->DoWithEntityByID(GetCreatorUniqueID(), Callback);
    }
}