content changes for "refactors copy api to use ref" (#10180)
This commit is contained in:
@@ -386,7 +386,7 @@ namespace Content.Server.Disease
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var freshDisease = _serializationManager.CreateCopy(addedDisease);
|
var freshDisease = _serializationManager.Copy(addedDisease);
|
||||||
|
|
||||||
if (freshDisease == null) return;
|
if (freshDisease == null) return;
|
||||||
|
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ namespace Content.Server.Jobs
|
|||||||
var component = (Component) factory.GetComponent(name);
|
var component = (Component) factory.GetComponent(name);
|
||||||
component.Owner = mob;
|
component.Owner = mob;
|
||||||
|
|
||||||
var copied = (Component?) serializationManager.Copy(data.Component, component, null);
|
var temp = (object) component;
|
||||||
if (copied != null)
|
serializationManager.Copy(data.Component, ref temp);
|
||||||
entityManager.AddComponent(mob, copied);
|
entityManager.AddComponent(mob, (Component)temp!);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Content.Shared.Payload.Components;
|
|||||||
using Content.Shared.Tag;
|
using Content.Shared.Tag;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.Serialization.Manager;
|
using Robust.Shared.Serialization.Manager;
|
||||||
|
using Robust.Shared.Serialization.Markdown.Validation;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Server.Payload.EntitySystems;
|
namespace Content.Server.Payload.EntitySystems;
|
||||||
@@ -98,8 +99,9 @@ public sealed class PayloadSystem : EntitySystem
|
|||||||
|
|
||||||
component.Owner = uid;
|
component.Owner = uid;
|
||||||
|
|
||||||
if (_serializationManager.Copy(data.Component, component, null) is Component copied)
|
var temp = (object) component;
|
||||||
EntityManager.AddComponent(uid, copied);
|
_serializationManager.Copy(data.Component, ref temp);
|
||||||
|
EntityManager.AddComponent(uid, (Component)temp!);
|
||||||
|
|
||||||
trigger.GrantedComponents.Add(registration.Type);
|
trigger.GrantedComponents.Add(registration.Type);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,8 @@ namespace Content.Shared.Decals
|
|||||||
public DecalGridComponent.DecalGridChunkCollection Copy(ISerializationManager serializationManager, DecalGridComponent.DecalGridChunkCollection source,
|
public DecalGridComponent.DecalGridChunkCollection Copy(ISerializationManager serializationManager, DecalGridComponent.DecalGridChunkCollection source,
|
||||||
DecalGridComponent.DecalGridChunkCollection target, bool skipHook, ISerializationContext? context = null)
|
DecalGridComponent.DecalGridChunkCollection target, bool skipHook, ISerializationContext? context = null)
|
||||||
{
|
{
|
||||||
var dict = serializationManager.Copy(source.ChunkCollection, target.ChunkCollection, context, skipHook)!;
|
var dict = target.ChunkCollection;
|
||||||
|
serializationManager.Copy(source.ChunkCollection, ref dict, context, skipHook);
|
||||||
return new DecalGridComponent.DecalGridChunkCollection(dict) {NextUid = source.NextUid};
|
return new DecalGridComponent.DecalGridChunkCollection(dict) {NextUid = source.NextUid};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user