diff options
author | Mattes D <github@xoft.cz> | 2014-03-16 21:43:33 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-03-16 21:43:33 +0100 |
commit | dc77cbfdc47016e0cb2a5ba9e4b18a1cb6896805 (patch) | |
tree | 0b599b418d62011ddc5f6ebb2702d7c4f6e1567e /src/Entities/ExpOrb.cpp | |
parent | Wrong if in BlockLeaves (diff) | |
parent | Fix anvil pickups. (diff) | |
download | cuberite-dc77cbfdc47016e0cb2a5ba9e4b18a1cb6896805.tar cuberite-dc77cbfdc47016e0cb2a5ba9e4b18a1cb6896805.tar.gz cuberite-dc77cbfdc47016e0cb2a5ba9e4b18a1cb6896805.tar.bz2 cuberite-dc77cbfdc47016e0cb2a5ba9e4b18a1cb6896805.tar.lz cuberite-dc77cbfdc47016e0cb2a5ba9e4b18a1cb6896805.tar.xz cuberite-dc77cbfdc47016e0cb2a5ba9e4b18a1cb6896805.tar.zst cuberite-dc77cbfdc47016e0cb2a5ba9e4b18a1cb6896805.zip |
Diffstat (limited to 'src/Entities/ExpOrb.cpp')
-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); + } } |