Merge pull request #16969 from tkrokli/cant_do_this_while_moving

Core/Movement: enable item use and spell cast when dismounting
This commit is contained in:
mik1893
2016-06-07 20:45:25 +01:00
3 changed files with 11 additions and 33 deletions

View File

@@ -17231,7 +17231,6 @@ bool Unit::SetWalk(bool enable)
AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
else
RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
return true;
}
@@ -17246,15 +17245,7 @@ bool Unit::SetDisableGravity(bool disable, bool /*packetOnly = false*/)
RemoveUnitMovementFlag(MOVEMENTFLAG_FALLING);
}
else
{
RemoveUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY);
if (!HasUnitMovementFlag(MOVEMENTFLAG_CAN_FLY))
{
m_movementInfo.SetFallTime(0);
AddUnitMovementFlag(MOVEMENTFLAG_FALLING);
}
}
return true;
}
@@ -17267,7 +17258,6 @@ bool Unit::SetSwim(bool enable)
AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
else
RemoveUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
return true;
}
@@ -17282,15 +17272,7 @@ bool Unit::SetCanFly(bool enable, bool /*packetOnly = false */)
RemoveUnitMovementFlag(MOVEMENTFLAG_FALLING);
}
else
{
RemoveUnitMovementFlag(MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_MASK_MOVING_FLY);
if (!IsLevitating())
{
m_movementInfo.SetFallTime(0);
AddUnitMovementFlag(MOVEMENTFLAG_FALLING);
}
}
return true;
}
@@ -17303,7 +17285,6 @@ bool Unit::SetWaterWalking(bool enable, bool /*packetOnly = false */)
AddUnitMovementFlag(MOVEMENTFLAG_WATERWALKING);
else
RemoveUnitMovementFlag(MOVEMENTFLAG_WATERWALKING);
return true;
}
@@ -17316,7 +17297,6 @@ bool Unit::SetFeatherFall(bool enable, bool /*packetOnly = false */)
AddUnitMovementFlag(MOVEMENTFLAG_FALLING_SLOW);
else
RemoveUnitMovementFlag(MOVEMENTFLAG_FALLING_SLOW);
return true;
}
@@ -17344,7 +17324,6 @@ bool Unit::SetHover(bool enable, bool /*packetOnly = false*/)
UpdateHeight(newZ);
}
}
return true;
}

View File

@@ -479,11 +479,12 @@ void MotionMaster::MoveFall(uint32 id /*=0*/)
if (std::fabs(_owner->GetPositionZ() - tz) < 0.1f)
return;
_owner->AddUnitMovementFlag(MOVEMENTFLAG_FALLING);
_owner->m_movementInfo.SetFallTime(0);
// don't run spline movement for players
if (_owner->GetTypeId() == TYPEID_PLAYER)
{
_owner->AddUnitMovementFlag(MOVEMENTFLAG_FALLING);
_owner->m_movementInfo.SetFallTime(0);
}
return;
Movement::MoveSplineInit init(_owner);
init.MoveTo(_owner->GetPositionX(), _owner->GetPositionY(), tz, false);

View File

@@ -2535,10 +2535,9 @@ void AuraEffect::HandleAuraAllowFlight(AuraApplication const* aurApp, uint8 mode
return;
}
target->SetCanFly(apply);
if (!apply && target->GetTypeId() == TYPEID_UNIT && !target->IsLevitating())
target->GetMotionMaster()->MoveFall();
if (target->SetCanFly(apply))
if (!apply && !target->IsLevitating())
target->GetMotionMaster()->MoveFall();
}
void AuraEffect::HandleAuraWaterWalk(AuraApplication const* aurApp, uint8 mode, bool apply) const
@@ -2928,10 +2927,9 @@ void AuraEffect::HandleAuraModIncreaseFlightSpeed(AuraApplication const* aurApp,
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
if (mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK && (apply || (!target->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !target->HasAuraType(SPELL_AURA_FLY))))
{
target->SetCanFly(apply);
if (!apply && target->GetTypeId() == TYPEID_UNIT && !target->IsLevitating())
target->GetMotionMaster()->MoveFall();
if (target->SetCanFly(apply))
if (!apply && !target->IsLevitating())
target->GetMotionMaster()->MoveFall();
}
//! Someone should clean up these hacks and remove it from this function. It doesn't even belong here.