AddImplantSpecial.cs 814 B

123456789101112131415161718192021222324
  1. using Content.Shared.Implants;
  2. using Content.Shared.Roles;
  3. using JetBrains.Annotations;
  4. using Robust.Shared.Prototypes;
  5. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set;
  6. namespace Content.Server.Jobs;
  7. /// <summary>
  8. /// Adds implants on spawn to the entity
  9. /// </summary>
  10. [UsedImplicitly]
  11. public sealed partial class AddImplantSpecial : JobSpecial
  12. {
  13. [DataField("implants", customTypeSerializer: typeof(PrototypeIdHashSetSerializer<EntityPrototype>))]
  14. public HashSet<String> Implants { get; private set; } = new();
  15. public override void AfterEquip(EntityUid mob)
  16. {
  17. var entMan = IoCManager.Resolve<IEntityManager>();
  18. var implantSystem = entMan.System<SharedSubdermalImplantSystem>();
  19. implantSystem.AddImplants(mob, Implants);
  20. }
  21. }