Make storage implant drop items on gibbing (#33493)

* Make storage implant drop items on gib/removal

* Better way

* Fix error

* Forgotten trash

* Cleanup

* Unused var

* Update Content.Server/Implants/ImplantedSystem.cs

Co-authored-by: 0x6273 <0x40@keemail.me>

---------

Co-authored-by: Winkarst <74284083+Winkarst-cpu@users.noreply.github.co>
Co-authored-by: 0x6273 <0x40@keemail.me>
This commit is contained in:
Winkarst
2025-01-19 22:48:58 +03:00
committed by GitHub
parent 2894f49c4c
commit b09cd1ca8c
2 changed files with 12 additions and 8 deletions

View File

@@ -1,4 +1,5 @@
using Content.Shared.Implants.Components;
using Content.Server.Body.Components;
using Content.Shared.Implants.Components;
using Robust.Shared.Containers;
namespace Content.Server.Implants;
@@ -9,6 +10,7 @@ public sealed partial class ImplanterSystem
{
SubscribeLocalEvent<ImplantedComponent, ComponentInit>(OnImplantedInit);
SubscribeLocalEvent<ImplantedComponent, ComponentShutdown>(OnShutdown);
SubscribeLocalEvent<ImplantedComponent, BeingGibbedEvent>(OnGibbed);
}
private void OnImplantedInit(EntityUid uid, ImplantedComponent component, ComponentInit args)
@@ -22,4 +24,10 @@ public sealed partial class ImplanterSystem
//If the entity is deleted, get rid of the implants
_container.CleanContainer(component.ImplantContainer);
}
private void OnGibbed(Entity<ImplantedComponent> ent, ref BeingGibbedEvent args)
{
//If the entity is gibbed, get rid of the implants
_container.CleanContainer(ent.Comp.ImplantContainer);
}
}