From c2dc1c337ff1ddeb2eccb21c59baa167a9918bf5 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Thu, 15 Aug 2019 12:07:22 -0400 Subject: [PATCH] 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) --- Source/Game/Entities/Object/WorldObject.cs | 22 ++++++++-------------- Source/Game/Maps/Map.cs | 9 ++------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/Source/Game/Entities/Object/WorldObject.cs b/Source/Game/Entities/Object/WorldObject.cs index 88c052b81..6fbefbdad 100644 --- a/Source/Game/Entities/Object/WorldObject.cs +++ b/Source/Game/Entities/Object/WorldObject.cs @@ -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() diff --git a/Source/Game/Maps/Map.cs b/Source/Game/Maps/Map.cs index f5da50fe8..b0c6da38b 100644 --- a/Source/Game/Maps/Map.cs +++ b/Source/Game/Maps/Map.cs @@ -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())