From 5b9fb5cb861caae6b98d7b3e78330f7183fa812d Mon Sep 17 00:00:00 2001 From: Vera Aguilera Puerto Date: Thu, 25 Feb 2021 11:41:11 +0100 Subject: [PATCH] Fix EmptyContainer properly. --- .../Construction/Completions/EmptyContainer.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Content.Server/Construction/Completions/EmptyContainer.cs b/Content.Server/Construction/Completions/EmptyContainer.cs index f0fdb483b5..4cd5aa235a 100644 --- a/Content.Server/Construction/Completions/EmptyContainer.cs +++ b/Content.Server/Construction/Completions/EmptyContainer.cs @@ -1,4 +1,5 @@ #nullable enable +using System.Linq; using System.Threading.Tasks; using Content.Shared.Construction; using JetBrains.Annotations; @@ -26,8 +27,13 @@ namespace Content.Server.Construction.Completions if (!entity.TryGetComponent(out ContainerManagerComponent? containerManager) || !containerManager.TryGetContainer(Container, out var container)) return; - container.EmptyContainer(true, entity.Transform.Coordinates); - entity.Transform.AttachToGridOrMap(); + // TODO: Use container helpers. + foreach (var contained in container.ContainedEntities.ToArray()) + { + container.ForceRemove(contained); + contained.Transform.Coordinates = entity.Transform.Coordinates; + contained.Transform.AttachToGridOrMap(); + } } } }