CatStation/Content.Shared/Implants/ReplacementImplantSystem.cs
Pieter-Jan Briers 5168b5f3d4
IoC source gen compatibility (#43863)
* IoC source gen compatibility

Can be merged before or after https://github.com/space-wizards/RobustToolbox/pull/6549 doesn't really matter.

* Missed a spot
2026-05-09 03:29:58 +00:00

34 lines
1.1 KiB
C#

using Content.Shared.Implants.Components;
using Content.Shared.Whitelist;
using Robust.Shared.Containers;
namespace Content.Shared.Implants;
public sealed partial class ReplacementImplantSystem : EntitySystem
{
[Dependency] private SharedContainerSystem _container = default!;
[Dependency] private EntityWhitelistSystem _whitelist = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ReplacementImplantComponent, ImplantImplantedEvent>(OnImplantImplanted);
}
private void OnImplantImplanted(Entity<ReplacementImplantComponent> ent, ref ImplantImplantedEvent args)
{
if (!_container.TryGetContainer(args.Implanted, ImplanterComponent.ImplantSlotId, out var implantContainer))
return;
foreach (var implant in implantContainer.ContainedEntities)
{
if (implant == ent.Owner)
continue; // don't delete the replacement
if (_whitelist.IsWhitelistPass(ent.Comp.Whitelist, implant))
PredictedQueueDel(implant);
}
}
}