Core/Creatures: Never enable gravity for creatures that can only fly (#28411)

This commit is contained in:
Meji
2022-12-17 23:48:04 +01:00
committed by GitHub
parent ce7806adc8
commit 263ce0cd30

View File

@@ -2778,7 +2778,7 @@ void Creature::UpdateMovementFlags()
bool canHover = CanHover();
bool isInAir = (G3D::fuzzyGt(GetPositionZ(), ground + (canHover ? *m_unitData->HoverHeight : 0.0f) + GROUND_HEIGHT_TOLERANCE) || G3D::fuzzyLt(GetPositionZ(), ground - GROUND_HEIGHT_TOLERANCE)); // Can be underground too, prevent the falling
if (GetMovementTemplate().IsFlightAllowed() && isInAir && !IsFalling())
if (GetMovementTemplate().IsFlightAllowed() && (isInAir || !GetMovementTemplate().IsGroundAllowed()) && !IsFalling())
{
if (GetMovementTemplate().Flight == CreatureFlightMovementType::CanFly)
SetCanFly(true);