-using Content.Shared.Implants.Components;
+using Content.Server.Body.Components;
+using Content.Shared.Implants.Components;
using Robust.Shared.Containers;
namespace Content.Server.Implants;
{
SubscribeLocalEvent<ImplantedComponent, ComponentInit>(OnImplantedInit);
SubscribeLocalEvent<ImplantedComponent, ComponentShutdown>(OnShutdown);
+ SubscribeLocalEvent<ImplantedComponent, BeingGibbedEvent>(OnGibbed);
}
private void OnImplantedInit(EntityUid uid, ImplantedComponent component, ComponentInit args)
//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);
+ }
}
-using System.Linq;
using Content.Shared.Actions;
using Content.Shared.Implants.Components;
using Content.Shared.Interaction;
using JetBrains.Annotations;
using Robust.Shared.Containers;
using Robust.Shared.Network;
+using System.Linq;
namespace Content.Shared.Implants;
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
[Dependency] private readonly SharedContainerSystem _container = default!;
[Dependency] private readonly TagSystem _tag = default!;
+ [Dependency] private readonly SharedTransformSystem _transformSystem = default!;
public const string BaseStorageId = "storagebase";
if (!_container.TryGetContainer(uid, BaseStorageId, out var storageImplant))
return;
- var entCoords = Transform(component.ImplantedEntity.Value).Coordinates;
-
var containedEntites = storageImplant.ContainedEntities.ToArray();
foreach (var entity in containedEntites)
{
- if (Terminating(entity))
- continue;
-
- _container.RemoveEntity(storageImplant.Owner, entity, force: true, destination: entCoords);
+ _transformSystem.DropNextTo(entity, uid);
}
}