mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 09:17:36 +01:00
Core/Units: Update PlayHoverAnim state when flying or hovering (#29434)
(cherry picked from commit c1b36eec56)
This commit is contained in:
@@ -12809,6 +12809,16 @@ bool Unit::SetDisableGravity(bool disable, bool updateAnimTier /*= true*/)
|
||||
SetAnimTier(AnimTier::Ground);
|
||||
}
|
||||
|
||||
if (IsAlive())
|
||||
{
|
||||
if (IsGravityDisabled() || IsHovering())
|
||||
SetPlayHoverAnim(true);
|
||||
else
|
||||
SetPlayHoverAnim(false);
|
||||
}
|
||||
else if (IsPlayer()) // To update player who dies while flying/hovering
|
||||
SetPlayHoverAnim(false, false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -13025,6 +13035,16 @@ bool Unit::SetHover(bool enable, bool updateAnimTier /*= true*/)
|
||||
SetAnimTier(AnimTier::Ground);
|
||||
}
|
||||
|
||||
if (IsAlive())
|
||||
{
|
||||
if (IsGravityDisabled() || IsHovering())
|
||||
SetPlayHoverAnim(true);
|
||||
else
|
||||
SetPlayHoverAnim(false);
|
||||
}
|
||||
else if (IsPlayer()) // To update player who dies while flying/hovering
|
||||
SetPlayHoverAnim(false, false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -13336,10 +13356,16 @@ void Unit::UpdateMovementForcesModMagnitude()
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::SetPlayHoverAnim(bool enable)
|
||||
void Unit::SetPlayHoverAnim(bool enable, bool sendUpdate /*= true*/)
|
||||
{
|
||||
if (IsPlayingHoverAnim() == enable)
|
||||
return;
|
||||
|
||||
_playHoverAnim = enable;
|
||||
|
||||
if (!sendUpdate)
|
||||
return;
|
||||
|
||||
WorldPackets::Misc::SetPlayHoverAnim data;
|
||||
data.UnitGUID = GetGUID();
|
||||
data.PlayHoverAnim = enable;
|
||||
|
||||
@@ -1217,7 +1217,7 @@ class TC_GAME_API Unit : public WorldObject
|
||||
void MonsterMoveWithSpeed(float x, float y, float z, float speed, bool generatePath = false, bool forceDestination = false);
|
||||
|
||||
bool IsPlayingHoverAnim() const { return _playHoverAnim; }
|
||||
void SetPlayHoverAnim(bool enable);
|
||||
void SetPlayHoverAnim(bool enable, bool sendUpdate = true);
|
||||
void CalculateHoverHeight();
|
||||
void SetHoverHeight(float hoverHeight) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::HoverHeight), hoverHeight); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user