diff options
author | Tycho <work.tycho+git@gmail.com> | 2014-03-17 17:44:34 +0100 |
---|---|---|
committer | Tycho <work.tycho+git@gmail.com> | 2014-03-17 17:44:34 +0100 |
commit | 90ab055eab62b35a8ddc681e6d79aa1d42afae9f (patch) | |
tree | b71798809ca05c1d904a18083a8c652a4954306a /src/Entities/ExpOrb.cpp | |
parent | Made buffers static const (diff) | |
parent | Fixed double to float conversions. (diff) | |
download | cuberite-90ab055eab62b35a8ddc681e6d79aa1d42afae9f.tar cuberite-90ab055eab62b35a8ddc681e6d79aa1d42afae9f.tar.gz cuberite-90ab055eab62b35a8ddc681e6d79aa1d42afae9f.tar.bz2 cuberite-90ab055eab62b35a8ddc681e6d79aa1d42afae9f.tar.lz cuberite-90ab055eab62b35a8ddc681e6d79aa1d42afae9f.tar.xz cuberite-90ab055eab62b35a8ddc681e6d79aa1d42afae9f.tar.zst cuberite-90ab055eab62b35a8ddc681e6d79aa1d42afae9f.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Entities/ExpOrb.cpp | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/src/Entities/ExpOrb.cpp b/src/Entities/ExpOrb.cpp index 3398f1c7b..3623c869a 100644 --- a/src/Entities/ExpOrb.cpp +++ b/src/Entities/ExpOrb.cpp @@ -5,20 +5,26 @@ #include "../ClientHandle.h" -cExpOrb::cExpOrb(double a_X, double a_Y, double a_Z, int a_Reward) : - cEntity(etExpOrb, a_X, a_Y, a_Z, 0.98, 0.98), - m_Reward(a_Reward) +cExpOrb::cExpOrb(double a_X, double a_Y, double a_Z, int a_Reward) + : cEntity(etExpOrb, a_X, a_Y, a_Z, 0.98, 0.98) + , m_Reward(a_Reward) + , m_Timer(0.f) { + SetMaxHealth(5); + SetHealth(5); } -cExpOrb::cExpOrb(const Vector3d & a_Pos, int a_Reward) : - cEntity(etExpOrb, a_Pos.x, a_Pos.y, a_Pos.z, 0.98, 0.98), - m_Reward(a_Reward) +cExpOrb::cExpOrb(const Vector3d & a_Pos, int a_Reward) + : cEntity(etExpOrb, a_Pos.x, a_Pos.y, a_Pos.z, 0.98, 0.98) + , m_Reward(a_Reward) + , m_Timer(0.f) { + SetMaxHealth(5); + SetHealth(5); } @@ -52,7 +58,7 @@ void cExpOrb::Tick(float a_Dt, cChunk & a_Chunk) LOGD("Player %s picked up an ExpOrb. His reward is %i", a_ClosestPlayer->GetName().c_str(), m_Reward); a_ClosestPlayer->DeltaExperience(m_Reward); - m_World->BroadcastSoundEffect("random.orb", (int)GetPosX() * 8, (int)GetPosY() * 8, (int)GetPosZ() * 8, 0.5f, (float)(0.75 + ((float)((GetUniqueID() * 23) % 32)) / 64)); + m_World->BroadcastSoundEffect("random.orb", (int)(GetPosX() * 8), (int)(GetPosY() * 8), (int)(GetPosZ() * 8), 0.5f, (float)(0.75 + ((float)((GetUniqueID() * 23) % 32)) / 64)); Destroy(); } @@ -64,4 +70,10 @@ void cExpOrb::Tick(float a_Dt, cChunk & a_Chunk) BroadcastMovementUpdate(); } HandlePhysics(a_Dt, a_Chunk); + + m_Timer += a_Dt; + if (m_Timer >= 1000 * 60 * 5) // 5 minutes + { + Destroy(true); + } } |