Split out the CloneComponents into its own method (#37155)

* Split out the CloneComponents into its own method

* CR - Move some extra info in

- add TryComp for status effects

- Move some remcomps around

- Make Special event raising components to handle special
components that reference entities that have ownership

* CR - Extra recommendation on the prototype

thanks slarti

* Solve the yaml linter problem

* CR - Typos, grammar and some extra Status effect

* cleanup

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
poklj
2025-05-06 14:22:32 -03:00
committed by GitHub
parent cbc49975c6
commit ac24be2fb7
2 changed files with 70 additions and 36 deletions

View File

@@ -1,7 +1,9 @@
using Content.Shared.Inventory;
using Content.Shared.Whitelist;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Array;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Generic;
namespace Content.Shared.Cloning;
@@ -62,11 +64,20 @@ public sealed partial class CloningSettingsPrototype : IPrototype, IInheritingPr
/// TODO: Make this not a string https://github.com/space-wizards/RobustToolbox/issues/5709
/// <summary>
/// Components to copy from the original to the clone.
/// This only makes a shallow copy of datafields!
/// If you need a deep copy or additional component initialization, then subscribe to CloningEvent instead!
/// Components to copy from the original to the clone using CopyComp.
/// This makes a deepcopy of all datafields, including information the clone might not own!
/// If you need to exclude data or do additional component initialization, then subscribe to CloningEvent instead!
/// Components in this list that the orginal does not have will be removed from the clone.
/// </summary>
[DataField]
[AlwaysPushInheritance]
public HashSet<string> Components = new();
/// <summary>
/// Components to remove from the clone and copy over manually using a CloneEvent raised on the original.
/// Use this when the component cannot be copied using CopyComp, for example when having an Uid as a datafield.
///</summary>
[DataField]
[AlwaysPushInheritance]
public HashSet<string> EventComponents = new();
}