diff options
author | andrew <xdotftw@gmail.com> | 2014-05-20 14:52:59 +0200 |
---|---|---|
committer | andrew <xdotftw@gmail.com> | 2014-05-20 14:52:59 +0200 |
commit | 07baf9bdd3b04e3aec6e77f367eb38c0547f54ca (patch) | |
tree | 3d4c9f2202d7d9fae351e462701ddfa819d49489 /src/Mobs/Wither.cpp | |
parent | There's no "round" function in MSVC2008. (diff) | |
download | cuberite-07baf9bdd3b04e3aec6e77f367eb38c0547f54ca.tar cuberite-07baf9bdd3b04e3aec6e77f367eb38c0547f54ca.tar.gz cuberite-07baf9bdd3b04e3aec6e77f367eb38c0547f54ca.tar.bz2 cuberite-07baf9bdd3b04e3aec6e77f367eb38c0547f54ca.tar.lz cuberite-07baf9bdd3b04e3aec6e77f367eb38c0547f54ca.tar.xz cuberite-07baf9bdd3b04e3aec6e77f367eb38c0547f54ca.tar.zst cuberite-07baf9bdd3b04e3aec6e77f367eb38c0547f54ca.zip |
Diffstat (limited to 'src/Mobs/Wither.cpp')
-rw-r--r-- | src/Mobs/Wither.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/Mobs/Wither.cpp b/src/Mobs/Wither.cpp index 5b6e895e1..deb2cf34e 100644 --- a/src/Mobs/Wither.cpp +++ b/src/Mobs/Wither.cpp @@ -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); +} + + + + |