Skip to content

Commit 7c006ed

Browse files
committed
Revert "Core/Entities: implement IsInAir"
This reverts commit 4c27329.
1 parent ea6bb10 commit 7c006ed

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

src/server/game/Entities/Creature/Creature.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2651,7 +2651,10 @@ void Creature::UpdateMovementFlags()
26512651
return;
26522652

26532653
// Set the movement flags if the creature is in that mode. (Only fly if actually in air, only swim if in water, etc)
2654-
bool isInAir = IsInAir(*this, GetFloorZ() + GROUND_HEIGHT_TOLERANCE) || IsInAir(*this, GetFloorZ() - GROUND_HEIGHT_TOLERANCE);
2654+
float ground = GetFloorZ();
2655+
2656+
bool canHover = CanHover();
2657+
bool isInAir = (G3D::fuzzyGt(GetPositionZ(), ground + (canHover ? GetFloatValue(UNIT_FIELD_HOVERHEIGHT) : 0.0f) + GROUND_HEIGHT_TOLERANCE) || G3D::fuzzyLt(GetPositionZ(), ground - GROUND_HEIGHT_TOLERANCE)); // Can be underground too, prevent the falling
26552658

26562659
if (GetMovementTemplate().IsFlightAllowed() && isInAir && !IsFalling())
26572660
{

src/server/game/Entities/Unit/Unit.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3164,11 +3164,6 @@ bool Unit::IsUnderWater() const
31643164
return GetLiquidStatus() & LIQUID_MAP_UNDER_WATER;
31653165
}
31663166

3167-
bool Unit::IsInAir(Position const destination, float destinationFloor, bool honorHover/* = true*/) const
3168-
{
3169-
return std::fabs(destination.GetPositionZ() - (honorHover ? GetHoverOffset() : 0.f) - destinationFloor) > 0.1f;
3170-
}
3171-
31723167
void Unit::ProcessPositionDataChanged(PositionFullTerrainStatus const& data)
31733168
{
31743169
ZLiquidStatus oldLiquidStatus = GetLiquidStatus();

src/server/game/Entities/Unit/Unit.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1171,7 +1171,6 @@ class TC_GAME_API Unit : public WorldObject
11711171

11721172
bool IsInWater() const;
11731173
bool IsUnderWater() const;
1174-
bool IsInAir(Position const destination, float destinationFloor, bool honorHover = true) const;
11751174
bool isInAccessiblePlaceFor(Creature const* c) const;
11761175

11771176
void SendHealSpellLog(HealInfo& healInfo, bool critical = false);

0 commit comments

Comments
 (0)