diff --git a/Content.Server/Construction/ConstructionSystem.Initial.cs b/Content.Server/Construction/ConstructionSystem.Initial.cs index 564e1cd24e..2284ade6bd 100644 --- a/Content.Server/Construction/ConstructionSystem.Initial.cs +++ b/Content.Server/Construction/ConstructionSystem.Initial.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Threading.Tasks; using Content.Server.Construction.Components; using Content.Server.Storage.Components; +using Content.Server.Storage.EntitySystems; using Content.Shared.ActionBlocker; using Content.Shared.Construction; using Content.Shared.Construction.Prototypes; @@ -14,6 +15,7 @@ using Content.Shared.Hands.Components; using Content.Shared.Hands.EntitySystems; using Content.Shared.Interaction; using Content.Shared.Inventory; +using Content.Shared.Storage; using Robust.Shared.Containers; using Robust.Shared.Players; using Robust.Shared.Timing; @@ -28,6 +30,7 @@ namespace Content.Server.Construction [Dependency] private readonly ActionBlockerSystem _actionBlocker = default!; [Dependency] private readonly SharedHandsSystem _handsSystem = default!; [Dependency] private readonly EntityLookupSystem _lookupSystem = default!; + [Dependency] private readonly StorageSystem _storageSystem = default!; // --- WARNING! LEGACY CODE AHEAD! --- // This entire file contains the legacy code for initial construction. @@ -203,6 +206,15 @@ namespace Content.Server.Construction if (used.Contains(entity)) continue; + // Dump out any stored entities in used entity + if (TryComp(entity, out var storage) && storage.StoredEntities != null) + { + foreach (var storedEntity in storage.StoredEntities.ToList()) + { + _storageSystem.RemoveAndDrop(entity, storedEntity, storage); + } + } + if (string.IsNullOrEmpty(arbitraryStep.Store)) { if (!container.Insert(entity))