Fix Implant exception (#12785)

This commit is contained in:
Leon Friedrich
2022-11-28 15:33:59 +13:00
committed by GitHub
parent 01304eb4d4
commit b9db87ac2b

View File

@@ -56,18 +56,19 @@ public abstract class SharedSubdermalImplantSystem : EntitySystem
private void OnRemove(EntityUid uid, SubdermalImplantComponent component, EntGotRemovedFromContainerMessage args)
{
if (component.ImplantedEntity == null)
if (component.ImplantedEntity == null || Terminating(component.ImplantedEntity.Value))
return;
var entCoords = Transform(component.ImplantedEntity.Value).Coordinates;
if (component.ImplantAction != null)
_actionsSystem.RemoveProvidedActions(component.ImplantedEntity.Value, uid);
if (!_container.TryGetContainer(uid, BaseStorageId, out var storageImplant))
return;
_container.EmptyContainer(storageImplant, moveTo: entCoords);
var entCoords = Transform(component.ImplantedEntity.Value).Coordinates;
// TODO add variant of empty container that dumpes entities into parent containers OR grid OR Map
_container.EmptyContainer(storageImplant, true, entCoords, true, EntityManager);
}
/// <summary>