Core/Maps: Adjusted logic in GetFullTerrainStatusForPosition to closer match what the client does regarding being inside WMOs

Closes #21625
Closes #21624
Closes #21516

(cherry picked from commit b9c6bbb51df0ed10f74617482740fedb91ff5366)
This commit is contained in:
Shauren
2021-09-25 01:04:21 +02:00
parent 3d9d6fbcb8
commit 453b59de57
10 changed files with 196 additions and 169 deletions
+11 -6
View File
@@ -3130,9 +3130,12 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float
return;
}
float halfHeight = GetCollisionHeight() * 0.5f;
UpdateAllowedPositionZ(destx, desty, destz);
bool col = VMAP::VMapFactory::createOrGetVMapManager()->getObjectHitPos(PhasingHandler::GetTerrainMapId(GetPhaseShift(), GetMap(), pos.m_positionX, pos.m_positionY),
pos.m_positionX, pos.m_positionY, pos.m_positionZ, destx, desty, destz, destx, desty, destz, -0.5f);
pos.m_positionX, pos.m_positionY, pos.m_positionZ + halfHeight,
destx, desty, destz + halfHeight,
destx, desty, destz, -0.5f);
// collision occured
if (col)
@@ -3144,7 +3147,10 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float
}
// check dynamic collision
col = GetMap()->getObjectHitPos(GetPhaseShift(), pos.m_positionX, pos.m_positionY, pos.m_positionZ, destx, desty, destz, destx, desty, destz, -0.5f);
col = GetMap()->getObjectHitPos(GetPhaseShift(),
pos.m_positionX, pos.m_positionY, pos.m_positionZ + halfHeight,
destx, desty, destz + halfHeight,
destx, desty, destz, -0.5f);
// Collided with a gameobject
if (col)
@@ -3342,10 +3348,9 @@ float WorldObject::GetFloorZ() const
float WorldObject::GetMapWaterOrGroundLevel(float x, float y, float z, float* ground/* = nullptr*/) const
{
if (Unit const* unit = ToUnit())
return GetMap()->GetWaterOrGroundLevel(GetPhaseShift(), x, y, z, ground, !unit->HasAuraType(SPELL_AURA_WATER_WALK), GetCollisionHeight());
return z;
return GetMap()->GetWaterOrGroundLevel(GetPhaseShift(), x, y, z, ground,
isType(TYPEMASK_UNIT) ? !static_cast<Unit const*>(this)->HasAuraType(SPELL_AURA_WATER_WALK) : false,
GetCollisionHeight());
}
float WorldObject::GetMapHeight(float x, float y, float z, bool vmap/* = true*/, float distanceToSearch/* = DEFAULT_HEIGHT_SEARCH*/) const