Core/Units: flight and hover checks will now consider movement template data as well as manually set flight states
Port From (https://github.com/TrinityCore/TrinityCore/commit/294657f7dd4d2db1ca6dcf66f0b0895c6ba92949)
This commit is contained in:
@@ -2818,7 +2818,7 @@ namespace Game.Entities
|
||||
|
||||
bool CanNotReachTarget() { return m_cannotReachTarget; }
|
||||
|
||||
void SetCannotReachTarget(bool cannotReach)
|
||||
public void SetCannotReachTarget(bool cannotReach)
|
||||
{
|
||||
if (cannotReach == m_cannotReachTarget)
|
||||
return;
|
||||
@@ -3101,9 +3101,9 @@ namespace Game.Entities
|
||||
|
||||
public bool CanWalk() { return GetMovementTemplate().IsGroundAllowed(); }
|
||||
public override bool CanSwim() { return GetMovementTemplate().IsSwimAllowed() || IsPet();}
|
||||
public override bool CanFly() { return GetMovementTemplate().IsFlightAllowed(); }
|
||||
bool CanHover() { return GetMovementTemplate().Ground == CreatureGroundMovementType.Hover; }
|
||||
|
||||
public override bool CanFly() { return GetMovementTemplate().IsFlightAllowed() || IsFlying(); }
|
||||
bool CanHover() { return GetMovementTemplate().Ground == CreatureGroundMovementType.Hover || IsHovering(); }
|
||||
|
||||
public bool IsDungeonBoss() { return (GetCreatureTemplate().FlagsExtra.HasAnyFlag(CreatureFlagsExtra.DungeonBoss)); }
|
||||
public override bool IsAffectedByDiminishingReturns() { return base.IsAffectedByDiminishingReturns() || GetCreatureTemplate().FlagsExtra.HasAnyFlag(CreatureFlagsExtra.AllDiminish); }
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Game.Entities
|
||||
{
|
||||
public partial class Unit
|
||||
{
|
||||
public bool IsLevitating()
|
||||
public bool IsGravityDisabled()
|
||||
{
|
||||
return m_movementInfo.HasMovementFlag(MovementFlag.DisableGravity);
|
||||
}
|
||||
@@ -661,7 +661,7 @@ namespace Game.Entities
|
||||
|
||||
public bool SetDisableGravity(bool disable)
|
||||
{
|
||||
if (disable == IsLevitating())
|
||||
if (disable == IsGravityDisabled())
|
||||
return false;
|
||||
|
||||
if (disable)
|
||||
|
||||
@@ -169,7 +169,7 @@ namespace Game.Movement
|
||||
{
|
||||
Log.outDebug(LogFilter.Maps, "++ BuildPolyPath . (startPoly == 0 || endPoly == 0)\n");
|
||||
BuildShortcut();
|
||||
bool path = _source.IsTypeId(TypeId.Unit) && _source.ToCreature().IsFlying();
|
||||
bool path = _source.IsTypeId(TypeId.Unit) && _source.ToCreature().CanFly();
|
||||
|
||||
bool waterPath = _source.IsTypeId(TypeId.Unit) && _source.ToCreature().CanSwim();
|
||||
if (waterPath)
|
||||
@@ -224,7 +224,7 @@ namespace Game.Movement
|
||||
Unit _sourceUnit = _source.ToUnit();
|
||||
if (_sourceUnit != null)
|
||||
{
|
||||
if (_sourceUnit.IsFlying())
|
||||
if (_sourceUnit.CanFly())
|
||||
buildShotrcut = true;
|
||||
// Allow to build a shortcut if the unit is falling and it's trying to move downwards towards a target (i.e. charging)
|
||||
else if (_sourceUnit.IsFalling() && endPos.Z < startPos.Z)
|
||||
|
||||
@@ -2162,7 +2162,7 @@ namespace Game.Spells
|
||||
target.SetCanTransitionBetweenSwimAndFly(apply);
|
||||
|
||||
if (target.SetCanFly(apply))
|
||||
if (!apply && !target.IsLevitating())
|
||||
if (!apply && !target.IsGravityDisabled())
|
||||
target.GetMotionMaster().MoveFall();
|
||||
}
|
||||
|
||||
@@ -2618,7 +2618,7 @@ namespace Game.Spells
|
||||
target.SetCanTransitionBetweenSwimAndFly(apply);
|
||||
|
||||
if (target.SetCanFly(apply))
|
||||
if (!apply && !target.IsLevitating())
|
||||
if (!apply && !target.IsGravityDisabled())
|
||||
target.GetMotionMaster().MoveFall();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user