Revert "Replace ItemCallbacks with lambdas (#3948)"
This reverts commit 496c337cdf.
This commit is contained in:
committed by
Alexander Harkness
parent
700bbdabf5
commit
49c443896d
@@ -74,12 +74,29 @@ void cThrownEnderPearlEntity::TeleportCreator(const Vector3d & a_HitPos)
|
||||
return;
|
||||
}
|
||||
|
||||
GetWorld()->FindAndDoWithPlayer(m_CreatorData.m_Name, [=](cPlayer & a_Entity)
|
||||
class cProjectileCreatorCallbackForPlayers : public cPlayerListCallback
|
||||
{
|
||||
public:
|
||||
cProjectileCreatorCallbackForPlayers(cEntity * a_Attacker, Vector3i a_CallbackHitPos) :
|
||||
m_Attacker(a_Attacker),
|
||||
m_HitPos(a_CallbackHitPos)
|
||||
{
|
||||
}
|
||||
|
||||
virtual bool Item(cPlayer * a_Entity) override
|
||||
{
|
||||
// Teleport the creator here, make them take 5 damage:
|
||||
a_Entity.TeleportToCoords(a_HitPos.x, a_HitPos.y + 0.2, a_HitPos.z);
|
||||
a_Entity.TakeDamage(dtEnderPearl, this, 5, 0);
|
||||
a_Entity->TeleportToCoords(m_HitPos.x, m_HitPos.y + 0.2, m_HitPos.z);
|
||||
a_Entity->TakeDamage(dtEnderPearl, m_Attacker, 5, 0);
|
||||
return true;
|
||||
}
|
||||
);
|
||||
|
||||
private:
|
||||
|
||||
cEntity * m_Attacker;
|
||||
Vector3i m_HitPos;
|
||||
};
|
||||
|
||||
cProjectileCreatorCallbackForPlayers PCCFP(this, a_HitPos);
|
||||
GetWorld()->FindAndDoWithPlayer(m_CreatorData.m_Name, PCCFP);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user