Core/Movement: Corrected Animation Tier handling
Port From (https://github.com/TrinityCore/TrinityCore/commit/ee620856ad2918ae7ce91a37a980d9f2129a074a)
This commit is contained in:
@@ -1807,6 +1807,7 @@ namespace Game.Entities
|
||||
uint scalingMode = WorldConfig.GetUIntValue(WorldCfg.RespawnDynamicMode);
|
||||
if (scalingMode != 0)
|
||||
GetMap().ApplyDynamicModeRespawnScaling(this, m_spawnId, ref respawnDelay, scalingMode);
|
||||
|
||||
// @todo remove the boss respawn time hack in a dynspawn follow-up once we have creature groups in instances
|
||||
if (m_respawnCompatibilityMode)
|
||||
{
|
||||
@@ -1841,8 +1842,9 @@ namespace Game.Entities
|
||||
if (m_formation != null && m_formation.GetLeader() == this)
|
||||
m_formation.FormationReset(true);
|
||||
|
||||
bool needsFalling = IsFlying() || IsHovering();
|
||||
SetHover(false);
|
||||
bool needsFalling = (IsFlying() || IsHovering()) && !IsUnderWater();
|
||||
SetHover(false, false);
|
||||
SetDisableGravity(false, false);
|
||||
|
||||
if (needsFalling)
|
||||
GetMotionMaster().MoveFall();
|
||||
@@ -2374,7 +2376,7 @@ namespace Game.Entities
|
||||
|
||||
SetStandState((UnitStandStateType)(cainfo.bytes1 & 0xFF));
|
||||
SetVisFlags((UnitVisFlags)((cainfo.bytes1 >> 16) & 0xFF));
|
||||
SetAnimTier((UnitBytes1Flags)((cainfo.bytes1 >> 24) & 0xFF), false);
|
||||
SetAnimTier((AnimTier)((cainfo.bytes1 >> 24) & 0xFF), false);
|
||||
|
||||
//! Suspected correlation between UNIT_FIELD_BYTES_1, offset 3, value 0x2:
|
||||
//! If no inhabittype_fly (if no MovementFlag_DisableGravity or MovementFlag_CanFly flag found in sniffs)
|
||||
|
||||
@@ -4149,9 +4149,6 @@ namespace Game.Entities
|
||||
|
||||
StopMirrorTimers(); //disable timers(bars)
|
||||
|
||||
// set and clear other
|
||||
SetAnimTier(UnitBytes1Flags.AlwaysStand, false);
|
||||
|
||||
// OnPlayerRepop hook
|
||||
Global.ScriptMgr.OnPlayerRepop(this);
|
||||
}
|
||||
@@ -4358,7 +4355,6 @@ namespace Game.Entities
|
||||
// speed change, land walk
|
||||
|
||||
// remove death flag + set aura
|
||||
SetAnimTier(UnitBytes1Flags.None, false);
|
||||
RemovePlayerFlag(PlayerFlags.IsOutOfBounds);
|
||||
|
||||
// This must be called always even on Players with race != RACE_NIGHTELF in case of faction change
|
||||
|
||||
@@ -659,7 +659,7 @@ namespace Game.Entities
|
||||
return IsInDist(obj, objBoundaryRadius);
|
||||
}
|
||||
|
||||
public bool SetDisableGravity(bool disable)
|
||||
public bool SetDisableGravity(bool disable, bool updateAnimationTier = true)
|
||||
{
|
||||
if (disable == IsGravityDisabled())
|
||||
return false;
|
||||
@@ -692,6 +692,16 @@ namespace Game.Entities
|
||||
SendMessageToSet(packet, true);
|
||||
}
|
||||
|
||||
if (IsCreature() && updateAnimationTier && IsAlive() && !HasUnitState(UnitState.Root) && !ToCreature().GetMovementTemplate().IsRooted())
|
||||
{
|
||||
if (IsGravityDisabled())
|
||||
SetAnimTier(AnimTier.Fly);
|
||||
else if (IsHovering())
|
||||
SetAnimTier(AnimTier.Hover);
|
||||
else
|
||||
SetAnimTier(AnimTier.Ground);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1011,7 +1021,7 @@ namespace Game.Entities
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool SetHover(bool enable)
|
||||
public bool SetHover(bool enable, bool updateAnimationTier = true)
|
||||
{
|
||||
if (enable == HasUnitMovementFlag(MovementFlag.Hover))
|
||||
return false;
|
||||
@@ -1056,6 +1066,17 @@ namespace Game.Entities
|
||||
packet.MoverGUID = GetGUID();
|
||||
SendMessageToSet(packet, true);
|
||||
}
|
||||
|
||||
if (IsCreature() && updateAnimationTier && IsAlive() && !HasUnitState(UnitState.Root) && !ToCreature().GetMovementTemplate().IsRooted())
|
||||
{
|
||||
if (IsGravityDisabled())
|
||||
SetAnimTier(AnimTier.Fly);
|
||||
else if (IsHovering())
|
||||
SetAnimTier(AnimTier.Hover);
|
||||
else
|
||||
SetAnimTier(AnimTier.Ground);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1723,10 +1744,17 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
if (arrived)
|
||||
{
|
||||
DisableSpline();
|
||||
|
||||
AnimTier? animTier = MoveSpline.GetAnimation();
|
||||
if (animTier.HasValue)
|
||||
SetAnimTier(animTier.Value);
|
||||
}
|
||||
|
||||
UpdateSplinePosition();
|
||||
}
|
||||
|
||||
void UpdateSplinePosition()
|
||||
{
|
||||
Vector4 loc = MoveSpline.ComputePosition();
|
||||
|
||||
@@ -2154,7 +2154,9 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
public void SetAnimTier(UnitBytes1Flags animTier, bool notifyClient)
|
||||
public AnimTier GetAnimTier() { return (AnimTier)(byte)m_unitData.AnimTier; }
|
||||
|
||||
public void SetAnimTier(AnimTier animTier, bool notifyClient = true)
|
||||
{
|
||||
SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.AnimTier), (byte)animTier);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user