Fake Mindshield Implant cleans itself up on draw (#34718)

* Implant cleans itself up on draw

- add an event to relay to an implant that it's being drawn,
to tell it to clean itself up

- Give Fake mindshield a cleanup method, to remove the component added
fixing a problem where the icon persists after implant draw

* Remove extra whitespace

* CR Switch to using ContainerRemovedMessage
This commit is contained in:
Zachary Higgs 2025-01-30 15:14:53 -04:00 committed by deltanedas
parent 5f68e787f7
commit d033d1bb1b
1 changed files with 8 additions and 0 deletions

View File

@ -2,6 +2,7 @@
using Content.Shared.Implants;
using Content.Shared.Implants.Components;
using Content.Shared.Mindshield.Components;
using Robust.Shared.Containers;
namespace Content.Shared.Mindshield.FakeMindShield;
@ -13,7 +14,9 @@ public sealed class SharedFakeMindShieldImplantSystem : EntitySystem
base.Initialize();
SubscribeLocalEvent<SubdermalImplantComponent, FakeMindShieldToggleEvent>(OnFakeMindShieldToggle);
SubscribeLocalEvent<FakeMindShieldImplantComponent, ImplantImplantedEvent>(ImplantCheck);
SubscribeLocalEvent<FakeMindShieldImplantComponent, EntGotRemovedFromContainerMessage>(ImplantDraw);
}
/// <summary>
/// Raise the Action of a Implanted user toggling their implant to the FakeMindshieldComponent on their entity
/// </summary>
@ -33,4 +36,9 @@ public sealed class SharedFakeMindShieldImplantSystem : EntitySystem
if (ev.Implanted != null)
EnsureComp<FakeMindShieldComponent>(ev.Implanted.Value);
}
private void ImplantDraw(Entity<FakeMindShieldImplantComponent> ent, ref EntGotRemovedFromContainerMessage ev)
{
RemComp<FakeMindShieldComponent>(ev.Container.Owner);
}
}