Core/Objects: Implement SmoothPhasing part of CreateObject and replacing visible objects

Port From (https://github.com/TrinityCore/TrinityCore/commit/a5c713eaf21ce086074cf5934d1ee105c2c86922)
This commit is contained in:
hondacrx
2022-03-09 14:09:03 -05:00
parent e65a1e95cf
commit f0d1a632ff
4 changed files with 154 additions and 14 deletions
+13
View File
@@ -663,6 +663,19 @@ namespace Game
return false;
}
public static void ReplaceObject(WorldObject obj, WorldObject newObject, ObjectGuid replacedObjectGuid, bool stopAnimKits = true)
{
WorldObject replacedObject = Global.ObjAccessor.GetWorldObject(obj, replacedObjectGuid);
if (replacedObject == null)
return;
replacedObject.ReplaceWith(obj, newObject, stopAnimKits);
Player player = obj.ToPlayer();
if (player != null)
player.UpdateVisibilityOf(new[] { newObject, replacedObject });
}
static void UpdateVisibilityIfNeeded(WorldObject obj, bool updateVisibility, bool changed)
{
if (changed && obj.IsInWorld)