mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-13 03:32:28 -04:00
Core/Units: flight and hover checks will now consider movement template data as well as manually set flight states
- manually set flight states via auras and scripts will no longer be ignored
- restored movement template consideration when generating pathings
- renamed IsLevitating to IsGravityDisabled to reflect the referenced movement flag's name
(cherry picked from commit 43ef610fe0)
This commit is contained in:
@@ -112,8 +112,8 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
|
||||
CreatureMovementData const& GetMovementTemplate() const;
|
||||
bool CanWalk() const { return GetMovementTemplate().IsGroundAllowed(); }
|
||||
bool CanSwim() const override { return GetMovementTemplate().IsSwimAllowed() || IsPet(); }
|
||||
bool CanFly() const override { return GetMovementTemplate().IsFlightAllowed(); }
|
||||
bool CanHover() const { return GetMovementTemplate().Ground == CreatureGroundMovementType::Hover; }
|
||||
bool CanFly() const override { return GetMovementTemplate().IsFlightAllowed() || IsFlying(); }
|
||||
bool CanHover() const { return GetMovementTemplate().Ground == CreatureGroundMovementType::Hover || IsHovering(); }
|
||||
|
||||
MovementGeneratorType GetDefaultMovementType() const override { return m_defaultMovementType; }
|
||||
void SetDefaultMovementType(MovementGeneratorType mgt) { m_defaultMovementType = mgt; }
|
||||
|
||||
@@ -12410,7 +12410,7 @@ bool Unit::SetWalk(bool enable)
|
||||
|
||||
bool Unit::SetDisableGravity(bool disable)
|
||||
{
|
||||
if (disable == IsLevitating())
|
||||
if (disable == IsGravityDisabled())
|
||||
return false;
|
||||
|
||||
if (disable)
|
||||
|
||||
@@ -1202,7 +1202,7 @@ class TC_GAME_API Unit : public WorldObject
|
||||
void SetPlayHoverAnim(bool enable);
|
||||
void SetHoverHeight(float hoverHeight) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::HoverHeight), hoverHeight); }
|
||||
|
||||
bool IsLevitating() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY); }
|
||||
bool IsGravityDisabled() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY); }
|
||||
bool IsWalking() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_WALKING); }
|
||||
bool IsHovering() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_HOVER); }
|
||||
bool SetWalk(bool enable);
|
||||
|
||||
@@ -179,7 +179,7 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con
|
||||
{
|
||||
TC_LOG_DEBUG("maps.mmaps", "++ BuildPolyPath :: (startPoly == 0 || endPoly == 0)");
|
||||
BuildShortcut();
|
||||
bool path = _source->GetTypeId() == TYPEID_UNIT && _source->ToCreature()->IsFlying();
|
||||
bool path = _source->GetTypeId() == TYPEID_UNIT && _source->ToCreature()->CanFly();
|
||||
|
||||
bool waterPath = _source->GetTypeId() == TYPEID_UNIT && _source->ToCreature()->CanSwim();
|
||||
if (waterPath)
|
||||
@@ -233,7 +233,7 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con
|
||||
TC_LOG_DEBUG("maps.mmaps", "++ BuildPolyPath :: flying case");
|
||||
if (Unit const* _sourceUnit = _source->ToUnit())
|
||||
{
|
||||
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)
|
||||
|
||||
@@ -2585,7 +2585,7 @@ void AuraEffect::HandleAuraAllowFlight(AuraApplication const* aurApp, uint8 mode
|
||||
|
||||
if (target->SetCanFly(apply))
|
||||
{
|
||||
if (!apply && !target->IsLevitating())
|
||||
if (!apply && !target->IsGravityDisabled())
|
||||
target->GetMotionMaster()->MoveFall();
|
||||
}
|
||||
}
|
||||
@@ -3012,7 +3012,7 @@ void AuraEffect::HandleAuraModIncreaseFlightSpeed(AuraApplication const* aurApp,
|
||||
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