summaryrefslogtreecommitdiffstats
path: root/src/Entities/ExpOrb.cpp
diff options
context:
space:
mode:
authorTycho Bickerstaff <work.tycho@gmail.com>2013-12-11 00:01:35 +0100
committerTycho Bickerstaff <work.tycho@gmail.com>2013-12-11 00:01:35 +0100
commitdd633d5a947771cd37f8a853ceb44660752a7e3c (patch)
tree0141233cb7025eaca681513b6670b325c76f57c1 /src/Entities/ExpOrb.cpp
parentadded tolua++ command and removed stackwalker from build (diff)
parentMerge branch 'master' of https://github.com/mc-server/MCServer (diff)
downloadcuberite-dd633d5a947771cd37f8a853ceb44660752a7e3c.tar
cuberite-dd633d5a947771cd37f8a853ceb44660752a7e3c.tar.gz
cuberite-dd633d5a947771cd37f8a853ceb44660752a7e3c.tar.bz2
cuberite-dd633d5a947771cd37f8a853ceb44660752a7e3c.tar.lz
cuberite-dd633d5a947771cd37f8a853ceb44660752a7e3c.tar.xz
cuberite-dd633d5a947771cd37f8a853ceb44660752a7e3c.tar.zst
cuberite-dd633d5a947771cd37f8a853ceb44660752a7e3c.zip
Diffstat (limited to 'src/Entities/ExpOrb.cpp')
-rw-r--r--src/Entities/ExpOrb.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/Entities/ExpOrb.cpp b/src/Entities/ExpOrb.cpp
index 1e5ee00ce..248fb7278 100644
--- a/src/Entities/ExpOrb.cpp
+++ b/src/Entities/ExpOrb.cpp
@@ -40,21 +40,25 @@ void cExpOrb::SpawnOn(cClientHandle & a_Client)
void cExpOrb::Tick(float a_Dt, cChunk & a_Chunk)
{
- cPlayer * a_ClosestPlayer(m_World->FindClosestPlayer(Vector3f(GetPosition()), 4));
- if (a_ClosestPlayer)
+ cPlayer * a_ClosestPlayer(m_World->FindClosestPlayer(Vector3f(GetPosition()), 5));
+ if (a_ClosestPlayer != NULL)
{
Vector3f a_PlayerPos(a_ClosestPlayer->GetPosition());
+ a_PlayerPos.y++;
Vector3f a_Distance(a_PlayerPos - GetPosition());
- if (a_Distance.Length() < 0.1f)
+ double Distance(a_Distance.Length());
+ if (Distance < 0.1f)
{
+ LOGD("Player %s picked up an ExpOrb. His reward is %i", a_ClosestPlayer->GetName().c_str(), m_Reward);
a_ClosestPlayer->DeltaExperience(m_Reward);
- a_ClosestPlayer->SendExperience();
Destroy(true);
}
- a_Distance.y = 0;
a_Distance.Normalize();
- a_Distance *= 3;
+ a_Distance *= ((float) (5.5 - Distance));
SetSpeedX( a_Distance.x );
+ SetSpeedY( a_Distance.y );
SetSpeedZ( a_Distance.z );
+ BroadcastMovementUpdate();
}
+ HandlePhysics(a_Dt, a_Chunk);
} \ No newline at end of file