2025-01-19 22:48:58 +03:00
|
|
|
using Content.Server.Body.Components;
|
|
|
|
|
using Content.Shared.Implants.Components;
|
2022-11-20 01:49:37 -05:00
|
|
|
using Robust.Shared.Containers;
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.Implants;
|
|
|
|
|
|
|
|
|
|
public sealed partial class ImplanterSystem
|
|
|
|
|
{
|
|
|
|
|
public void InitializeImplanted()
|
|
|
|
|
{
|
|
|
|
|
SubscribeLocalEvent<ImplantedComponent, ComponentInit>(OnImplantedInit);
|
|
|
|
|
SubscribeLocalEvent<ImplantedComponent, ComponentShutdown>(OnShutdown);
|
2025-01-19 22:48:58 +03:00
|
|
|
SubscribeLocalEvent<ImplantedComponent, BeingGibbedEvent>(OnGibbed);
|
2022-11-20 01:49:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnImplantedInit(EntityUid uid, ImplantedComponent component, ComponentInit args)
|
|
|
|
|
{
|
|
|
|
|
component.ImplantContainer = _container.EnsureContainer<Container>(uid, ImplanterComponent.ImplantSlotId);
|
|
|
|
|
component.ImplantContainer.OccludesLight = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnShutdown(EntityUid uid, ImplantedComponent component, ComponentShutdown args)
|
|
|
|
|
{
|
|
|
|
|
//If the entity is deleted, get rid of the implants
|
|
|
|
|
_container.CleanContainer(component.ImplantContainer);
|
|
|
|
|
}
|
2025-01-19 22:48:58 +03:00
|
|
|
|
|
|
|
|
private void OnGibbed(Entity<ImplantedComponent> ent, ref BeingGibbedEvent args)
|
|
|
|
|
{
|
|
|
|
|
//If the entity is gibbed, get rid of the implants
|
|
|
|
|
_container.CleanContainer(ent.Comp.ImplantContainer);
|
|
|
|
|
}
|
2022-11-20 01:49:37 -05:00
|
|
|
}
|