mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
[11727] Interrupt spline movement at teleporting
this fixes the position desync issue caused by teleport packets
This commit is contained in:
parent
e246d8d94e
commit
94133107c7
5 changed files with 13 additions and 2 deletions
|
|
@ -1759,6 +1759,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
||||||
|
|
||||||
// reset movement flags at teleport, because player will continue move with these flags after teleport
|
// reset movement flags at teleport, because player will continue move with these flags after teleport
|
||||||
m_movementInfo.SetMovementFlags(MOVEFLAG_NONE);
|
m_movementInfo.SetMovementFlags(MOVEFLAG_NONE);
|
||||||
|
DisableSpline();
|
||||||
|
|
||||||
if ((GetMapId() == mapid) && (!m_transport))
|
if ((GetMapId() == mapid) && (!m_transport))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10393,6 +10393,8 @@ void Unit::SetPhaseMask(uint32 newPhaseMask, bool update)
|
||||||
|
|
||||||
void Unit::NearTeleportTo( float x, float y, float z, float orientation, bool casting /*= false*/ )
|
void Unit::NearTeleportTo( float x, float y, float z, float orientation, bool casting /*= false*/ )
|
||||||
{
|
{
|
||||||
|
DisableSpline();
|
||||||
|
|
||||||
if(GetTypeId() == TYPEID_PLAYER)
|
if(GetTypeId() == TYPEID_PLAYER)
|
||||||
((Player*)this)->TeleportTo(GetMapId(), x, y, z, orientation, TELE_TO_NOT_LEAVE_TRANSPORT | TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET | (casting ? TELE_TO_SPELL : 0));
|
((Player*)this)->TeleportTo(GetMapId(), x, y, z, orientation, TELE_TO_NOT_LEAVE_TRANSPORT | TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET | (casting ? TELE_TO_SPELL : 0));
|
||||||
else
|
else
|
||||||
|
|
@ -10808,7 +10810,7 @@ void Unit::UpdateSplineMovement(uint32 t_diff)
|
||||||
bool arrived = movespline->Finalized();
|
bool arrived = movespline->Finalized();
|
||||||
|
|
||||||
if (arrived)
|
if (arrived)
|
||||||
m_movementInfo.RemoveMovementFlag(MovementFlags(MOVEFLAG_SPLINE_ENABLED|MOVEFLAG_FORWARD));
|
DisableSpline();
|
||||||
|
|
||||||
m_movesplineTimer.Update(t_diff);
|
m_movesplineTimer.Update(t_diff);
|
||||||
if (m_movesplineTimer.Passed() || arrived)
|
if (m_movesplineTimer.Passed() || arrived)
|
||||||
|
|
@ -10822,3 +10824,9 @@ void Unit::UpdateSplineMovement(uint32 t_diff)
|
||||||
GetMap()->CreatureRelocation((Creature*)this,loc.x,loc.y,loc.z,loc.orientation);
|
GetMap()->CreatureRelocation((Creature*)this,loc.x,loc.y,loc.z,loc.orientation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Unit::DisableSpline()
|
||||||
|
{
|
||||||
|
m_movementInfo.RemoveMovementFlag(MovementFlags(MOVEFLAG_SPLINE_ENABLED|MOVEFLAG_FORWARD));
|
||||||
|
movespline->_Interrupt();
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -2010,6 +2010,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
||||||
private:
|
private:
|
||||||
void CleanupDeletedAuras();
|
void CleanupDeletedAuras();
|
||||||
void UpdateSplineMovement(uint32 t_diff);
|
void UpdateSplineMovement(uint32 t_diff);
|
||||||
|
void DisableSpline();
|
||||||
|
|
||||||
// player or player's pet
|
// player or player's pet
|
||||||
float GetCombatRatingReduction(CombatRating cr) const;
|
float GetCombatRatingReduction(CombatRating cr) const;
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,7 @@ namespace Movement
|
||||||
const MySpline& _Spline() const { return spline;}
|
const MySpline& _Spline() const { return spline;}
|
||||||
int32 _currentSplineIdx() const { return point_Idx;}
|
int32 _currentSplineIdx() const { return point_Idx;}
|
||||||
void _Finalize();
|
void _Finalize();
|
||||||
|
void _Interrupt() { splineflags.done = true;}
|
||||||
|
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "11726"
|
#define REVISION_NR "11727"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue