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

This commit is contained in:
Seyden
2022-01-29 19:44:55 +01:00
committed by Shauren
parent 5a82a0381d
commit a5c713eaf2
7 changed files with 169 additions and 16 deletions

View File

@@ -670,6 +670,20 @@ bool PhasingHandler::IsPersonalPhase(uint32 phaseId)
return false;
}
void PhasingHandler::ReplaceObject(WorldObject* object, WorldObject* newObject, ObjectGuid const& replacedObjectGuid, bool stopAnimKits /*= true*/)
{
WorldObject* replacedObject = ObjectAccessor::GetWorldObject(*object, replacedObjectGuid);
if (!replacedObject)
return;
replacedObject->ReplaceWith(object, newObject, stopAnimKits);
if (Player* player = object->ToPlayer())
{
WorldObject* targets[] = { newObject, replacedObject };
player->UpdateVisibilityOf({ std::begin(targets), std::end(targets) });
}
}
void PhasingHandler::UpdateVisibilityIfNeeded(WorldObject* object, bool updateVisibility, bool changed)
{
if (changed && object->IsInWorld())