fix(Core/Movement): Corrected calculating ground level in shallow water. (#5114)
This commit is contained in:
@@ -1516,10 +1516,11 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z, float* grou
|
|||||||
|
|
||||||
if (max_z > INVALID_HEIGHT)
|
if (max_z > INVALID_HEIGHT)
|
||||||
{
|
{
|
||||||
if (canSwim && unit->GetMap()->IsInWater(x, y, max_z - Z_OFFSET_FIND_HEIGHT)) {
|
if (canSwim && unit->GetMap()->IsInWater(x, y, max_z - Z_OFFSET_FIND_HEIGHT))
|
||||||
|
{
|
||||||
// do not allow creatures to walk on
|
// do not allow creatures to walk on
|
||||||
// water level while swimming
|
// water level while swimming
|
||||||
max_z = max_z - GetMinHeightInWater();
|
max_z = std::max(max_z - GetMinHeightInWater(), ground_z);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1336,7 +1336,7 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici
|
|||||||
float ground = m_caster->GetMapHeight(x, y, z, true);
|
float ground = m_caster->GetMapHeight(x, y, z, true);
|
||||||
float liquidLevel = VMAP_INVALID_HEIGHT_VALUE;
|
float liquidLevel = VMAP_INVALID_HEIGHT_VALUE;
|
||||||
LiquidData liquidData;
|
LiquidData liquidData;
|
||||||
if (m_caster->GetMap()->getLiquidStatus(x, y, z, MAP_ALL_LIQUIDS, &liquidData))
|
if (m_caster->GetMap()->getLiquidStatus(x, y, z, MAP_ALL_LIQUIDS, &liquidData, m_caster->GetCollisionHeight()))
|
||||||
liquidLevel = liquidData.level;
|
liquidLevel = liquidData.level;
|
||||||
|
|
||||||
if (liquidLevel <= ground) // When there is no liquid Map::GetWaterOrGroundLevel returns ground level
|
if (liquidLevel <= ground) // When there is no liquid Map::GetWaterOrGroundLevel returns ground level
|
||||||
|
|||||||
Reference in New Issue
Block a user