Skip to content

Commit dc8c29c

Browse files
committed
Revert "Core/Entities: move IsInAir tolerances to a default parameter, and reduce it to 0.1"
This reverts commit c3d3fb1.
1 parent c3d3fb1 commit dc8c29c

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2644,7 +2644,7 @@ void Creature::UpdateMovementFlags()
26442644
return;
26452645

26462646
// Set the movement flags if the creature is in that mode. (Only fly if actually in air, only swim if in water, etc)
2647-
bool isInAir = IsInAir(*this, GetFloorZ());
2647+
bool isInAir = IsInAir(*this, GetFloorZ() + GROUND_HEIGHT_TOLERANCE) || IsInAir(*this, GetFloorZ() - GROUND_HEIGHT_TOLERANCE);
26482648

26492649
if (GetMovementTemplate().IsFlightAllowed() && isInAir && !IsFalling())
26502650
{

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3164,19 +3164,19 @@ 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*/, float tolerance/* = 0.1f*/) const
3167+
bool Unit::IsInAir(Position const destination, float destinationFloor, bool honorHover/* = true*/) const
31683168
{
31693169
float z = destination.GetPositionZ();
3170-
if (z < destinationFloor - tolerance) // if really bellow ground, in air (caves,...)
3170+
if (z < destinationFloor - 0.5f) // if really bellow ground, in air (caves,...)
31713171
return true;
31723172
float hoverHeight = GetHoverOffset(); // height if currently hovering
31733173
if (GetTypeId() == TYPEID_UNIT) {
31743174
hoverHeight = ToCreature()->CanHover() ? GetFloatValue(UNIT_FIELD_HOVERHEIGHT) : 0.f; // height if could hover
31753175
}
31763176
z = destination.GetPositionZ() - (honorHover ? hoverHeight : 0.f);
3177-
if (z <= destinationFloor + tolerance) // if is bellow ground or slightly above it, not in air - should hover too
3177+
if (z <= destinationFloor + 0.5f) // if is bellow ground or slightly above it, not in air - should hover too
31783178
return false;
3179-
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")
3179+
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")
31803180
}
31813181

31823182
void Unit::ProcessPositionDataChanged(PositionFullTerrainStatus const& data)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1171,7 +1171,7 @@ 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, float tolerance = 0.1f) const;
1174+
bool IsInAir(Position const destination, float destinationFloor, bool honorHover = true) const;
11751175
bool isInAccessiblePlaceFor(Creature const* c) const;
11761176

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

0 commit comments

Comments
 (0)