1
0

AddComponentSpecial.cs 690 B

12345678910111213141516171819202122
  1. using Content.Shared.Roles;
  2. using Robust.Shared.Prototypes;
  3. namespace Content.Server.Jobs;
  4. public sealed partial class AddComponentSpecial : JobSpecial
  5. {
  6. [DataField(required: true)]
  7. public ComponentRegistry Components { get; private set; } = new();
  8. /// <summary>
  9. /// If this is true then existing components will be removed and replaced with these ones.
  10. /// </summary>
  11. [DataField]
  12. public bool RemoveExisting = true;
  13. private readonly ISawmill _sawmill;
  14. public override void AfterEquip(EntityUid mob)
  15. {
  16. var entMan = IoCManager.Resolve<IEntityManager>();
  17. entMan.AddComponents(mob, Components, removeExisting: RemoveExisting);
  18. }
  19. }