# Conflicts: # Content.Client/StatusIcon/StatusIconSystem.cs # Content.Server/Implants/ImplantedSystem.cs # Resources/Audio/Effects/attributions.yml # Resources/Locale/en-US/markings/ears.ftl # Resources/Prototypes/Catalog/Fills/Lockers/security.yml # Resources/Prototypes/Catalog/uplink_catalog.yml # Resources/Prototypes/Entities/Mobs/Player/observer.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/SMGs/smgs.yml # Resources/Prototypes/Entities/Structures/Machines/lathe.yml # Resources/Prototypes/LootTables/suspicion_loot_table.yml # Resources/Prototypes/Research/arsenal.yml # Resources/ServerInfo/Guidebook/NewPlayer/Controls/Controls.xml # Resources/Textures/Objects/Weapons/Guns/SMGs/vector.rsi/equipped-BACKPACK.png # Resources/Textures/Objects/Weapons/Guns/SMGs/vector.rsi/meta.json # Resources/Textures/Objects/Weapons/Guns/Shotguns/pump.rsi/equipped-BACKPACK.png # Resources/manifest.yml # Resources/migration.yml # RobustToolbox
46 lines
1.6 KiB
C#
46 lines
1.6 KiB
C#
using Content.Server.Body.Components;
|
|
using Content.Shared.Implants.Components;
|
|
using Content.Shared.Storage;
|
|
using Robust.Shared.Containers;
|
|
|
|
namespace Content.Server.Implants;
|
|
|
|
public sealed partial class ImplanterSystem
|
|
{
|
|
public void InitializeImplanted()
|
|
{
|
|
SubscribeLocalEvent<ImplantedComponent, ComponentInit>(OnImplantedInit);
|
|
SubscribeLocalEvent<ImplantedComponent, ComponentShutdown>(OnShutdown);
|
|
SubscribeLocalEvent<ImplantedComponent, BeingGibbedEvent>(OnGibbed);
|
|
}
|
|
|
|
private void OnImplantedInit(Entity<ImplantedComponent> ent, ref ComponentInit args)
|
|
{
|
|
ent.Comp.ImplantContainer = _container.EnsureContainer<Container>(ent.Owner, ImplanterComponent.ImplantSlotId);
|
|
ent.Comp.ImplantContainer.OccludesLight = false;
|
|
}
|
|
|
|
private void OnShutdown(Entity<ImplantedComponent> ent, ref ComponentShutdown args)
|
|
{
|
|
//If the entity is deleted, get rid of the implants
|
|
_container.CleanContainer(ent.Comp.ImplantContainer);
|
|
}
|
|
|
|
private void OnGibbed(Entity<ImplantedComponent> ent, ref BeingGibbedEvent args)
|
|
{
|
|
|
|
// Drop the storage implant contents before the implants are deleted by the body being gibbed
|
|
foreach (var implant in ent.Comp.ImplantContainer.ContainedEntities)
|
|
{
|
|
if (!TryComp<SubdermalImplantComponent>(implant, out var subdermalImplant))
|
|
continue;
|
|
|
|
if (!subdermalImplant.DropContainerItemsIfGib)
|
|
continue;
|
|
|
|
if (TryComp<StorageComponent>(implant, out var storage))
|
|
_container.EmptyContainer(storage.Container, destination: Transform(ent).Coordinates);
|
|
}
|
|
|
|
}
|
|
}
|