Files
tbd-station-14/Content.Server/Jobs/AddComponentSpecial.cs
deltanedas ed8bcb0a66 improve job special (#30753)
* cleanup of AddComponentSpecial

* add RemoveComponentSpecial

* require

---------

Co-authored-by: deltanedas <@deltanedas:kde.org>
2024-08-09 17:43:57 +10:00

23 lines
651 B
C#

using Content.Shared.Roles;
using Robust.Shared.Prototypes;
namespace Content.Server.Jobs;
public sealed partial class AddComponentSpecial : JobSpecial
{
[DataField(required: true)]
public ComponentRegistry Components { get; private set; } = new();
/// <summary>
/// If this is true then existing components will be removed and replaced with these ones.
/// </summary>
[DataField]
public bool RemoveExisting = true;
public override void AfterEquip(EntityUid mob)
{
var entMan = IoCManager.Resolve<IEntityManager>();
entMan.AddComponents(mob, Components, removeExisting: RemoveExisting);
}
}