mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Units: Update PlayHoverAnim state when flying or hovering (#29434)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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); }
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user