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
Port From (https://github.com/TrinityCore/TrinityCore/commit/48cc6f384d2b3ca8f1b1ddcfad70678730573449)
This commit is contained in:
@@ -1023,24 +1023,18 @@ namespace Game.Entities
|
||||
|
||||
public float GetGridActivationRange()
|
||||
{
|
||||
if (IsTypeId(TypeId.Player))
|
||||
if (isActiveObject())
|
||||
{
|
||||
if (ToPlayer().GetCinematicMgr().IsOnCinematic())
|
||||
return SharedConst.DefaultVisibilityInstance;
|
||||
if (GetTypeId() == TypeId.Player && ToPlayer().GetCinematicMgr().IsOnCinematic())
|
||||
return Math.Max(SharedConst.DefaultVisibilityInstance, GetMap().GetVisibilityRange());
|
||||
|
||||
return GetMap().GetVisibilityRange();
|
||||
}
|
||||
else if (IsTypeId(TypeId.Unit))
|
||||
return ToCreature().m_SightDistance;
|
||||
else if (IsTypeId(TypeId.DynamicObject))
|
||||
{
|
||||
if (isActiveObject())
|
||||
return GetMap().GetVisibilityRange();
|
||||
else
|
||||
return 0.0f;
|
||||
}
|
||||
else
|
||||
return 0.0f;
|
||||
Creature thisCreature = ToCreature();
|
||||
if (thisCreature != null)
|
||||
return thisCreature.m_SightDistance;
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
public float GetVisibilityRange()
|
||||
|
||||
@@ -647,15 +647,10 @@ namespace Game.Maps
|
||||
|
||||
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
|
||||
WorldObject viewPoint = player.GetViewpoint();
|
||||
if (viewPoint)
|
||||
{
|
||||
if (viewPoint.IsTypeId(TypeId.Unit))
|
||||
VisitNearbyCellsOf(viewPoint.ToCreature(), grid_object_update, world_object_update);
|
||||
else if (viewPoint.IsTypeId(TypeId.DynamicObject))
|
||||
VisitNearbyCellsOf(viewPoint.ToDynamicObject(), 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