XtGameKit/Packages/cn.xt.db/Scripts/Hotfix/Server/EntityDirtyExtensions.cs

28 lines
606 B
C#

namespace ET.Server
{
public static class EntityDirtyExtensions
{
public static void SetDirty(this Entity entity)
{
if (entity is not Player player)
{
return;
}
Scene root = player.Root();
if (root == null)
{
return;
}
DBSaveComponent saveComponent = root.GetComponent<DBSaveComponent>();
if (saveComponent == null)
{
return;
}
saveComponent.MarkDirty(player.Account);
}
}
}