2021-09-16 15:17:19 +02:00
|
|
|
using Content.Shared.Roles;
|
2022-02-16 08:24:38 -06:00
|
|
|
using Robust.Shared.Prototypes;
|
2021-09-16 15:17:19 +02:00
|
|
|
|
2024-08-09 07:43:57 +00:00
|
|
|
namespace Content.Server.Jobs;
|
2021-09-16 15:17:19 +02:00
|
|
|
|
2024-08-09 07:43:57 +00:00
|
|
|
public sealed partial class AddComponentSpecial : JobSpecial
|
|
|
|
|
{
|
|
|
|
|
[DataField(required: true)]
|
|
|
|
|
public ComponentRegistry Components { get; private set; } = new();
|
2022-02-16 08:24:38 -06:00
|
|
|
|
2024-08-09 07:43:57 +00:00
|
|
|
/// <summary>
|
|
|
|
|
/// If this is true then existing components will be removed and replaced with these ones.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField]
|
|
|
|
|
public bool RemoveExisting = true;
|
2021-09-16 15:17:19 +02:00
|
|
|
|
2024-08-09 07:43:57 +00:00
|
|
|
public override void AfterEquip(EntityUid mob)
|
|
|
|
|
{
|
|
|
|
|
var entMan = IoCManager.Resolve<IEntityManager>();
|
|
|
|
|
entMan.AddComponents(mob, Components, removeExisting: RemoveExisting);
|
2021-09-16 15:17:19 +02:00
|
|
|
}
|
|
|
|
|
}
|