diff options
| author | Shauren <shauren.trinity@gmail.com> | 2018-04-07 00:21:51 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2018-04-07 21:36:15 +0200 |
| commit | b9c6bbb51df0ed10f74617482740fedb91ff5366 (patch) | |
| tree | 9b54a41e2a8fe0075983548d2a31977e6cdd2a58 /src/server/game/Entities/Object | |
| parent | 2dadbda24ac1c2e6ff3dad650c7e25f4b3322342 (diff) | |
Core/Maps: Adjusted logic in GetFullTerrainStatusForPosition to closer match what the client does regarding being inside WMOs
Closes #21625
Closes #21624
Closes #21516
Diffstat (limited to 'src/server/game/Entities/Object')
| -rw-r--r-- | src/server/game/Entities/Object/Object.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 69164e260c7..f2e9aa022e8 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -3277,8 +3277,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(GetMapId(), pos.m_positionX, pos.m_positionY, pos.m_positionZ, destx, desty, destz, destx, desty, destz, -0.5f); + bool col = VMAP::VMapFactory::createOrGetVMapManager()->getObjectHitPos(GetMapId(), + pos.m_positionX, pos.m_positionY, pos.m_positionZ + halfHeight, + destx, desty, destz + halfHeight, + destx, desty, destz, -0.5f); // collision occured if (col) @@ -3290,7 +3294,10 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float } // check dynamic collision - col = GetMap()->getObjectHitPos(GetPhaseMask(), pos.m_positionX, pos.m_positionY, pos.m_positionZ, destx, desty, destz, destx, desty, destz, -0.5f); + col = GetMap()->getObjectHitPos(GetPhaseMask(), + 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) @@ -3507,10 +3514,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(GetPhaseMask(), x, y, z, ground, !unit->HasAuraType(SPELL_AURA_WATER_WALK), GetCollisionHeight()); - - return z; + return GetMap()->GetWaterOrGroundLevel(GetPhaseMask(), 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 |
