aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2025-10-26 09:55:15 +0100
committerShauren <shauren.trinity@gmail.com>2025-10-26 09:55:15 +0100
commit288be73af1c742570abeccd3f90919e17ef4589b (patch)
tree89b7763964884e18ebd7efe21452b08cdf285948 /src
parentdc8c29cefed6bafbd7a7a008a20829fc3d70aff7 (diff)
Revert "Core/Entities: handle more edge cases in IsInAir"
This reverts commit 00ddc355686e7d300f0cd2fcfd1a9b0c97aeb07f.
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp12
1 files changed, 1 insertions, 11 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 4d118525e77..c6ff7b651de 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -3166,17 +3166,7 @@ bool Unit::IsUnderWater() const
bool Unit::IsInAir(Position const destination, float destinationFloor, bool honorHover/* = true*/) const
{
- float z = destination.GetPositionZ();
- 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 + 0.5f) // if is bellow ground or slightly above it, not in air - should hover too
- return false;
- 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")
+ return std::fabs(destination.GetPositionZ() - (honorHover ? GetHoverOffset() : 0.f) - destinationFloor) > 0.1f;
}
void Unit::ProcessPositionDataChanged(PositionFullTerrainStatus const& data)