Cloning Refactor and bugfixes (#35555)
* cloning refactor * cleanup and fixes * don't pick from 0 * give dwarves the correct species * fix dna and bloodstream reagent data cloning * don't copy helmets * be less redundant
This commit is contained in:
60
Content.Shared/Cloning/CloningSettingsPrototype.cs
Normal file
60
Content.Shared/Cloning/CloningSettingsPrototype.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Whitelist;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Array;
|
||||
|
||||
namespace Content.Shared.Cloning;
|
||||
|
||||
/// <summary>
|
||||
/// Settings for cloning a humanoid.
|
||||
/// Used to decide which components should be copied.
|
||||
/// </summary>
|
||||
[Prototype]
|
||||
public sealed partial class CloningSettingsPrototype : IPrototype, IInheritingPrototype
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
[IdDataField]
|
||||
public string ID { get; private set; } = default!;
|
||||
|
||||
[ParentDataField(typeof(PrototypeIdArraySerializer<CloningSettingsPrototype>))]
|
||||
public string[]? Parents { get; }
|
||||
|
||||
[AbstractDataField]
|
||||
[NeverPushInheritance]
|
||||
public bool Abstract { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines if cloning can be prevented by traits etc.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public bool ForceCloning = true;
|
||||
|
||||
/// <summary>
|
||||
/// Which inventory slots will receive a copy of the original's clothing.
|
||||
/// Disabled when null.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public SlotFlags? CopyEquipment = SlotFlags.WITHOUT_POCKET;
|
||||
|
||||
/// <summary>
|
||||
/// Whitelist for the equipment allowed to be copied.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public EntityWhitelist? Whitelist;
|
||||
|
||||
/// <summary>
|
||||
/// Blacklist for the equipment allowed to be copied.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public EntityWhitelist? Blacklist;
|
||||
|
||||
/// 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!
|
||||
/// </summary>
|
||||
[DataField]
|
||||
[AlwaysPushInheritance]
|
||||
public HashSet<string> Components = new();
|
||||
}
|
||||
Reference in New Issue
Block a user