Core/Units: Update PlayHoverAnim state when flying or hovering (#29434)

This commit is contained in:
Meji
2023-11-25 14:04:33 +01:00
committed by GitHub
parent 1c6ee8a6bd
commit c1b36eec56
4 changed files with 28 additions and 4 deletions

View File

@@ -12839,6 +12839,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;
}
@@ -13055,6 +13065,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;
}
@@ -13366,10 +13386,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;

View File

@@ -1237,7 +1237,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); }

View File

@@ -1128,7 +1128,6 @@ struct npc_baleful_beaming_eye : public ScriptedAI
void JustAppeared() override
{
me->SetDisplayId(DISPLAYID_BALEFUL_EYE, true);
me->SetPlayHoverAnim(true);
DoCastSelf(SPELL_BALEFUL_BEAMING_EYE_CREATE_AT);
// ToDo: rotation isn't changing orientation, turnspeed should be random
me->GetMotionMaster()->MoveRotate(0, 10000, RAND(ROTATE_DIRECTION_LEFT, ROTATE_DIRECTION_RIGHT));

View File

@@ -1372,7 +1372,6 @@ struct npc_anduin_wrynn_anduin_soul : public ScriptedAI
{
me->SetDisableGravity(true, true);
me->SetHoverHeight(1.0);
me->SetPlayHoverAnim(true);
DoCastSelf(SPELL_LOST_SOUL_PERIODIC);
}