Avoid calling DirtyEntity() when repeatedly dirtying the same component. (#4797)

This commit is contained in:
Leon Friedrich
2024-01-03 00:06:10 -05:00
committed by GitHub
parent 9877323195
commit 6c6360e50a

View File

@@ -369,6 +369,9 @@ namespace Robust.Shared.GameObjects
if (component.LifeStage >= ComponentLifeStage.Removing || !component.NetSyncEnabled)
return;
if (component.LastModifiedTick == CurrentTick)
return;
DirtyEntity(uid, meta);
component.LastModifiedTick = CurrentTick;
}
@@ -382,6 +385,9 @@ namespace Robust.Shared.GameObjects
if (ent.Comp.LifeStage >= ComponentLifeStage.Removing || !ent.Comp.NetSyncEnabled)
return;
if (ent.Comp.LastModifiedTick == CurrentTick)
return;
DirtyEntity(ent, meta);
ent.Comp.LastModifiedTick = CurrentTick;
}