Core/Movement: Fixed player movement being blocked if teleported within the same map while not being in control of their character
This commit is contained in:
@@ -1283,7 +1283,7 @@ bool Player::TeleportTo(TeleportLocation const& teleportLocation, TeleportToOpti
|
||||
SetUnitMovementFlags(GetUnitMovementFlags() & MOVEMENTFLAG_MASK_HAS_PLAYER_STATUS_OPCODE);
|
||||
m_movementInfo.ResetJump();
|
||||
DisableSpline();
|
||||
GetMotionMaster()->Remove(EFFECT_MOTION_TYPE);
|
||||
GetMotionMaster()->InterruptOnTeleport();
|
||||
|
||||
if (TransportBase* transport = GetTransport())
|
||||
if (!teleportLocation.TransportGuid || teleportLocation.TransportGuid != transport->GetTransportGUID())
|
||||
@@ -1332,10 +1332,13 @@ bool Player::TeleportTo(TeleportLocation const& teleportLocation, TeleportToOpti
|
||||
|
||||
// code for finish transfer called in WorldSession::HandleMovementOpcodes()
|
||||
// at client packet CMSG_MOVE_TELEPORT_ACK
|
||||
SetTeleportState(TeleportState::WaitingForTeleportAck);
|
||||
SetTeleportState(GetPlayerMovingMe() ? TeleportState::WaitingForTeleportAck : TeleportState::NotTeleporting);
|
||||
// near teleport, triggering send CMSG_MOVE_TELEPORT_ACK from client at landing
|
||||
if (!GetSession()->PlayerLogout())
|
||||
SendTeleportPacket(m_teleport_dest);
|
||||
|
||||
if (!IsBeingTeleportedNear()) // update position immediately if we will not be waiting for client ACK
|
||||
UpdatePosition(m_teleport_dest.Location, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -13602,11 +13602,12 @@ bool Unit::CanSwim() const
|
||||
|
||||
void Unit::NearTeleportTo(TeleportLocation const& target, bool casting)
|
||||
{
|
||||
DisableSpline();
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
ToPlayer()->TeleportTo(target, TELE_TO_NOT_LEAVE_TRANSPORT | TELE_TO_NOT_LEAVE_COMBAT | (casting ? TELE_TO_SPELL : TELE_TO_NONE));
|
||||
if (Player* player = ToPlayer())
|
||||
player->TeleportTo(target, TELE_TO_NOT_LEAVE_TRANSPORT | TELE_TO_NOT_LEAVE_COMBAT | (casting ? TELE_TO_SPELL : TELE_TO_NONE));
|
||||
else
|
||||
{
|
||||
DisableSpline();
|
||||
GetMotionMaster()->InterruptOnTeleport();
|
||||
SendTeleportPacket(target);
|
||||
UpdatePosition(target.Location, true);
|
||||
UpdateObjectVisibility();
|
||||
|
||||
@@ -533,6 +533,13 @@ bool MotionMaster::StopOnDeath()
|
||||
return true;
|
||||
}
|
||||
|
||||
void MotionMaster::InterruptOnTeleport()
|
||||
{
|
||||
if (MovementGenerator* top = GetCurrentMovementGenerator())
|
||||
if (!top->HasFlag(MOVEMENTGENERATOR_FLAG_DEACTIVATED | MOVEMENTGENERATOR_FLAG_FINALIZED))
|
||||
top->Deactivate(_owner); // only deactivate top, don't remove it. non-resumable generators will clean up themselves on next update
|
||||
}
|
||||
|
||||
void MotionMaster::MoveIdle()
|
||||
{
|
||||
Add(GetIdleMovementGenerator(), MOTION_SLOT_DEFAULT);
|
||||
|
||||
@@ -152,6 +152,7 @@ public:
|
||||
void PropagateSpeedChange();
|
||||
bool GetDestination(float& x, float& y, float& z);
|
||||
bool StopOnDeath();
|
||||
void InterruptOnTeleport();
|
||||
|
||||
void MoveIdle();
|
||||
void MoveTargetedHome();
|
||||
|
||||
Reference in New Issue
Block a user