diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/game/Entities/Creature/Creature.cpp | 2 | ||||
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 8 | ||||
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.h | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index a7d69ecaa74..0824a95f3c2 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -2644,7 +2644,7 @@ void Creature::UpdateMovementFlags() return; // Set the movement flags if the creature is in that mode. (Only fly if actually in air, only swim if in water, etc) - bool isInAir = IsInAir(*this, GetFloorZ()); + bool isInAir = IsInAir(*this, GetFloorZ() + GROUND_HEIGHT_TOLERANCE) || IsInAir(*this, GetFloorZ() - GROUND_HEIGHT_TOLERANCE); if (GetMovementTemplate().IsFlightAllowed() && isInAir && !IsFalling()) { diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index ab168c7dddc..4d118525e77 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -3164,19 +3164,19 @@ bool Unit::IsUnderWater() const return GetLiquidStatus() & LIQUID_MAP_UNDER_WATER; } -bool Unit::IsInAir(Position const destination, float destinationFloor, bool honorHover/* = true*/, float tolerance/* = 0.1f*/) const +bool Unit::IsInAir(Position const destination, float destinationFloor, bool honorHover/* = true*/) const { float z = destination.GetPositionZ(); - if (z < destinationFloor - tolerance) // if really bellow ground, in air (caves,...) + if (z < destinationFloor - 0.5f) // if really bellow ground, in air (caves,...) return true; float hoverHeight = GetHoverOffset(); // height if currently hovering if (GetTypeId() == TYPEID_UNIT) { hoverHeight = ToCreature()->CanHover() ? GetFloatValue(UNIT_FIELD_HOVERHEIGHT) : 0.f; // height if could hover } z = destination.GetPositionZ() - (honorHover ? hoverHeight : 0.f); - if (z <= destinationFloor + tolerance) // if is bellow ground or slightly above it, not in air - should hover too + if (z <= destinationFloor + 0.5f) // if is bellow ground or slightly above it, not in air - should hover too return false; - return std::fabs(z - destinationFloor) > tolerance; // if the difference is higher than tolerance level, in air (todo: this should most likely take into account unit's "size") + return std::fabs(z - destinationFloor) > 0.5f; // if the difference is higher than tolerance level, in air (todo: this should most likely take into account unit's "size") } void Unit::ProcessPositionDataChanged(PositionFullTerrainStatus const& data) diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 3dceeeb1f76..e028ace4720 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1171,7 +1171,7 @@ class TC_GAME_API Unit : public WorldObject bool IsInWater() const; bool IsUnderWater() const; - bool IsInAir(Position const destination, float destinationFloor, bool honorHover = true, float tolerance = 0.1f) const; + bool IsInAir(Position const destination, float destinationFloor, bool honorHover = true) const; bool isInAccessiblePlaceFor(Creature const* c) const; void SendHealSpellLog(HealInfo& healInfo, bool critical = false); |
