mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 17:27:36 +01:00
Core/Units: prevent units from dropping under map surfaces when disabling hover movement
This commit is contained in:
@@ -14155,7 +14155,7 @@ bool Unit::SetHover(bool enable, bool packetOnly /*= false*/, bool /*updateAnima
|
||||
{
|
||||
//! No need to check height on ascent
|
||||
AddUnitMovementFlag(MOVEMENTFLAG_HOVER);
|
||||
if (hoverHeight)
|
||||
if (hoverHeight && GetPositionZ() - GetFloorZ() < hoverHeight)
|
||||
UpdateHeight(GetPositionZ() + hoverHeight);
|
||||
}
|
||||
else
|
||||
@@ -14164,7 +14164,7 @@ bool Unit::SetHover(bool enable, bool packetOnly /*= false*/, bool /*updateAnima
|
||||
//! Dying creatures will MoveFall from setDeathState
|
||||
if (hoverHeight && (!isDying() || GetTypeId() != TYPEID_UNIT))
|
||||
{
|
||||
float newZ = GetPositionZ() - hoverHeight;
|
||||
float newZ = std::max<float>(GetFloorZ(), GetPositionZ() - hoverHeight);
|
||||
UpdateAllowedPositionZ(GetPositionX(), GetPositionY(), newZ);
|
||||
UpdateHeight(newZ);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user