From 01b24d73eab6b0e708063d82f01ea9bb9296550c Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sun, 3 Mar 2013 19:05:11 +0000 Subject: Player can sit in minecarts (but not move them yet) git-svn-id: http://mc-server.googlecode.com/svn/trunk@1249 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Player.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'source/Player.cpp') diff --git a/source/Player.cpp b/source/Player.cpp index f00b0768c..e84eee899 100644 --- a/source/Player.cpp +++ b/source/Player.cpp @@ -165,7 +165,7 @@ void cPlayer::Tick(float a_Dt, MTRand & a_TickRandom) } super::Tick(a_Dt, a_TickRandom); - + if (m_bDirtyOrientation && !m_bDirtyPosition) { m_World->BroadcastEntLook(*this, m_ClientHandle); @@ -558,6 +558,16 @@ void cPlayer::TeleportTo(double a_PosX, double a_PosY, double a_PosZ) void cPlayer::MoveTo( const Vector3d & a_NewPos ) { + if (m_AttachedTo != NULL) + { + // When attached to an entity, the client sends position packets with weird coords: + // Y = -999 and X, Z = attempting to create speed, usually up to 0.03 + Vector3d AddSpeed(a_NewPos); + AddSpeed.y = 0; + m_AttachedTo->AddSpeed(AddSpeed); + return; + } + // TODO: should do some checks to see if player is not moving through terrain // TODO: Official server refuses position packets too far away from each other, kicking "hacked" clients; we should, too -- cgit v1.2.3