Core/Movement: made SetDisableGravity and SetHover virtual and handle anim tiers in their new override inside of the Creature class.

* no longer set anim tiers when the target is rooted
This commit is contained in:
Ovahlord committed 2020-07-13 14:07:59 +02:00
1 parent 86ef1745b5
commit f8091d6aac
6 files changed
+44 -29

No files matched your search

+5 -22
View File
@@ -11273,6 +11273,9 @@ bool Unit::IsPolymorphed() const
void Unit::SetAnimationTier(AnimationTier tier, bool immediate /* = true */)
{
if (!IsCreature())
return;
SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, static_cast<uint8>(tier));
if (immediate)
@@ -14432,7 +14435,7 @@ bool Unit::SetWalk(bool enable)
return true;
}
bool Unit::SetDisableGravity(bool disable, bool packetOnly /*= false*/, bool updateAnimationTier /*= true*/)
bool Unit::SetDisableGravity(bool disable, bool packetOnly /*= false*/, bool /*updateAnimationTier = true*/)
{
if (!packetOnly)
{
@@ -14458,16 +14461,6 @@ bool Unit::SetDisableGravity(bool disable, bool packetOnly /*= false*/, bool upd
else
Movement::PacketSender(this, SMSG_SPLINE_MOVE_GRAVITY_ENABLE, SMSG_MOVE_GRAVITY_ENABLE).Send();
if (updateAnimationTier && IsAlive() && IsCreature())
{
if (IsGravityDisabled())
SetAnimationTier(AnimationTier::Fly);
else if (IsHovering())
SetAnimationTier(AnimationTier::Hover);
else
SetAnimationTier(AnimationTier::Ground);
}
return true;
}
@@ -14585,7 +14578,7 @@ bool Unit::SetFeatherFall(bool enable, bool packetOnly /*= false */)
return true;
}
bool Unit::SetHover(bool enable, bool packetOnly /*= false*/, bool updateAnimationTier /*= true*/)
bool Unit::SetHover(bool enable, bool packetOnly /*= false*/, bool /*updateAnimationTier = true*/)
{
if (!packetOnly)
{
@@ -14619,16 +14612,6 @@ bool Unit::SetHover(bool enable, bool packetOnly /*= false*/, bool updateAnimati
else
Movement::PacketSender(this, SMSG_SPLINE_MOVE_UNSET_HOVER, SMSG_MOVE_UNSET_HOVER).Send();
if (updateAnimationTier && IsAlive() && IsCreature())
{
if (IsGravityDisabled())
SetAnimationTier(AnimationTier::Fly);
else if (IsHovering())
SetAnimationTier(AnimationTier::Hover);
else
SetAnimationTier(AnimationTier::Ground);
}
SendSetPlayHoverAnim(enable);
return true;