Core/Vehicles: Fixed channeled spells being interrupted for passengers when vehicle moves

This commit is contained in:
Shauren
2014-06-09 21:08:19 +02:00
parent e5bd194bf8
commit f81635ebe5
2 changed files with 17 additions and 4 deletions

View File

@@ -17079,12 +17079,14 @@ bool Unit::UpdatePosition(float x, float y, float z, float orientation, bool tel
bool turn = (GetOrientation() != orientation);
bool relocated = (teleport || GetPositionX() != x || GetPositionY() != y || GetPositionZ() != z);
// TODO: Check if orientation transport offset changed instead of only global orientation
if (turn)
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TURNING);
if (relocated)
{
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MOVE);
if (!GetVehicle())
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MOVE);
// move and update visible state if need
if (GetTypeId() == TYPEID_PLAYER)

View File

@@ -30,6 +30,7 @@
#include "WaypointMovementGenerator.h"
#include "InstanceSaveMgr.h"
#include "ObjectMgr.h"
#include "Vehicle.h"
#define MOVEMENT_PACKET_TIME_DELAY 0
@@ -370,10 +371,20 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
mover->m_movementInfo = movementInfo;
// this is almost never true (not sure why it is sometimes, but it is), normally use mover->IsVehicle()
if (mover->GetVehicle())
// Some vehicles allow the passenger to turn by himself
if (Vehicle* vehicle = mover->GetVehicle())
{
mover->SetOrientation(movementInfo.pos.GetOrientation());
if (VehicleSeatEntry const* seat = vehicle->GetSeatForPassenger(mover))
{
if (seat->m_flags & VEHICLE_SEAT_FLAG_ALLOW_TURNING)
{
if (movementInfo.pos.GetOrientation() != mover->GetOrientation())
{
mover->SetOrientation(movementInfo.pos.GetOrientation());
mover->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TURNING);
}
}
}
return;
}