From 1029047e2f4b2f09ea36c97abb9dfd7cdabc46aa Mon Sep 17 00:00:00 2001 From: Milon Date: Thu, 20 Mar 2025 12:30:59 +0100 Subject: [PATCH] fix (#5752) --- Robust.Client/GameObjects/ClientEntityManager.cs | 2 +- .../GameObjects/EntityManager.ComponentDeltas.cs | 2 +- Robust.Shared/GameObjects/EntitySystem.Proxy.cs | 12 +++++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Robust.Client/GameObjects/ClientEntityManager.cs b/Robust.Client/GameObjects/ClientEntityManager.cs index bef870d34..264e126c3 100644 --- a/Robust.Client/GameObjects/ClientEntityManager.cs +++ b/Robust.Client/GameObjects/ClientEntityManager.cs @@ -117,7 +117,7 @@ namespace Robust.Client.GameObjects base.DirtyField(uid, comp, fieldName, metadata); } - public override void DirtyFields(EntityUid uid, T comp, MetaDataComponent? meta, params ReadOnlySpan fields) + public override void DirtyFields(EntityUid uid, T comp, MetaDataComponent? meta, params string[] fields) { // TODO Prediction // does the client actually need to dirty the field? diff --git a/Robust.Shared/GameObjects/EntityManager.ComponentDeltas.cs b/Robust.Shared/GameObjects/EntityManager.ComponentDeltas.cs index 77210165d..b45c581e1 100644 --- a/Robust.Shared/GameObjects/EntityManager.ComponentDeltas.cs +++ b/Robust.Shared/GameObjects/EntityManager.ComponentDeltas.cs @@ -59,7 +59,7 @@ public abstract partial class EntityManager Dirty(uid, comp, metadata); } - public virtual void DirtyFields(EntityUid uid, T comp, MetaDataComponent? meta, params ReadOnlySpan fields) + public virtual void DirtyFields(EntityUid uid, T comp, MetaDataComponent? meta, params string[] fields) where T : IComponentDelta { var compReg = ComponentFactory.GetRegistration(CompIdx.Index()); diff --git a/Robust.Shared/GameObjects/EntitySystem.Proxy.cs b/Robust.Shared/GameObjects/EntitySystem.Proxy.cs index a41be6c3a..75b427fc8 100644 --- a/Robust.Shared/GameObjects/EntitySystem.Proxy.cs +++ b/Robust.Shared/GameObjects/EntitySystem.Proxy.cs @@ -172,12 +172,22 @@ public partial class EntitySystem } [MethodImpl(MethodImplOptions.AggressiveInlining)] - protected void DirtyFields(EntityUid uid, T comp, MetaDataComponent? meta, params ReadOnlySpan fields) + protected void DirtyFields(EntityUid uid, T comp, MetaDataComponent? meta, params string[] fields) where T : IComponentDelta { EntityManager.DirtyFields(uid, comp, meta, fields); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + protected void DirtyFields(Entity ent, MetaDataComponent? meta, params string[] fields) + where T : IComponentDelta + { + if (!Resolve(ent, ref ent.Comp)) + return; + + EntityManager.DirtyFields(ent, ent.Comp, meta, fields); + } + /// /// Marks a component as dirty. This also implicitly dirties the entity this component belongs to. ///