summaryrefslogtreecommitdiffstats
path: root/src/Entities/ExpOrb.cpp
diff options
context:
space:
mode:
authorSTRWarrior <niels.breuker@hotmail.nl>2013-12-11 16:14:08 +0100
committerSTRWarrior <niels.breuker@hotmail.nl>2013-12-11 16:14:08 +0100
commitbba51755d4eae0595e583e2d4e9dfe9093506cff (patch)
treecc2320d2827e38a4d94b3c5e1af68ce3c6f9c847 /src/Entities/ExpOrb.cpp
parentMerge pull request #416 from mc-server/repeaterfix (diff)
downloadcuberite-bba51755d4eae0595e583e2d4e9dfe9093506cff.tar
cuberite-bba51755d4eae0595e583e2d4e9dfe9093506cff.tar.gz
cuberite-bba51755d4eae0595e583e2d4e9dfe9093506cff.tar.bz2
cuberite-bba51755d4eae0595e583e2d4e9dfe9093506cff.tar.lz
cuberite-bba51755d4eae0595e583e2d4e9dfe9093506cff.tar.xz
cuberite-bba51755d4eae0595e583e2d4e9dfe9093506cff.tar.zst
cuberite-bba51755d4eae0595e583e2d4e9dfe9093506cff.zip
Diffstat (limited to 'src/Entities/ExpOrb.cpp')
-rw-r--r--src/Entities/ExpOrb.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/Entities/ExpOrb.cpp b/src/Entities/ExpOrb.cpp
index 1e5ee00ce..83c522a18 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));
+ cPlayer * a_ClosestPlayer(m_World->FindClosestPlayer(Vector3f(GetPosition()), 5));
if (a_ClosestPlayer)
{
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)
{
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