mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-01 22:56:39 +01:00
Core/Maps: Adjusted WorldObject::GetGridActivationRange() to never be less than map visibility distance for active objects to ensure equal ranges for activation/deactivation of grids
Updates #19072
This commit is contained in:
@@ -1692,23 +1692,18 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float &z) const
|
||||
|
||||
float WorldObject::GetGridActivationRange() const
|
||||
{
|
||||
if (ToPlayer())
|
||||
if (isActiveObject())
|
||||
{
|
||||
if (ToPlayer()->GetCinematicMgr()->IsOnCinematic())
|
||||
return DEFAULT_VISIBILITY_INSTANCE;
|
||||
if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->GetCinematicMgr->IsOnCinematic())
|
||||
return std::max(DEFAULT_VISIBILITY_INSTANCE, GetMap()->GetVisibilityRange());
|
||||
|
||||
return GetMap()->GetVisibilityRange();
|
||||
}
|
||||
else if (ToCreature())
|
||||
return ToCreature()->m_SightDistance;
|
||||
else if (ToDynObject())
|
||||
{
|
||||
if (isActiveObject())
|
||||
return GetMap()->GetVisibilityRange();
|
||||
else
|
||||
return 0.0f;
|
||||
}
|
||||
else
|
||||
return 0.0f;
|
||||
|
||||
if (Creature const* thisCreature = ToCreature())
|
||||
return thisCreature->m_SightDistance;
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
float WorldObject::GetVisibilityRange() const
|
||||
|
||||
@@ -716,14 +716,9 @@ void Map::Update(const uint32 t_diff)
|
||||
|
||||
VisitNearbyCellsOf(player, grid_object_update, world_object_update);
|
||||
|
||||
// If player is using far sight, visit that object too
|
||||
// If player is using far sight or mind vision, visit that object too
|
||||
if (WorldObject* viewPoint = player->GetViewpoint())
|
||||
{
|
||||
if (Creature* viewCreature = viewPoint->ToCreature())
|
||||
VisitNearbyCellsOf(viewCreature, grid_object_update, world_object_update);
|
||||
else if (DynamicObject* viewObject = viewPoint->ToDynObject())
|
||||
VisitNearbyCellsOf(viewObject, grid_object_update, world_object_update);
|
||||
}
|
||||
VisitNearbyCellsOf(viewPoint, grid_object_update, world_object_update);
|
||||
|
||||
// Handle updates for creatures in combat with player and are more than 60 yards away
|
||||
if (player->IsInCombat())
|
||||
|
||||
Reference in New Issue
Block a user