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()
|
public float GetGridActivationRange()
|
||||||
{
|
{
|
||||||
if (IsTypeId(TypeId.Player))
|
if (isActiveObject())
|
||||||
{
|
{
|
||||||
if (ToPlayer().GetCinematicMgr().IsOnCinematic())
|
if (GetTypeId() == TypeId.Player && ToPlayer().GetCinematicMgr().IsOnCinematic())
|
||||||
return SharedConst.DefaultVisibilityInstance;
|
return Math.Max(SharedConst.DefaultVisibilityInstance, GetMap().GetVisibilityRange());
|
||||||
|
|
||||||
return GetMap().GetVisibilityRange();
|
return GetMap().GetVisibilityRange();
|
||||||
}
|
}
|
||||||
else if (IsTypeId(TypeId.Unit))
|
Creature thisCreature = ToCreature();
|
||||||
return ToCreature().m_SightDistance;
|
if (thisCreature != null)
|
||||||
else if (IsTypeId(TypeId.DynamicObject))
|
return thisCreature.m_SightDistance;
|
||||||
{
|
|
||||||
if (isActiveObject())
|
return 0.0f;
|
||||||
return GetMap().GetVisibilityRange();
|
|
||||||
else
|
|
||||||
return 0.0f;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return 0.0f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetVisibilityRange()
|
public float GetVisibilityRange()
|
||||||
|
|||||||
@@ -647,15 +647,10 @@ namespace Game.Maps
|
|||||||
|
|
||||||
VisitNearbyCellsOf(player, grid_object_update, world_object_update);
|
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();
|
WorldObject viewPoint = player.GetViewpoint();
|
||||||
if (viewPoint)
|
if (viewPoint)
|
||||||
{
|
VisitNearbyCellsOf(viewPoint, grid_object_update, world_object_update);
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle updates for creatures in combat with player and are more than 60 yards away
|
// Handle updates for creatures in combat with player and are more than 60 yards away
|
||||||
if (player.IsInCombat())
|
if (player.IsInCombat())
|
||||||
|
|||||||
Reference in New Issue
Block a user