Fixed random teleporting into the void when leaving minecarts

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1259 0a769ca7-a7f5-676a-18bf-c427514a06d6
master
madmaxoft@gmail.com 2013-03-05 20:49:07 +00:00
parent bc8ad9d1b1
commit 06dc6ae071
1 changed files with 9 additions and 4 deletions

View File

@ -558,13 +558,18 @@ void cPlayer::TeleportTo(double a_PosX, double a_PosY, double a_PosZ)
void cPlayer::MoveTo( const Vector3d & a_NewPos )
{
if (m_AttachedTo != NULL)
if ((a_NewPos.y < -990) && (m_Pos.y > -100))
{
// 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
// We cannot test m_AttachedTo, because when deattaching, the server thinks the client is already deattached while
// the client may still send more of these nonsensical packets.
if (m_AttachedTo != NULL)
{
Vector3d AddSpeed(a_NewPos);
AddSpeed.y = 0;
m_AttachedTo->AddSpeed(AddSpeed);
}
return;
}