1
0

Cleaned up cPlayer::UpdateMovementStats; Wither achievements

This commit is contained in:
andrew
2014-05-20 15:52:59 +03:00
parent a651c865e4
commit 07baf9bdd3
7 changed files with 128 additions and 15 deletions

View File

@@ -2,7 +2,9 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "Wither.h"
#include "../World.h"
#include "../Entities/Player.h"
@@ -100,3 +102,34 @@ void cWither::GetDrops(cItems & a_Drops, cEntity * a_Killer)
void cWither::KilledBy(cEntity * a_Killer)
{
UNUSED(a_Killer);
class cPlayerCallback : public cPlayerListCallback
{
Vector3f m_Pos;
virtual bool Item(cPlayer * a_Player)
{
double Dist = (a_Player->GetPosition() - m_Pos).Length();
if (Dist < 50.0)
{
// If player is close, award achievement
a_Player->AwardAchievement(achKillWither);
}
return false;
}
public:
cPlayerCallback(const Vector3f & a_Pos) : m_Pos(a_Pos) {}
} PlayerCallback(GetPosition());
m_World->ForEachPlayer(PlayerCallback);
}