]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Content ecs containers (#22484)
authorTemporalOroboros <TemporalOroboros@gmail.com>
Thu, 28 Dec 2023 05:30:03 +0000 (21:30 -0800)
committerGitHub <noreply@github.com>
Thu, 28 Dec 2023 05:30:03 +0000 (01:30 -0400)
72 files changed:
Content.Client/Weapons/Ranged/Systems/GunSystem.Ballistic.cs
Content.IntegrationTests/Tests/Interaction/Click/InteractionSystemTests.cs
Content.Server/Ame/EntitySystems/AmeControllerSystem.cs
Content.Server/Antag/AntagSelectionSystem.cs
Content.Server/CartridgeLoader/CartridgeLoaderSystem.cs
Content.Server/Cloning/CloningSystem.cs
Content.Server/Construction/Completions/BuildMech.cs
Content.Server/Construction/Completions/DeleteEntitiesInContainer.cs
Content.Server/Construction/Completions/MoveContainer.cs
Content.Server/Construction/Completions/SpawnPrototypeAtContainer.cs
Content.Server/Construction/ConstructionSystem.Computer.cs
Content.Server/Construction/ConstructionSystem.Graph.cs
Content.Server/Construction/ConstructionSystem.Initial.cs
Content.Server/Construction/ConstructionSystem.Interactions.cs
Content.Server/Construction/ConstructionSystem.Machine.cs
Content.Server/Construction/MachineFrameSystem.cs
Content.Server/Construction/PartExchangerSystem.cs
Content.Server/Containers/EmptyOnMachineDeconstructSystem.cs
Content.Server/Devour/DevourSystem.cs
Content.Server/Disposal/Unit/EntitySystems/DisposableSystem.cs
Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs
Content.Server/Ensnaring/EnsnareableSystem.Ensnaring.cs
Content.Server/Ensnaring/EnsnareableSystem.cs
Content.Server/Explosion/EntitySystems/ClusterGrenadeSystem.cs
Content.Server/Guardian/GuardianSystem.cs
Content.Server/IdentityManagement/IdentitySystem.cs
Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs
Content.Server/Kitchen/EntitySystems/ReagentGrinderSystem.cs
Content.Server/Light/EntitySystems/LightReplacerSystem.cs
Content.Server/Light/EntitySystems/PoweredLightSystem.cs
Content.Server/Materials/MaterialReclaimerSystem.cs
Content.Server/Mech/Equipment/EntitySystems/MechGrabberSystem.cs
Content.Server/Mech/Systems/MechAssemblySystem.cs
Content.Server/Mech/Systems/MechSystem.cs
Content.Server/Medical/MedicalScannerSystem.cs
Content.Server/Morgue/CrematoriumSystem.cs
Content.Server/Polymorph/Systems/PolymorphSystem.cs
Content.Server/Silicons/Borgs/BorgSystem.Modules.cs
Content.Server/Silicons/Borgs/BorgSystem.Ui.cs
Content.Server/Silicons/Borgs/BorgSystem.cs
Content.Server/Singularity/EntitySystems/EventHorizonSystem.cs
Content.Server/Sticky/Systems/StickySystem.cs
Content.Server/Storage/EntitySystems/BluespaceLockerSystem.cs
Content.Server/Storage/EntitySystems/CursedEntityStorageSystem.cs
Content.Server/Weapons/Ranged/Systems/GunSystem.Ballistic.cs
Content.Shared/Actions/ActionContainerSystem.cs
Content.Shared/Body/Systems/SharedBodySystem.Body.cs
Content.Shared/Body/Systems/SharedBodySystem.Organs.cs
Content.Shared/Body/Systems/SharedBodySystem.Parts.cs
Content.Shared/CartridgeLoader/SharedCartridgeLoaderSystem.cs
Content.Shared/Clothing/EntitySystems/ToggleableClothingSystem.cs
Content.Shared/Construction/PartAssemblySystem.cs
Content.Shared/Containers/ContainerFillSystem.cs
Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs
Content.Shared/Cuffs/SharedCuffableSystem.cs
Content.Shared/Devour/SharedDevourSystem.cs
Content.Shared/Hands/EntitySystems/SharedHandsSystem.Drop.cs
Content.Shared/Hands/EntitySystems/SharedHandsSystem.Pickup.cs
Content.Shared/Hands/EntitySystems/SharedHandsSystem.cs
Content.Shared/Implants/SharedImplanterSystem.cs
Content.Shared/Implants/SharedSubdermalImplantSystem.cs
Content.Shared/Inventory/InventorySystem.Equip.cs
Content.Shared/Materials/SharedMaterialReclaimerSystem.cs
Content.Shared/Mech/EntitySystems/SharedMechSystem.cs
Content.Shared/Medical/Cryogenics/SharedCryoPodSystem.cs
Content.Shared/Radio/EntitySystems/EncryptionKeySystem.cs
Content.Shared/Storage/EntitySystems/BinSystem.cs
Content.Shared/Storage/EntitySystems/SharedEntityStorageSystem.cs
Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Ballistic.cs
Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.ChamberMagazine.cs
Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Container.cs
Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Revolver.cs

index b0e3566bdc8125de3019116166a0d01939e16378..d09661b770b8cac8ac9b9a8eba3bee008fbf8544 100644 (file)
@@ -33,7 +33,7 @@ public sealed partial class GunSystem
             var existing = component.Entities[^1];
             component.Entities.RemoveAt(component.Entities.Count - 1);
 
-            component.Container.Remove(existing);
+            Containers.Remove(existing, component.Container);
             EnsureShootable(existing);
         }
         else if (component.UnspawnedCount > 0)
index cef74aa386f52658f96164270c6a0eb07e2c76ec..317aa10400b9598dd39243c6db0aabf0ebf4fa5a 100644 (file)
@@ -373,7 +373,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
             await server.WaitAssertion(() =>
             {
 #pragma warning disable NUnit2045 // Interdependent assertions.
-                Assert.That(container.Insert(user));
+                Assert.That(conSystem.Insert(user, container));
                 Assert.That(sEntities.GetComponent<TransformComponent>(user).ParentUid, Is.EqualTo(containerEntity));
 #pragma warning restore NUnit2045
 
index 2e461345041de401560e9cbf0a8575b99d474aae..af3e474d08bb3d272b5921c1c702e9db01731129 100644 (file)
@@ -177,7 +177,7 @@ public sealed class AmeControllerSystem : EntitySystem
         if (!Exists(jar))
             return;
 
-        controller.JarSlot.Remove(jar!.Value);
+        _containerSystem.Remove(jar!.Value, controller.JarSlot);
         UpdateUi(uid, controller);
         if (Exists(user))
             _handsSystem.PickupOrDrop(user, jar!.Value);
@@ -303,7 +303,7 @@ public sealed class AmeControllerSystem : EntitySystem
             return;
         }
 
-        comp.JarSlot.Insert(args.Used);
+        _containerSystem.Insert(args.Used, comp.JarSlot);
         _popupSystem.PopupEntity(Loc.GetString("ame-controller-component-interact-using-success"), uid, args.User, PopupType.Medium);
 
         UpdateUi(uid, comp);
index 6fbbd030d044ada53eff9e922cdd2a3245dced30..a5a7cd89d858d23c0fe1112af18aff14ffd9c4b5 100644 (file)
@@ -285,7 +285,7 @@ public sealed class AntagSelectionSystem : GameRuleSystem<GameRuleComponent>
                 {
                     if (_containerSystem.CanInsert(itemToSpawn, pocket1Slot))
                     {
-                        pocket1Slot.Insert(itemToSpawn);
+                        _containerSystem.Insert(itemToSpawn, pocket1Slot);
                     }
                 }
                 else if (_inventory.TryGetSlotContainer(antag, "pocket2", out var pocket2Slot, out _))
@@ -294,7 +294,7 @@ public sealed class AntagSelectionSystem : GameRuleSystem<GameRuleComponent>
                     {
                         if (_containerSystem.CanInsert(itemToSpawn, pocket2Slot))
                         {
-                            pocket2Slot.Insert(itemToSpawn);
+                            _containerSystem.Insert(itemToSpawn, pocket2Slot);
                         }
                     }
                 }
index 02b2eee7712cf9e1d936d676eb4d12dfe811010d..cb08e19fc22790cab167d81c88d877ade1b9795f 100644 (file)
@@ -199,7 +199,7 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
             return false;
 
         var installedProgram = Spawn(prototype, new EntityCoordinates(loaderUid, 0, 0));
-        container.Insert(installedProgram);
+        _containerSystem.Insert(installedProgram, container);
 
         UpdateCartridgeInstallationStatus(installedProgram, deinstallable ? InstallationStatus.Installed : InstallationStatus.Readonly);
 
index 97575c2d32fa468fefde0e95bd37cac5a41d536f..6156a88c38d804c79c7785dfcf11efd0d876083d 100644 (file)
@@ -255,7 +255,7 @@ namespace Content.Server.Cloning
             var cloneMindReturn = EntityManager.AddComponent<BeingClonedComponent>(mob);
             cloneMindReturn.Mind = mind;
             cloneMindReturn.Parent = uid;
-            clonePod.BodyContainer.Insert(mob);
+            _containerSystem.Insert(mob, clonePod.BodyContainer);
             ClonesWaitingForMind.Add(mind, mob);
             UpdateStatus(uid, CloningPodStatus.NoMind, clonePod);
             _euiManager.OpenEui(new AcceptCloningEui(mindEnt, mind, this), client);
@@ -326,7 +326,7 @@ namespace Content.Server.Cloning
                 return;
 
             EntityManager.RemoveComponent<BeingClonedComponent>(entity);
-            clonePod.BodyContainer.Remove(entity);
+            _containerSystem.Remove(entity, clonePod.BodyContainer);
             clonePod.CloningProgress = 0f;
             clonePod.UsedBiomass = 0;
             UpdateStatus(uid, CloningPodStatus.Idle, clonePod);
index 46c6caf5cf04ffa05bc9c92c67802a66ae782328..e11c79d851e40b8b30a41676e8cfc313990b8f89 100644 (file)
@@ -54,7 +54,7 @@ public sealed partial class BuildMech : IGraphAction
             return;
         }
 
-        container.Remove(cell);
+        containerSystem.Remove(cell, container);
 
         var transform = entityManager.GetComponent<TransformComponent>(uid);
         var mech = entityManager.SpawnEntity(MechPrototype, transform.Coordinates);
@@ -62,7 +62,7 @@ public sealed partial class BuildMech : IGraphAction
         if (entityManager.TryGetComponent<MechComponent>(mech, out var mechComp) && mechComp.BatterySlot.ContainedEntity == null)
         {
             mechSys.InsertBattery(mech, cell, mechComp, batteryComponent);
-            mechComp.BatterySlot.Insert(cell);
+            containerSystem.Insert(cell, mechComp.BatterySlot);
         }
 
         var entChangeEv = new ConstructionChangeEntityEvent(mech, uid);
index b18bb733d910a44882ec7174e8c4b4b7c14cd0ac..b6511883b14a0cd96a15fb33b1711e4b1f774b83 100644 (file)
@@ -21,7 +21,7 @@ namespace Content.Server.Construction.Completions
 
             foreach (var contained in container.ContainedEntities.ToArray())
             {
-                if(container.Remove(contained))
+                if(containerSys.Remove(contained, container))
                     entityManager.QueueDeleteEntity(contained);
             }
         }
index cba1819ae9d7a96f9db959b59073540e376e0080..16ab1c57ecaa2dab26b3cb564839a1804d2fb70a 100644 (file)
@@ -26,8 +26,8 @@ namespace Content.Server.Construction.Completions
 
             foreach (var contained in from.ContainedEntities.ToArray())
             {
-                if (from.Remove(contained))
-                    to.Insert(contained);
+                if (containerSystem.Remove(contained, from))
+                    containerSystem.Insert(contained, to);
             }
         }
     }
index fc4563c93ae8202e0c1c121b0fb45601cd7698fb..1dd1ee8ddd497276ca2b2ba57d04b47f40e24b1e 100644 (file)
@@ -24,7 +24,7 @@ namespace Content.Server.Construction.Completions
             var coordinates = entityManager.GetComponent<TransformComponent>(uid).Coordinates;
             for (var i = 0; i < Amount; i++)
             {
-                container.Insert(entityManager.SpawnEntity(Prototype, coordinates));
+                containerSystem.Insert(entityManager.SpawnEntity(Prototype, coordinates), container);
             }
         }
     }
index edc1d26b6d497a77fb86c2166043f166cbc22c17..0685b08f4ff879063f037af897b6326534f698eb 100644 (file)
@@ -61,7 +61,7 @@ public sealed partial class ConstructionSystem
 
         var board = EntityManager.SpawnEntity(component.BoardPrototype, Transform(ent).Coordinates);
 
-        if (!container.Insert(board))
+        if (!_container.Insert(board, container))
             Log.Warning($"Couldn't insert board {board} to computer {ent}!");
     }
 }
index be8b0e688dd5df11b6fb3abbec33f2171301eaef..570360bf09a31f7b5df38609b332a1f43a450169 100644 (file)
@@ -388,8 +388,8 @@ namespace Content.Server.Construction
                     for (var i = ourContainer.ContainedEntities.Count - 1; i >= 0; i--)
                     {
                         var entity = ourContainer.ContainedEntities[i];
-                        ourContainer.ForceRemove(entity);
-                        otherContainer.Insert(entity);
+                        _container.Remove(entity, ourContainer, reparent: false, force: true);
+                        _container.Insert(entity, otherContainer);
                     }
                 }
             }
index f3123087988725b4114619ca0c8ab86b87d99fa0..52cde02d21562815408df8b5ec2d0999ccbc08c6 100644 (file)
@@ -133,14 +133,14 @@ namespace Content.Server.Construction
             {
                 foreach (var entity in container.ContainedEntities.ToArray())
                 {
-                    container.Remove(entity);
+                    _container.Remove(entity, container);
                 }
 
                 foreach (var cont in containers.Values)
                 {
                     foreach (var entity in cont.ContainedEntities.ToArray())
                     {
-                        cont.Remove(entity);
+                        _container.Remove(entity, cont);
                     }
                 }
 
@@ -150,10 +150,10 @@ namespace Content.Server.Construction
 
             void ShutdownContainers()
             {
-                container.Shutdown();
+                _container.ShutdownContainer(container);
                 foreach (var c in containers.Values.ToArray())
                 {
-                    c.Shutdown();
+                    _container.ShutdownContainer(c);
                 }
             }
 
@@ -188,10 +188,10 @@ namespace Content.Server.Construction
 
                             if (string.IsNullOrEmpty(materialStep.Store))
                             {
-                                if (!container.Insert(splitStack.Value))
+                                if (!_container.Insert(splitStack.Value, container))
                                     continue;
                             }
-                            else if (!GetContainer(materialStep.Store).Insert(splitStack.Value))
+                            else if (!_container.Insert(splitStack.Value, GetContainer(materialStep.Store)))
                                 continue;
 
                             handled = true;
@@ -217,10 +217,10 @@ namespace Content.Server.Construction
 
                             if (string.IsNullOrEmpty(arbitraryStep.Store))
                             {
-                                if (!container.Insert(entity))
+                                if (!_container.Insert(entity, container))
                                     continue;
                             }
-                            else if (!GetContainer(arbitraryStep.Store).Insert(entity))
+                            else if (!_container.Insert(entity, GetContainer(arbitraryStep.Store)))
                                 continue;
 
                             handled = true;
@@ -284,8 +284,8 @@ namespace Content.Server.Construction
 
                 foreach (var entity in cont.ContainedEntities.ToArray())
                 {
-                    cont.ForceRemove(entity);
-                    newCont.Insert(entity);
+                    _container.Remove(entity, cont, reparent: false, force: true);
+                    _container.Insert(entity, newCont);
                 }
             }
 
index 11dd0b2bf046142ba291c5c83344c96444975280..6112dd13ad2a39a148e15958d747eb9550a0e15c 100644 (file)
@@ -329,7 +329,7 @@ namespace Content.Server.Construction
                         construction.Containers.Add(store);
 
                         // The container doesn't necessarily need to exist, so we ensure it.
-                        _container.EnsureContainer<Container>(uid, store).Insert(insert);
+                        _container.Insert(insert, _container.EnsureContainer<Container>(uid, store));
                     }
                     else
                     {
index a6472c38d15eafb1f422eebd32cc6d669af55c3f..65b0b704761794fd653d65ea97308cb45a60ec4f 100644 (file)
@@ -125,7 +125,7 @@ public sealed partial class ConstructionSystem
 
         var board = EntityManager.SpawnEntity(component.BoardPrototype, Transform(uid).Coordinates);
 
-        if (!component.BoardContainer.Insert(board))
+        if (!_container.Insert(board, component.BoardContainer))
         {
             throw new Exception($"Couldn't insert board with prototype {component.BoardPrototype} to machine with prototype {MetaData(uid).EntityPrototype?.ID ?? "N/A"}!");
         }
@@ -143,7 +143,7 @@ public sealed partial class ConstructionSystem
             {
                 var p = EntityManager.SpawnEntity(partProto.StockPartPrototype, xform.Coordinates);
 
-                if (!partContainer.Insert(p))
+                if (!_container.Insert(p, partContainer))
                     throw new Exception($"Couldn't insert machine part of type {part} to machine with prototype {partProto.StockPartPrototype ?? "N/A"}!");
             }
         }
@@ -152,7 +152,7 @@ public sealed partial class ConstructionSystem
         {
             var stack = _stackSystem.Spawn(amount, stackType, Transform(uid).Coordinates);
 
-            if (!partContainer.Insert(stack))
+            if (!_container.Insert(stack, partContainer))
                 throw new Exception($"Couldn't insert machine material of type {stackType} to machine with prototype {MetaData(uid).EntityPrototype?.ID ?? "N/A"}");
         }
 
@@ -162,7 +162,7 @@ public sealed partial class ConstructionSystem
             {
                 var c = EntityManager.SpawnEntity(info.DefaultPrototype, Transform(uid).Coordinates);
 
-                if(!partContainer.Insert(c))
+                if(!_container.Insert(c, partContainer))
                     throw new Exception($"Couldn't insert machine component part with default prototype '{compName}' to machine with prototype {MetaData(uid).EntityPrototype?.ID ?? "N/A"}");
             }
         }
@@ -173,7 +173,7 @@ public sealed partial class ConstructionSystem
             {
                 var c = EntityManager.SpawnEntity(info.DefaultPrototype, Transform(uid).Coordinates);
 
-                if(!partContainer.Insert(c))
+                if(!_container.Insert(c, partContainer))
                     throw new Exception($"Couldn't insert machine component part with default prototype '{tagName}' to machine with prototype {MetaData(uid).EntityPrototype?.ID ?? "N/A"}");
             }
         }
index a033b39d203ed4284b858072d193eba026ebe143..09d8d413ecd73806bd85849269b1c2889d748a7e 100644 (file)
@@ -100,7 +100,7 @@ public sealed class MachineFrameSystem : EntitySystem
                     return;
 
                 args.Handled = true;
-                if (!component.PartContainer.Insert(args.Used))
+                if (!_container.Insert(args.Used, component.PartContainer))
                     return;
             }
 
@@ -132,7 +132,7 @@ public sealed class MachineFrameSystem : EntitySystem
                     return;
 
                 args.Handled = true;
-                if (!component.PartContainer.Insert(args.Used))
+                if (!_container.Insert(args.Used, component.PartContainer))
                     return;
             }
 
@@ -156,7 +156,7 @@ public sealed class MachineFrameSystem : EntitySystem
         if (!_container.TryRemoveFromContainer(used))
             return false;
 
-        if (!component.BoardContainer.Insert(used))
+        if (!_container.Insert(used, component.BoardContainer))
             return true;
 
         ResetProgressAndRequirements(component, machineBoard);
@@ -181,7 +181,7 @@ public sealed class MachineFrameSystem : EntitySystem
         if (!_container.TryRemoveFromContainer(used))
             return false;
 
-        if (!component.PartContainer.Insert(used))
+        if (!_container.Insert(used, component.PartContainer))
             return true;
 
         component.Progress[machinePart.PartType]++;
@@ -212,7 +212,7 @@ public sealed class MachineFrameSystem : EntitySystem
             if (!_container.TryRemoveFromContainer(used))
                 return false;
 
-            if (!component.PartContainer.Insert(used))
+            if (!_container.Insert(used, component.PartContainer))
                 return true;
 
             component.MaterialProgress[type] += count;
@@ -224,7 +224,7 @@ public sealed class MachineFrameSystem : EntitySystem
         if (splitStack == null)
             return false;
 
-        if (!component.PartContainer.Insert(splitStack.Value))
+        if (!_container.Insert(splitStack.Value, component.PartContainer))
             return true;
 
         component.MaterialProgress[type] += needed;
index 75629146a4cdab23ba3111596f8421fbc46f2df2..f364d1b547d078b9dee67b8e44c28059cb574de3 100644 (file)
@@ -91,7 +91,7 @@ public sealed class PartExchangerSystem : EntitySystem
         }
         foreach (var part in updatedParts)
         {
-            machine.PartContainer.Insert(part.part, EntityManager);
+            _container.Insert(part.part, machine.PartContainer);
             machineParts.Remove(part);
         }
 
@@ -140,7 +140,7 @@ public sealed class PartExchangerSystem : EntitySystem
             if (!machine.Requirements.ContainsKey(part.PartType))
                 continue;
 
-            machine.PartContainer.Insert(partEnt, EntityManager);
+            _container.Insert(partEnt, machine.PartContainer);
             machine.Progress[part.PartType]++;
             machineParts.Remove(pair);
         }
index 77563dd31c238e571af4cb635b3751499c089cd4..ae3ca47dd7821b9e3c6fb7f303e71523ffe11ba6 100644 (file)
@@ -26,8 +26,8 @@ namespace Content.Server.Containers
         {
             foreach (var slot in component.Slots.Values)
             {
-                if (slot.EjectOnDeconstruct && slot.Item != null)
-                    slot.ContainerSlot?.Remove(slot.Item.Value);
+                if (slot.EjectOnDeconstruct && slot.Item != null && slot.ContainerSlot != null)
+                    _container.Remove(slot.Item.Value, slot.ContainerSlot);
             }
         }
 
index 3b15e725fe6e43786fd4d6e49acead6b81a2ffa2..febbd093a6cd7aa67316f4018cdc50d0b074526b 100644 (file)
@@ -31,7 +31,7 @@ public sealed class DevourSystem : SharedDevourSystem
 
             if (component.ShouldStoreDevoured && args.Args.Target is not null)
             {
-                component.Stomach.Insert(args.Args.Target.Value);
+                ContainerSystem.Insert(args.Args.Target.Value, component.Stomach);
             }
             _bloodstreamSystem.TryAddToChemicals(uid, ichorInjection);
         }
index 59aa832f6a79b89bf61c8b0f35c35afaa6dd283a..cc9d2f711b308729e6ba68e9c111343e8743de02 100644 (file)
@@ -63,7 +63,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
             if (!CanInsert(uid, toInsert, holder))
                 return false;
 
-            if (!holder.Container.Insert(toInsert, EntityManager))
+            if (!_containerSystem.Insert(toInsert, holder.Container))
                 return false;
 
             if (_physicsQuery.TryGetComponent(toInsert, out var physBody))
@@ -127,14 +127,14 @@ namespace Content.Server.Disposal.Unit.EntitySystems
                 RemComp<BeingDisposedComponent>(entity);
 
                 var meta = _metaQuery.GetComponent(entity);
-                holder.Container.Remove(entity, EntityManager, meta: meta, reparent: false, force: true);
+                _containerSystem.Remove((entity, null, meta), holder.Container, reparent: false, force: true);
 
                 var xform = _xformQuery.GetComponent(entity);
                 if (xform.ParentUid != uid)
                     continue;
 
                 if (duc != null)
-                    duc.Container.Insert(entity, EntityManager, xform, meta: meta);
+                    _containerSystem.Insert((entity, xform, meta), duc.Container);
                 else
                 {
                     _xformSystem.AttachToGridOrMap(entity, xform);
@@ -185,7 +185,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
             }
 
             // Insert into next tube
-            if (!to.Contents.Insert(holderUid))
+            if (!_containerSystem.Insert(holderUid, to.Contents))
             {
                 ExitDisposals(holderUid, holder, holderTransform);
                 return false;
@@ -267,7 +267,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
 
                 // Past this point, we are performing inter-tube transfer!
                 // Remove current tube content
-                _disposalTubeQuery.GetComponent(currentTube).Contents.Remove(uid, reparent: false, force: true);
+                _containerSystem.Remove(uid, _disposalTubeQuery.GetComponent(currentTube).Contents, reparent: false, force: true);
 
                 // Find next tube
                 var nextTube = _disposalTubeSystem.NextTubeFor(currentTube, holder.CurrentDirection);
index 659566ca4319d8a3df969a84d7c2c9f97d45902a..0dfc1ffe0d4fdcc392a48fabf12e6aa93e4d694a 100644 (file)
@@ -208,7 +208,7 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem
         if (!ResolveDisposals(uid, ref disposal))
             return;
 
-        if (!disposal.Container.Insert(toInsert))
+        if (!_containerSystem.Insert(toInsert, disposal.Container))
             return;
 
         _adminLogger.Add(LogType.Action, LogImpact.Medium, $"{ToPrettyString(user):player} inserted {ToPrettyString(toInsert)} into {ToPrettyString(uid)}");
@@ -681,7 +681,7 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem
 
     public void Remove(EntityUid uid, SharedDisposalUnitComponent component, EntityUid toRemove)
     {
-        component.Container.Remove(toRemove);
+        _containerSystem.Remove(toRemove, component.Container);
 
         if (component.Container.ContainedEntities.Count == 0)
         {
@@ -800,7 +800,7 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem
     {
         _audioSystem.PlayPvs(component.InsertSound, uid);
 
-        if (!component.Container.Insert(inserted))
+        if (!_containerSystem.Insert(inserted, component.Container))
             return;
 
         if (user != inserted && user != null)
index f355187a0b0af5d83953583cc2b080f4a2d5fed6..169daca07aca1d1b7b03a1a14eb80e21ddbb5a3e 100644 (file)
@@ -91,7 +91,7 @@ public sealed partial class EnsnareableSystem
         }
 
         component.Ensnared = target;
-        ensnareable.Container.Insert(ensnare);
+        _container.Insert(ensnare, ensnareable.Container);
         ensnareable.IsEnsnared = true;
         Dirty(ensnareable);
 
@@ -147,7 +147,7 @@ public sealed partial class EnsnareableSystem
 
         var target = component.Ensnared.Value;
 
-        ensnareable.Container.Remove(ensnare, force: true);
+        _container.Remove(ensnare, ensnareable.Container, force: true);
         ensnareable.IsEnsnared = ensnareable.Container.ContainedEntities.Count > 0;
         Dirty(ensnareable);
         component.Ensnared = null;
index 66758eed846514e087b22bdf7afaa36f4ca1aed1..f939e087e029c1f7a1feca5046b589ac9d74967f 100644 (file)
@@ -38,7 +38,7 @@ public sealed partial class EnsnareableSystem : SharedEnsnareableSystem
         if (args.Handled || !TryComp<EnsnaringComponent>(args.Args.Used, out var ensnaring))
             return;
 
-        if (args.Cancelled || !component.Container.Remove(args.Args.Used.Value))
+        if (args.Cancelled || !_container.Remove(args.Args.Used.Value, component.Container))
         {
             _popup.PopupEntity(Loc.GetString("ensnare-component-try-free-fail", ("ensnare", args.Args.Used)), uid, uid, PopupType.MediumCaution);
             return;
index 2674a8d61bc17788d4b9165bbf626771af1e50f8..ee3f76d04c6385488e60562748fa0f9b7916c5bf 100644 (file)
@@ -158,7 +158,7 @@ public sealed class ClusterGrenadeSystem : EntitySystem
             grenade = component.GrenadesContainer.ContainedEntities[0];
 
             // This shouldn't happen but you never know.
-            if (!component.GrenadesContainer.Remove(grenade))
+            if (!_containerSystem.Remove(grenade, component.GrenadesContainer))
                 return false;
 
             return true;
index 1b3cbd1fc3ad23bb8f461ede7ff227da64dd49d9..02099b2c7b2bb50f6e5fdfa7de433c3f51480976 100644 (file)
@@ -67,7 +67,7 @@ namespace Content.Server.Guardian
             if (!TryComp(host, out GuardianHostComponent? hostComponent))
                 return;
 
-            hostComponent.GuardianContainer.Remove(uid);
+            _container.Remove(uid, hostComponent.GuardianContainer);
             hostComponent.HostedGuardian = null;
             Dirty(host.Value, hostComponent);
             QueueDel(hostComponent.ActionEntity);
@@ -213,7 +213,7 @@ namespace Content.Server.Guardian
             // Use map position so it's not inadvertantly parented to the host + if it's in a container it spawns outside I guess.
             var guardian = Spawn(component.GuardianProto, hostXform.MapPosition);
 
-            host.GuardianContainer.Insert(guardian);
+            _container.Insert(guardian, host.GuardianContainer);
             host.HostedGuardian = guardian;
 
             if (TryComp<GuardianComponent>(guardian, out var guardianComp))
@@ -337,7 +337,7 @@ namespace Content.Server.Guardian
             }
 
             DebugTools.Assert(hostComponent.GuardianContainer.Contains(guardian));
-            hostComponent.GuardianContainer.Remove(guardian);
+            _container.Remove(guardian, hostComponent.GuardianContainer);
             DebugTools.Assert(!hostComponent.GuardianContainer.Contains(guardian));
 
             guardianComponent.GuardianLoose = true;
@@ -351,7 +351,7 @@ namespace Content.Server.Guardian
                 return;
             }
 
-            hostComponent.GuardianContainer.Insert(guardian);
+            _container.Insert(guardian, hostComponent.GuardianContainer);
             DebugTools.Assert(hostComponent.GuardianContainer.Contains(guardian));
             _popupSystem.PopupEntity(Loc.GetString("guardian-entity-recall"), host);
             guardianComponent.GuardianLoose = false;
index 516191125499076d2f7e2304ae1605d95bd72e93..dbd34d748438fa9bab43417851f17a3f38b2e5f7 100644 (file)
@@ -9,6 +9,7 @@ using Content.Shared.IdentityManagement;
 using Content.Shared.IdentityManagement.Components;
 using Content.Shared.Inventory;
 using Content.Shared.Inventory.Events;
+using Robust.Shared.Containers;
 using Robust.Shared.Enums;
 using Robust.Shared.GameObjects.Components.Localization;
 
@@ -22,6 +23,7 @@ public class IdentitySystem : SharedIdentitySystem
     [Dependency] private readonly IdCardSystem _idCard = default!;
     [Dependency] private readonly IAdminLogManager _adminLog = default!;
     [Dependency] private readonly MetaDataSystem _metaData = default!;
+    [Dependency] private readonly SharedContainerSystem _container = default!;
     [Dependency] private readonly HumanoidAppearanceSystem _humanoid = default!;
 
     private HashSet<EntityUid> _queuedIdentityUpdates = new();
@@ -59,7 +61,7 @@ public class IdentitySystem : SharedIdentitySystem
         var ident = Spawn(null, Transform(uid).Coordinates);
 
         QueueIdentityUpdate(uid);
-        component.IdentityEntitySlot.Insert(ident);
+        _container.Insert(ident, component.IdentityEntitySlot);
     }
 
     /// <summary>
index 436f040acf7ffc9532c2f91f0600b813feb76a69..e4159f89ef8f808cf163b5846b902d0fcffc1f14 100644 (file)
@@ -173,7 +173,7 @@ namespace Content.Server.Kitchen.EntitySystems
 
                         if (metaData.EntityPrototype.ID == recipeSolid.Key)
                         {
-                            component.Storage.Remove(item);
+                            _sharedContainer.Remove(item, component.Storage);
                             EntityManager.DeleteEntity(item);
                             break;
                         }
@@ -208,7 +208,7 @@ namespace Content.Server.Kitchen.EntitySystems
 
                 foreach (var part in headSlots)
                 {
-                    component.Storage.Insert(part.Id);
+                    _container.Insert(part.Id, component.Storage);
                     headCount++;
                 }
             }
@@ -371,7 +371,7 @@ namespace Content.Server.Kitchen.EntitySystems
                 if (_tag.HasTag(item, "MicrowaveSelfUnsafe") || _tag.HasTag(item, "Plastic"))
                 {
                     var junk = Spawn(component.BadRecipeEntityId, Transform(uid).Coordinates);
-                    component.Storage.Insert(junk);
+                    _container.Insert(junk, component.Storage);
                     QueueDel(item);
                 }
 
@@ -504,7 +504,7 @@ namespace Content.Server.Kitchen.EntitySystems
             if (!HasContents(component) || HasComp<ActiveMicrowaveComponent>(uid))
                 return;
 
-            component.Storage.Remove(EntityManager.GetEntity(args.EntityID));
+            _sharedContainer.Remove(EntityManager.GetEntity(args.EntityID), component.Storage);
             UpdateUserInterfaceState(uid, component);
         }
 
index 3a6d5e4134c225c0fd10578151a48be6208e5fdc..ba6795ad9f52af4b4ba24780d4bc17eac62fc6cc 100644 (file)
@@ -159,7 +159,7 @@ namespace Content.Server.Kitchen.EntitySystems
             if (inputContainer.ContainedEntities.Count >= reagentGrinder.StorageMaxEntities)
                 return;
 
-            if (!inputContainer.Insert(heldEnt, EntityManager))
+            if (!_containerSystem.Insert(heldEnt, inputContainer))
                 return;
 
             args.Handled = true;
@@ -230,7 +230,7 @@ namespace Content.Server.Kitchen.EntitySystems
             ClickSound(uid, reagentGrinder);
             foreach (var entity in inputContainer.ContainedEntities.ToList())
             {
-                inputContainer.Remove(entity);
+                _containerSystem.Remove(entity, inputContainer);
                 _randomHelper.RandomOffset(entity, 0.4f);
             }
             UpdateUiState(uid);
@@ -244,7 +244,7 @@ namespace Content.Server.Kitchen.EntitySystems
             var inputContainer = _containerSystem.EnsureContainer<Container>(uid, SharedReagentGrinder.InputContainerId);
             var ent = GetEntity(message.EntityId);
 
-            if (inputContainer.Remove(ent))
+            if (_containerSystem.Remove(ent, inputContainer))
             {
                 _randomHelper.RandomOffset(ent, 0.4f);
                 ClickSound(uid, reagentGrinder);
index 8347f14ea46e77547f95d0ba2f997e9023cbe9a8..c34fcfe3a24458c5b3fa0a073bbc1adfe43f9ce3 100644 (file)
@@ -137,7 +137,7 @@ public sealed class LightReplacerSystem : EntitySystem
         if (bulb.Valid) // FirstOrDefault can return default/invalid uid.
         {
             // try to remove it
-            var hasRemoved = replacer.InsertedBulbs.Remove(bulb);
+            var hasRemoved = _container.Remove(bulb, replacer.InsertedBulbs);
             if (!hasRemoved)
                 return false;
         }
@@ -187,7 +187,7 @@ public sealed class LightReplacerSystem : EntitySystem
         }
 
         // try insert light and show message
-        var hasInsert = replacer.InsertedBulbs.Insert(bulbUid);
+        var hasInsert = _container.Insert(bulbUid, replacer.InsertedBulbs);
         if (hasInsert && showTooltip && userUid != null)
         {
             var msg = Loc.GetString("comp-light-replacer-insert-light",
index b92fc247d0613b710eb51a35dc6dbc8a19fe5636..6aea340e56590c1ef8017c36958ee437bf075ada 100644 (file)
@@ -87,7 +87,7 @@ namespace Content.Server.Light.EntitySystems
             if (light.HasLampOnSpawn != null)
             {
                 var entity = EntityManager.SpawnEntity(light.HasLampOnSpawn, EntityManager.GetComponent<TransformComponent>(uid).Coordinates);
-                light.LightBulbContainer.Insert(entity);
+                _containerSystem.Insert(entity, light.LightBulbContainer);
             }
             // need this to update visualizers
             UpdateLight(uid, light);
@@ -182,7 +182,7 @@ namespace Content.Server.Light.EntitySystems
                 return false;
 
             // try to insert bulb in container
-            if (!light.LightBulbContainer.Insert(bulbUid))
+            if (!_containerSystem.Insert(bulbUid, light.LightBulbContainer))
                 return false;
 
             UpdateLight(uid, light);
@@ -203,7 +203,7 @@ namespace Content.Server.Light.EntitySystems
                 return null;
 
             // try to remove bulb from container
-            if (!light.LightBulbContainer.Remove(bulb))
+            if (!_containerSystem.Remove(bulb, light.LightBulbContainer))
                 return null;
 
             // try to place bulb in hands
index 2f8b43e83287f7f5ad0f952cc55e0cddd3ec4ccb..d6a94ec6d24da7c8b9aefc1757d84d5770be91f6 100644 (file)
@@ -141,7 +141,7 @@ public sealed class MaterialReclaimerSystem : SharedMaterialReclaimerSystem
         if (active.ReclaimingContainer.ContainedEntities.FirstOrNull() is not { } item)
             return false;
 
-        active.ReclaimingContainer.Remove(item);
+        Container.Remove(item, active.ReclaimingContainer);
         Dirty(component);
 
         // scales the output if the process was interrupted.
index 8b7a4c62040f35fc65b04ee09fb576b1712517f6..9f5d564d5a2632b97cd8aec6525aee3ade3d6046 100644 (file)
@@ -78,7 +78,7 @@ public sealed class MechGrabberSystem : EntitySystem
         if (!Resolve(uid, ref component))
             return;
 
-        component.ItemContainer.Remove(toRemove);
+        _container.Remove(toRemove, component.ItemContainer);
         var mechxform = Transform(mech);
         var xform = Transform(toRemove);
         _transform.AttachToGridOrMap(toRemove, xform);
@@ -175,7 +175,7 @@ public sealed class MechGrabberSystem : EntitySystem
         if (!_mech.TryChangeEnergy(equipmentComponent.EquipmentOwner.Value, component.GrabEnergyDelta))
             return;
 
-        component.ItemContainer.Insert(args.Args.Target.Value);
+        _container.Insert(args.Args.Target.Value, component.ItemContainer);
         _mech.UpdateUserInterface(equipmentComponent.EquipmentOwner.Value);
 
         args.Handled = true;
index d2373241027d2338606ef01b723dd8c4a4111d6d..e5b7bfaac3c89d209b64f16f2b961c63332b9050 100644 (file)
@@ -47,7 +47,7 @@ public sealed class MechAssemblySystem : EntitySystem
             if (!val && tagComp.Tags.Contains(tag))
             {
                 component.RequiredParts[tag] = true;
-                component.PartsContainer.Insert(args.Used);
+                _container.Insert(args.Used, component.PartsContainer);
                 break;
             }
         }
index 780dbac82b59ae39db429f17884d87d58ea00058..fe903655b54e51dabc6a73184d4ee24866f2d613 100644 (file)
@@ -358,7 +358,7 @@ public sealed partial class MechSystem : SharedMechSystem
         if (!Resolve(toInsert, ref battery, false))
             return;
 
-        component.BatterySlot.Insert(toInsert);
+        _container.Insert(toInsert, component.BatterySlot);
         component.Energy = battery.CurrentCharge;
         component.MaxEnergy = battery.MaxCharge;
 
index d4694e8fb8dac6a128dd1aba8d6b3d5cd868350f..54de0bc3b5cec7beda9ffe5433eefb5b950cc6c8 100644 (file)
@@ -233,7 +233,7 @@ namespace Content.Server.Medical
             if (!HasComp<BodyComponent>(to_insert))
                 return;
 
-            scannerComponent.BodyContainer.Insert(to_insert);
+            _containerSystem.Insert(to_insert, scannerComponent.BodyContainer);
             UpdateAppearance(uid, scannerComponent);
         }
 
@@ -245,7 +245,7 @@ namespace Content.Server.Medical
             if (scannerComponent.BodyContainer.ContainedEntity is not { Valid: true } contained)
                 return;
 
-            scannerComponent.BodyContainer.Remove(contained);
+            _containerSystem.Remove(contained, scannerComponent.BodyContainer);
             _climbSystem.ForciblySetClimbing(contained, uid);
             UpdateAppearance(uid, scannerComponent);
         }
index 7f3c7aa1e90e2de9f0fd8e1ea2c08ccf7aa62552..1f0682774ff21c8d6fa7dcc23395ac68fb2b90ff 100644 (file)
@@ -16,6 +16,7 @@ using Content.Shared.Verbs;
 using Robust.Server.GameObjects;
 using Robust.Shared.Audio;
 using Robust.Shared.Audio.Systems;
+using Robust.Shared.Containers;
 using Robust.Shared.Player;
 
 namespace Content.Server.Morgue;
@@ -29,6 +30,7 @@ public sealed class CrematoriumSystem : EntitySystem
     [Dependency] private readonly SharedPopupSystem _popup = default!;
     [Dependency] private readonly StandingStateSystem _standing = default!;
     [Dependency] private readonly SharedMindSystem _minds = default!;
+    [Dependency] private readonly SharedContainerSystem _containers = default!;
 
     public override void Initialize()
     {
@@ -126,11 +128,11 @@ public sealed class CrematoriumSystem : EntitySystem
             for (var i = storage.Contents.ContainedEntities.Count - 1; i >= 0; i--)
             {
                 var item = storage.Contents.ContainedEntities[i];
-                storage.Contents.Remove(item);
+                _containers.Remove(item, storage.Contents);
                 EntityManager.DeleteEntity(item);
             }
             var ash = Spawn("Ash", Transform(uid).Coordinates);
-            storage.Contents.Insert(ash);
+            _containers.Insert(ash, storage.Contents);
         }
 
         _entityStorage.OpenStorage(uid, storage);
index 5531f65409c3817d9837a7905ad30e8a9bf06239..5b8a7b71653e160825a6e3797ee1c03892f2abda 100644 (file)
@@ -181,7 +181,7 @@ namespace Content.Server.Polymorph.Systems
             childXform.LocalRotation = targetTransformComp.LocalRotation;
 
             if (_container.TryGetContainingContainer(uid, out var cont))
-                cont.Insert(child);
+                _container.Insert(child, cont);
 
             //Transfers all damage from the original to the new one
             if (proto.TransferDamage &&
index 228f32ad90d577f7bcaef8b4a55ff6d2884c782a..a89a101845cff1d76aafd48e8d9185e1546f979a 100644 (file)
@@ -201,7 +201,7 @@ public sealed partial class BorgSystem
                     continue;
                 }
 
-                component.ProvidedContainer.Remove(item, EntityManager, force: true);
+                _container.Remove(item, component.ProvidedContainer, force: true);
             }
 
             if (!item.IsValid())
@@ -245,7 +245,7 @@ public sealed partial class BorgSystem
             if (LifeStage(item) <= EntityLifeStage.MapInitialized)
             {
                 RemComp<UnremoveableComponent>(item);
-                component.ProvidedContainer.Insert(item, EntityManager);
+                _container.Insert(item, component.ProvidedContainer);
             }
             _hands.RemoveHand(chassis, handId, hands);
         }
index ad2622af5091d4c1a5f4a90f89a6183a64d6d484..fa551ebc37e6ffeccaf3f1fa0b12cdd1385e940e 100644 (file)
@@ -33,7 +33,7 @@ public sealed partial class BorgSystem
 
         _adminLog.Add(LogType.Action, LogImpact.Medium,
             $"{ToPrettyString(attachedEntity):player} removed brain {ToPrettyString(brain)} from borg {ToPrettyString(uid)}");
-        component.BrainContainer.Remove(brain, EntityManager);
+        _container.Remove(brain, component.BrainContainer);
         _hands.TryPickupAnyHand(attachedEntity, brain);
         UpdateUI(uid, component);
     }
@@ -91,7 +91,7 @@ public sealed partial class BorgSystem
 
         _adminLog.Add(LogType.Action, LogImpact.Medium,
             $"{ToPrettyString(attachedEntity):player} removed module {ToPrettyString(module)} from borg {ToPrettyString(uid)}");
-        component.ModuleContainer.Remove(module);
+        _container.Remove(module, component.ModuleContainer);
         _hands.TryPickupAnyHand(attachedEntity, module);
 
         UpdateUI(uid, component);
index 7de351a70f3111c69c54920db275ad48160b9fa9..4d7892c0b71ad3fd0f7544aeca46fa05ffd96b61 100644 (file)
@@ -46,6 +46,7 @@ public sealed partial class BorgSystem : SharedBorgSystem
     [Dependency] private readonly PowerCellSystem _powerCell = default!;
     [Dependency] private readonly ThrowingSystem _throwing = default!;
     [Dependency] private readonly UserInterfaceSystem _ui = default!;
+    [Dependency] private readonly SharedContainerSystem _container = default!;
 
     [ValidatePrototypeId<JobPrototype>]
     public const string BorgJobId = "Borg";
@@ -109,7 +110,7 @@ public sealed partial class BorgSystem : SharedBorgSystem
                 }
             }
 
-            component.BrainContainer.Insert(used);
+            _container.Insert(used, component.BrainContainer);
             _adminLog.Add(LogType.Action, LogImpact.Medium,
                 $"{ToPrettyString(args.User):player} installed brain {ToPrettyString(used)} into borg {ToPrettyString(uid)}");
             args.Handled = true;
@@ -118,7 +119,7 @@ public sealed partial class BorgSystem : SharedBorgSystem
 
         if (module != null && CanInsertModule(uid, used, component, module, args.User))
         {
-            component.ModuleContainer.Insert(used);
+            _container.Insert(used, component.ModuleContainer);
             _adminLog.Add(LogType.Action, LogImpact.Low,
                 $"{ToPrettyString(args.User):player} installed module {ToPrettyString(used)} into borg {ToPrettyString(uid)}");
             args.Handled = true;
index a15dad8507e03124a2e4d8bb76d869c77cf4a061..5fb0e0756f8f2bbb4416231b203e0cf6c2b29f71 100644 (file)
@@ -215,7 +215,7 @@ public sealed class EventHorizonSystem : SharedEventHorizonSystem
             var target_container = outerContainer;
             while (target_container != null)
             {
-                if (target_container.Insert(entity))
+                if (_containerSystem.Insert(entity, target_container))
                     break;
 
                 _containerSystem.TryGetContainingContainer(target_container.Owner, out target_container);
index bcc1be39a92595de1c6d575cf34138f2a6128447..2d1104e2ceb32883c52710a12f9f44130a1dd648 100644 (file)
@@ -173,7 +173,7 @@ public sealed class StickySystem : EntitySystem
         // add container to entity and insert sticker into it
         var container = _containerSystem.EnsureContainer<Container>(target, StickerSlotId);
         container.ShowContents = true;
-        if (!container.Insert(uid))
+        if (!_containerSystem.Insert(uid, container))
             return;
 
         // show message to user
@@ -207,11 +207,11 @@ public sealed class StickySystem : EntitySystem
             return;
 
         // try to remove sticky item from target container
-        if (!_containerSystem.TryGetContainer(stuckTo, StickerSlotId, out var container) || !container.Remove(uid))
+        if (!_containerSystem.TryGetContainer(stuckTo, StickerSlotId, out var container) || !_containerSystem.Remove(uid, container))
             return;
         // delete container if it's now empty
         if (container.ContainedEntities.Count == 0)
-            container.Shutdown();
+            _containerSystem.ShutdownContainer(container);
 
         // try place dropped entity into user hands
         _handsSystem.PickupOrDrop(user, uid);
index 4333465f27d9a6eb230704e69d46d3bece605ce6..9995ed40c1223855931fcdb304ad0b9502114a56 100644 (file)
@@ -11,6 +11,7 @@ using Content.Shared.Mind.Components;
 using Content.Shared.Storage.Components;
 using Content.Shared.Storage.EntitySystems;
 using Content.Shared.Tools.Systems;
+using Robust.Shared.Containers;
 using Robust.Shared.Random;
 using Robust.Shared.Timing;
 
@@ -20,6 +21,7 @@ public sealed class BluespaceLockerSystem : EntitySystem
 {
     [Dependency] private readonly IRobustRandom _robustRandom = default!;
     [Dependency] private readonly IGameTiming _timing = default!;
+    [Dependency] private readonly SharedContainerSystem _containerSystem = default!;
     [Dependency] private readonly EntityStorageSystem _entityStorage = default!;
     [Dependency] private readonly WeldableSystem _weldableSystem = default!;
     [Dependency] private readonly LockSystem _lockSystem = default!;
@@ -91,12 +93,12 @@ public sealed class BluespaceLockerSystem : EntitySystem
                         if (!component.BehaviorProperties.TransportSentient)
                             continue;
 
-                        entityStorageComponent.Contents.Insert(entity, EntityManager);
+                        _containerSystem.Insert(entity, entityStorageComponent.Contents);
                         transportedEntities++;
                     }
                     else if (component.BehaviorProperties.TransportEntities)
                     {
-                        entityStorageComponent.Contents.Insert(entity, EntityManager);
+                        _containerSystem.Insert(entity, entityStorageComponent.Contents);
                         transportedEntities++;
                     }
                 }
@@ -308,12 +310,12 @@ public sealed class BluespaceLockerSystem : EntitySystem
                     if (!component.BehaviorProperties.TransportSentient)
                         continue;
 
-                    target.Value.storageComponent.Contents.Insert(entity, EntityManager);
+                    _containerSystem.Insert(entity, target.Value.storageComponent.Contents);
                     transportedEntities++;
                 }
                 else if (component.BehaviorProperties.TransportEntities)
                 {
-                    target.Value.storageComponent.Contents.Insert(entity, EntityManager);
+                    _containerSystem.Insert(entity, target.Value.storageComponent.Contents);
                     transportedEntities++;
                 }
             }
index a8144311bbf2953fc96565a1df87759eb680b5a9..7c58bcccca7e2331c9d121f79b8015771532ff4a 100644 (file)
@@ -8,12 +8,14 @@ using Robust.Shared.Random;
 using System.Linq;
 using Content.Shared.Storage.Components;
 using Robust.Shared.Audio.Systems;
+using Robust.Shared.Containers;
 
 namespace Content.Server.Storage.EntitySystems;
 
 public sealed class CursedEntityStorageSystem : EntitySystem
 {
     [Dependency] private readonly IRobustRandom _random = default!;
+    [Dependency] private readonly SharedContainerSystem _container = default!;
     [Dependency] private readonly EntityStorageSystem _entityStorage = default!;
     [Dependency] private readonly SharedAudioSystem _audio = default!;
 
@@ -48,7 +50,7 @@ public sealed class CursedEntityStorageSystem : EntitySystem
 
         foreach (var entity in storage.Contents.ContainedEntities.ToArray())
         {
-            storage.Contents.Remove(entity);
+            _container.Remove(entity, storage.Contents);
             _entityStorage.AddToContents(entity, lockerEnt);
         }
 
index a2990c203763a6ee892e75e57605a391f755cf74..798be3fc8eab6fb4b354abe79edb4e04db8e0ba0 100644 (file)
@@ -16,7 +16,7 @@ public sealed partial class GunSystem
             var existing = component.Entities[^1];
             component.Entities.RemoveAt(component.Entities.Count - 1);
 
-            component.Container.Remove(existing);
+            Containers.Remove(existing, component.Container);
             EnsureShootable(existing);
         }
         else if (component.UnspawnedCount > 0)
index 21e3f79f2ba4a2fc10607f73afa9dfe6092c790f..0fe2b83b1153fe74ce7d3f43856a5dfd464a356c 100644 (file)
@@ -187,7 +187,7 @@ public sealed class ActionContainerSystem : EntitySystem
 
         DebugTools.AssertOwner(uid, comp);
         comp ??= EnsureComp<ActionsContainerComponent>(uid);
-        if (!comp.Container.Insert(actionId))
+        if (!_container.Insert(actionId, comp.Container))
         {
             Log.Error($"Failed to insert action {ToPrettyString(actionId)} into {ToPrettyString(uid)}");
             return false;
@@ -239,7 +239,7 @@ public sealed class ActionContainerSystem : EntitySystem
         if (_timing.ApplyingState && component.NetSyncEnabled)
             return; // The game state should handle the container removal & action deletion.
 
-        component.Container.Shutdown();
+        _container.ShutdownContainer(component.Container);
     }
 
     private void OnEntityInserted(EntityUid uid, ActionsContainerComponent component, EntInsertedIntoContainerMessage args)
index b1b40dccfa878b7f2a315fac743bc665e2a38e6b..e5e4edddb07079f0e5c7af89e46db7531eaf80f2 100644 (file)
@@ -161,7 +161,7 @@ public partial class SharedBodySystem
                 var partSlot = CreatePartSlot(parentEntity, connection, childPartComponent.PartType, parentPartComponent);
                 var cont = Containers.GetContainer(parentEntity, GetPartSlotContainerId(connection));
 
-                if (partSlot == null || !cont.Insert(childPart))
+                if (partSlot == null || !Containers.Insert(childPart, cont))
                 {
                     Log.Error($"Could not create slot for connection {connection} in body {prototype.ID}");
                     QueueDel(childPart);
index 6e392b9892c25d7b3899735a2640249c3c7f019e..fa113907058e2d0e256f1969072f3f4295c1c03e 100644 (file)
@@ -98,7 +98,7 @@ public partial class SharedBodySystem
         if (!Containers.TryGetContainer(partId, containerId, out var container))
             return false;
 
-        return container.Insert(organId);
+        return Containers.Insert(organId, container);
     }
 
     /// <summary>
@@ -114,7 +114,7 @@ public partial class SharedBodySystem
         if (!HasComp<BodyPartComponent>(parent))
             return false;
 
-        return container.Remove(organId);
+        return Containers.Remove(organId, container);
     }
 
     /// <summary>
index cfebaf30944fcfe114b60ea7293e5756cc6dc72d..a1056568abc4a606ece12630c6c0b0bb87ebcb1d 100644 (file)
@@ -396,7 +396,7 @@ public partial class SharedBodySystem
             return false;
         }
 
-        return body.RootContainer.Insert(partId);
+        return Containers.Insert(partId, body.RootContainer);
     }
 
     #endregion
@@ -446,7 +446,7 @@ public partial class SharedBodySystem
             return false;
         }
 
-        return container.Insert(partId);
+        return Containers.Insert(partId, container);
     }
 
     #endregion
index 806723de1e67005ac9fa32eec4b56e449ba4a866..ac12c5e79165f992038e4075266924f9f4d5c492 100644 (file)
@@ -36,7 +36,7 @@ public abstract class SharedCartridgeLoaderSystem : EntitySystem
     {
         _itemSlotsSystem.RemoveItemSlot(uid, loader.CartridgeSlot);
         if (_container.TryGetContainer(uid, InstalledContainerId, out var cont))
-            cont.Shutdown(EntityManager, _netMan);
+            _container.ShutdownContainer(cont);
     }
 
     protected virtual void OnItemInserted(EntityUid uid, CartridgeLoaderComponent loader, EntInsertedIntoContainerMessage args)
index c9a5c974f99e6fe18916d31a8a7f919f3191b2c1..f03745006fac1b1487b89960b29ef6d3395a8e07 100644 (file)
@@ -143,7 +143,7 @@ public sealed class ToggleableClothingSystem : EntitySystem
         if (!_inventorySystem.TryUnequip(Transform(uid).ParentUid, toggleCom.Slot, force: true))
             return;
 
-        toggleCom.Container.Insert(uid, EntityManager);
+        _containerSystem.Insert(uid, toggleCom.Container);
         args.Handled = true;
     }
 
@@ -229,8 +229,8 @@ public sealed class ToggleableClothingSystem : EntitySystem
 
         // As unequipped gets called in the middle of container removal, we cannot call a container-insert without causing issues.
         // So we delay it and process it during a system update:
-        if (toggleComp.ClothingUid != null)
-            toggleComp.Container?.Insert(toggleComp.ClothingUid.Value);
+        if (toggleComp.ClothingUid != null && toggleComp.Container != null)
+            _containerSystem.Insert(toggleComp.ClothingUid.Value, toggleComp.Container);
     }
 
     /// <summary>
@@ -302,7 +302,7 @@ public sealed class ToggleableClothingSystem : EntitySystem
             var attachedClothing = EnsureComp<AttachedClothingComponent>(component.ClothingUid.Value);
             attachedClothing.AttachedUid = uid;
             Dirty(component.ClothingUid.Value, attachedClothing);
-            component.Container.Insert(component.ClothingUid.Value, EntityManager, ownerTransform: xform);
+            _containerSystem.Insert(component.ClothingUid.Value, component.Container, containerXform: xform);
             Dirty(uid, component);
         }
 
index 91aa25e030aee39c3a016f600f2cb3324878ca1b..4bc225d3700688c9d2ab7ed119f24777ca657dbe 100644 (file)
@@ -77,7 +77,7 @@ public sealed class PartAssemblySystem : EntitySystem
             return false;
 
         component.CurrentAssembly = assemblyId;
-        component.PartsContainer.Insert(part);
+        _container.Insert(part, component.PartsContainer);
         var ev = new PartAssemblyPartInsertedEvent();
         RaiseLocalEvent(uid, ev);
         return true;
index 88aa1def350f0af939ec992993fa974e5728013a..e120b6bc8838ce30dc0fd4ed08ae666f8d251088 100644 (file)
@@ -33,7 +33,7 @@ public sealed class ContainerFillSystem : EntitySystem
             foreach (var proto in prototypes)
             {
                 var ent = Spawn(proto, coords);
-                if (!container.Insert(ent, EntityManager, null, xform))
+                if (!_containerSystem.Insert(ent, container, containerXform: xform))
                 {
                     Log.Error($"Entity {ToPrettyString(uid)} with a {nameof(ContainerFillComponent)} failed to insert an entity: {ToPrettyString(ent)}.");
                     Transform(ent).AttachToGridOrMap();
index b272cc182ef283eda57496b0f9fea83ab85cd37b..bc2225a94c8844cea080bcabe8f553453e6a95ea 100644 (file)
@@ -68,7 +68,8 @@ namespace Content.Shared.Containers.ItemSlots
                     continue;
 
                 var item = EntityManager.SpawnEntity(slot.StartingItem, EntityManager.GetComponent<TransformComponent>(uid).Coordinates);
-                slot.ContainerSlot?.Insert(item);
+                if (slot.ContainerSlot != null)
+                    _containers.Insert(item, slot.ContainerSlot);
             }
         }
 
@@ -115,7 +116,7 @@ namespace Content.Shared.Containers.ItemSlots
             if (Terminating(uid) || slot.ContainerSlot == null)
                 return;
 
-            slot.ContainerSlot.Shutdown();
+            _containers.ShutdownContainer(slot.ContainerSlot);
 
             // Don't log missing resolves. when an entity has all of its components removed, the ItemSlotsComponent may
             // have been removed before some other component that added an item slot (and is now trying to remove it).
@@ -228,7 +229,7 @@ namespace Content.Shared.Containers.ItemSlots
         /// Useful for predicted interactions</param>
         private void Insert(EntityUid uid, ItemSlot slot, EntityUid item, EntityUid? user, bool excludeUserAudio = false)
         {
-            var inserted = slot.ContainerSlot?.Insert(item);
+            bool? inserted = slot.ContainerSlot != null ? _containers.Insert(item, slot.ContainerSlot) : null;
             // ContainerSlot automatically raises a directed EntInsertedIntoContainerMessage
 
             // Logging
@@ -350,7 +351,7 @@ namespace Content.Shared.Containers.ItemSlots
         /// Useful for predicted interactions</param>
         private void Eject(EntityUid uid, ItemSlot slot, EntityUid item, EntityUid? user, bool excludeUserAudio = false)
         {
-            var ejected = slot.ContainerSlot?.Remove(item);
+            bool? ejected = slot.ContainerSlot != null ? _containers.Remove(item, slot.ContainerSlot) : null;
             // ContainerSlot automatically raises a directed EntRemovedFromContainerMessage
 
             // Logging
index 93ef4e421345c7e022aee974a5131b824820f981..9f41ed3b5eb1724584bed5276482a9a5ec0a9013 100644 (file)
@@ -384,7 +384,7 @@ namespace Content.Shared.Cuffs
                 var container = cuffable.Container;
                 var entity = container.ContainedEntities[^1];
 
-                container.Remove(entity);
+                _container.Remove(entity, container);
                 _transform.SetWorldPosition(entity, _transform.GetWorldPosition(owner));
             }
 
@@ -448,7 +448,7 @@ namespace Content.Shared.Cuffs
             // Success!
             _hands.TryDrop(user, handcuff);
 
-            component.Container.Insert(handcuff);
+            _container.Insert(handcuff, component.Container);
             UpdateHeldItems(target, handcuff, component);
             return true;
         }
@@ -634,7 +634,7 @@ namespace Content.Shared.Cuffs
 
             _audio.PlayPredicted(cuff.EndUncuffSound, target, user);
 
-            cuffable.Container.Remove(cuffsToRemove);
+            _container.Remove(cuffsToRemove, cuffable.Container);
 
             if (_net.IsServer)
             {
index 3d406843f5feda17903fc3c0f509cd78775b46e3..a2b788f3f38c981217c124a7316d412940139730 100644 (file)
@@ -17,7 +17,7 @@ public abstract class SharedDevourSystem : EntitySystem
     [Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
     [Dependency] private readonly SharedPopupSystem _popupSystem = default!;
     [Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
-    [Dependency] private readonly SharedContainerSystem _containerSystem = default!;
+    [Dependency] protected readonly SharedContainerSystem ContainerSystem = default!;
 
     public override void Initialize()
     {
@@ -31,7 +31,7 @@ public abstract class SharedDevourSystem : EntitySystem
     {
         //Devourer doesn't actually chew, since he sends targets right into his stomach.
         //I did it mom, I added ERP content into upstream. Legally!
-        component.Stomach = _containerSystem.EnsureContainer<Container>(uid, "stomach");
+        component.Stomach = ContainerSystem.EnsureContainer<Container>(uid, "stomach");
 
         _actionsSystem.AddAction(uid, ref component.DevourActionEntity, component.DevourAction);
     }
index 4e24013a50443823aa150974436928733a4c3914..7d2244fbbbb9b75090f930fc45cd2a5ece2a7970 100644 (file)
@@ -120,7 +120,7 @@ public abstract partial class SharedHandsSystem
 
             if (!isInContainer
                 || !ContainerSystem.TryGetContainingContainer(userXform.ParentUid, uid, out var container, skipExistCheck: true)
-                || !container.Insert(entity, EntityManager, itemXform))
+                || !ContainerSystem.Insert((entity, itemXform), container))
                 TransformSystem.AttachToGridOrMap(entity, itemXform);
             return true;
         }
@@ -148,7 +148,7 @@ public abstract partial class SharedHandsSystem
             return false;
 
         DoDrop(uid, hand, false, handsComp);
-        targetContainer.Insert(entity);
+        ContainerSystem.Insert(entity, targetContainer);
         return true;
     }
 
@@ -189,7 +189,7 @@ public abstract partial class SharedHandsSystem
         if (TerminatingOrDeleted(uid) || TerminatingOrDeleted(entity))
             return;
 
-        if (!hand.Container.Remove(entity, EntityManager))
+        if (!ContainerSystem.Remove(entity, hand.Container))
         {
             Log.Error($"Failed to remove {ToPrettyString(entity)} from users hand container when dropping. User: {ToPrettyString(uid)}. Hand: {hand.Name}.");
             return;
index edba1f98c463377d82ae91871ad1f777307438dc..bbae03e45b3d34d8bbde4fc163fb80619b0019e6 100644 (file)
@@ -217,7 +217,7 @@ public abstract partial class SharedHandsSystem : EntitySystem
         if (handContainer == null || handContainer.ContainedEntity != null)
             return;
 
-        if (!handContainer.Insert(entity, EntityManager))
+        if (!ContainerSystem.Insert(entity, handContainer))
         {
             Log.Error($"Failed to insert {ToPrettyString(entity)} into users hand container when picking up. User: {ToPrettyString(uid)}. Hand: {hand.Name}.");
             return;
index 527ac196b8b988e2a4a15a784a51ae81bf1e7287..f0a1bcb29ccb6562cdbf4b1ecc5c7383416948b2 100644 (file)
@@ -73,7 +73,8 @@ public abstract partial class SharedHandsSystem
 
         handsComp.SortedHands.Remove(hand.Name);
         TryDrop(uid, hand, null, false, true, handsComp);
-        hand.Container?.Shutdown();
+        if (hand.Container != null)
+            ContainerSystem.ShutdownContainer(hand.Container);
 
         if (handsComp.ActiveHand == hand)
             TrySetActiveHand(uid, handsComp.SortedHands.FirstOrDefault(), handsComp);
index 6c8284b9bec7008e7db8984c3cf5950e1567181c..36a31bac1d28a40406527c18e3537914de3c5bdc 100644 (file)
@@ -63,10 +63,11 @@ public abstract class SharedImplanterSystem : EntitySystem
         var implantedComp = EnsureComp<ImplantedComponent>(target);
         var implantContainer = implantedComp.ImplantContainer;
 
-        component.ImplanterSlot.ContainerSlot?.Remove(implant.Value);
+        if (component.ImplanterSlot.ContainerSlot != null)
+            _container.Remove(implant.Value, component.ImplanterSlot.ContainerSlot);
         implantComp.ImplantedEntity = target;
         implantContainer.OccludesLight = false;
-        implantContainer.Insert(implant.Value);
+        _container.Insert(implant.Value, implantContainer);
 
         if (component.CurrentMode == ImplanterToggleMode.Inject && !component.ImplantOnly)
             DrawMode(implanter, component);
@@ -140,9 +141,9 @@ public abstract class SharedImplanterSystem : EntitySystem
                     continue;
                 }
 
-                implantContainer.Remove(implant);
+                _container.Remove(implant, implantContainer);
                 implantComp.ImplantedEntity = null;
-                implanterContainer.Insert(implant);
+                _container.Insert(implant, implanterContainer);
                 permanentFound = implantComp.Permanent;
 
                 var ev = new TransferDnaEvent { Donor = target, Recipient = implanter };
index 2d68f1cdaaa3a824ac8d5dd426db757311f758a8..830d2270aa45b3d54714fcd183eb314030950a07 100644 (file)
@@ -48,7 +48,7 @@ public abstract class SharedSubdermalImplantSystem : EntitySystem
             {
                 if (_tag.HasTag(implant, "MicroBomb"))
                 {
-                    implantContainer.Remove(implant);
+                    _container.Remove(implant, implantContainer);
                     QueueDel(implant);
                 }
             }
@@ -124,7 +124,7 @@ public abstract class SharedSubdermalImplantSystem : EntitySystem
         var implantContainer = implantedComp.ImplantContainer;
 
         component.ImplantedEntity = target;
-        implantContainer.Insert(implant);
+        _container.Insert(implant, implantContainer);
     }
 
     /// <summary>
@@ -140,7 +140,7 @@ public abstract class SharedSubdermalImplantSystem : EntitySystem
 
         var implantContainer = implanted.ImplantContainer;
 
-        implantContainer.Remove(implant);
+        _container.Remove(implant, implantContainer);
         QueueDel(implant);
     }
 
index 456c8373df546622ceb0d615ec875c5bffd88ff6..bad36098c0dc0949a2ac3ebd716a884e7b33f356 100644 (file)
@@ -190,7 +190,7 @@ public abstract partial class InventorySystem
             return false;
         }
 
-        if (!slotContainer.Insert(itemUid))
+        if (!_containerSystem.Insert(itemUid, slotContainer))
         {
             if(!silent && _gameTiming.IsFirstTimePredicted)
                 _popup.PopupCursor(Loc.GetString("inventory-component-can-unequip-cannot"));
@@ -374,7 +374,7 @@ public abstract partial class InventorySystem
             }
         }
 
-        if (!slotContainer.Remove(removedItem.Value, force: force))
+        if (!_containerSystem.Remove(removedItem.Value, slotContainer, force: force))
             return false;
 
         // TODO: Inventory needs a hot cleanup hoo boy
index 31df11fa8b4e0ecedb23e2b0bf9cb4c4e5ba549c..66cb25f530b6081ef7e762480284a08ef78255b7 100644 (file)
@@ -26,7 +26,7 @@ public abstract class SharedMaterialReclaimerSystem : EntitySystem
     [Dependency] protected readonly IGameTiming Timing = default!;
     [Dependency] protected readonly SharedAmbientSoundSystem AmbientSound = default!;
     [Dependency] private readonly SharedAudioSystem _audio = default!;
-    [Dependency] private readonly SharedContainerSystem _container = default!;
+    [Dependency] protected readonly SharedContainerSystem Container = default!;
 
     public const string ActiveReclaimerContainerId = "active-material-reclaimer-container";
 
@@ -79,7 +79,7 @@ public abstract class SharedMaterialReclaimerSystem : EntitySystem
 
     private void OnActiveStartup(EntityUid uid, ActiveMaterialReclaimerComponent component, ComponentStartup args)
     {
-        component.ReclaimingContainer = _container.EnsureContainer<Container>(uid, ActiveReclaimerContainerId);
+        component.ReclaimingContainer = Container.EnsureContainer<Container>(uid, ActiveReclaimerContainerId);
     }
 
     private void OnActiveUnpaused(EntityUid uid, ActiveMaterialReclaimerComponent component, ref EntityUnpausedEvent args)
@@ -107,7 +107,7 @@ public abstract class SharedMaterialReclaimerSystem : EntitySystem
         if (component.Blacklist is {} blacklist && blacklist.IsValid(item))
             return false;
 
-        if (_container.TryGetContainingContainer(item, out _) && !_container.TryRemoveFromContainer(item))
+        if (Container.TryGetContainingContainer(item, out _) && !Container.TryRemoveFromContainer(item))
             return false;
 
         if (user != null)
@@ -133,7 +133,7 @@ public abstract class SharedMaterialReclaimerSystem : EntitySystem
         var active = EnsureComp<ActiveMaterialReclaimerComponent>(uid);
         active.Duration = duration;
         active.EndTime = Timing.CurTime + duration;
-        active.ReclaimingContainer.Insert(item);
+        Container.Insert(item, active.ReclaimingContainer);
         return true;
     }
 
index 23f0ce8a7c25abcc8d473d9bf3954745a3765a43..b4cd625824ed672d437a191f4579b16954d62336 100644 (file)
@@ -220,7 +220,7 @@ public abstract class SharedMechSystem : EntitySystem
             return;
 
         equipmentComponent.EquipmentOwner = uid;
-        component.EquipmentContainer.Insert(toInsert, EntityManager);
+        _container.Insert(toInsert, component.EquipmentContainer);
         var ev = new MechEquipmentInsertedEvent(uid);
         RaiseLocalEvent(toInsert, ref ev);
         UpdateUserInterface(uid, component);
@@ -258,7 +258,7 @@ public abstract class SharedMechSystem : EntitySystem
             CycleEquipment(uid, component);
 
         equipmentComponent.EquipmentOwner = null;
-        component.EquipmentContainer.Remove(toRemove, EntityManager);
+        _container.Remove(toRemove, component.EquipmentContainer);
         UpdateUserInterface(uid, component);
     }
 
@@ -364,7 +364,7 @@ public abstract class SharedMechSystem : EntitySystem
             return false;
 
         SetupUser(uid, toInsert.Value);
-        component.PilotSlot.Insert(toInsert.Value, EntityManager);
+        _container.Insert(toInsert.Value, component.PilotSlot);
         UpdateAppearance(uid, component);
         return true;
     }
index 03577d53ac8dfe5f1223134ef620dda494537023..f6ce235ff74996cb4acf72c95ea41d6a69e416ae 100644 (file)
@@ -76,7 +76,7 @@ public abstract partial class SharedCryoPodSystem: EntitySystem
             return false;
 
         var xform = Transform(target);
-        cryoPodComponent.BodyContainer.Insert(target, transform: xform);
+        _containerSystem.Insert((target, xform), cryoPodComponent.BodyContainer);
 
         EnsureComp<InsideCryoPodComponent>(target);
         _standingStateSystem.Stand(target, force: true); // Force-stand the mob so that the cryo pod sprite overlays it fully
@@ -117,7 +117,7 @@ public abstract partial class SharedCryoPodSystem: EntitySystem
         if (cryoPodComponent.BodyContainer.ContainedEntity is not {Valid: true} contained)
             return null;
 
-        cryoPodComponent.BodyContainer.Remove(contained);
+        _containerSystem.Remove(contained, cryoPodComponent.BodyContainer);
         // InsideCryoPodComponent is removed automatically in its EntGotRemovedFromContainerMessage listener
         // RemComp<InsideCryoPodComponent>(contained);
 
index 31856eefac77d37d00d832a0c9fa6cbf2d366466..746147eb5b4de0ba108fd889571c505001fd8c84 100644 (file)
@@ -134,7 +134,7 @@ public sealed partial class EncryptionKeySystem : EntitySystem
             return;
         }
 
-        if (component.KeyContainer.Insert(args.Used))
+        if (_container.Insert(args.Used, component.KeyContainer))
         {
             _popup.PopupClient(Loc.GetString("encryption-key-successfully-installed"), uid, args.User);
             _audio.PlayPredicted(component.KeyInsertionSound, args.Target, args.User);
index 90bca4d9335e242dc4bb3c5192c8fabe667c3acb..afb1e52881182259569be42a73d38aeea14ff21c 100644 (file)
@@ -138,7 +138,7 @@ public sealed class BinSystem : EntitySystem
         if (component.Whitelist != null && !component.Whitelist.IsValid(toInsert))
             return false;
 
-        component.ItemContainer.Insert(toInsert);
+        _container.Insert(toInsert, component.ItemContainer);
         component.Items.Add(toInsert);
         Dirty(component);
         return true;
@@ -162,7 +162,7 @@ public sealed class BinSystem : EntitySystem
         if (toRemove == null || toRemove != component.Items.LastOrDefault())
             return false;
 
-        if (!component.ItemContainer.Remove(toRemove.Value))
+        if (!_container.Remove(toRemove.Value, component.ItemContainer))
             return false;
 
         component.Items.Remove(toRemove.Value);
index 306f4aeaeedf8ee43e47904748a8d3a46b48ca20..911c6e5380b776e79eb0b43eae35db0c09f8edbd 100644 (file)
@@ -263,7 +263,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
         }
 
         _joints.RecursiveClearJoints(toInsert);
-        if (!component.Contents.Insert(toInsert, EntityManager))
+        if (!_container.Insert(toInsert, component.Contents))
             return false;
 
         var inside = EnsureComp<InsideEntityStorageComponent>(toInsert);
@@ -280,7 +280,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
             return false;
 
         RemComp<InsideEntityStorageComponent>(toRemove);
-        component.Contents.Remove(toRemove, EntityManager);
+        _container.Remove(toRemove, component.Contents);
         var pos = TransformSystem.GetWorldPosition(xform) + TransformSystem.GetWorldRotation(xform).RotateVec(component.EnteringOffset);
         TransformSystem.SetWorldPosition(toRemove, pos);
         return true;
index de664ee53752119bd704c2d93f230effad85ed8b..501d0069a75b76644c6a9841a445184c344dea56 100644 (file)
@@ -48,7 +48,7 @@ public abstract partial class SharedGunSystem
             return;
 
         component.Entities.Add(args.Used);
-        component.Container.Insert(args.Used);
+        Containers.Insert(args.Used, component.Container);
         // Not predicted so
         Audio.PlayPredicted(component.SoundInsert, uid, args.User);
         args.Handled = true;
@@ -241,7 +241,7 @@ public abstract partial class SharedGunSystem
 
                 args.Ammo.Add((entity, EnsureShootable(entity)));
                 component.Entities.RemoveAt(component.Entities.Count - 1);
-                component.Container.Remove(entity);
+                Containers.Remove(entity, component.Container);
             }
             else if (component.UnspawnedCount > 0)
             {
index bd65ef5cf68ceb3ce66f99f27e31bd0f8ae40c1b..7220faa4d2161c1ad21d70150e8e3ab3240dad99 100644 (file)
@@ -290,7 +290,7 @@ public abstract partial class SharedGunSystem
         if (entity == null)
             return false;
 
-        container.Remove(entity.Value);
+        Containers.Remove(entity.Value, container);
         return true;
     }
 
@@ -316,7 +316,7 @@ public abstract partial class SharedGunSystem
     {
         return Containers.TryGetContainer(uid, ChamberSlot, out var container) &&
                container is ContainerSlot slot &&
-               slot.Insert(ammo);
+               Containers.Insert(ammo, slot);
     }
 
     private void OnChamberAmmoCount(EntityUid uid, ChamberMagazineAmmoProviderComponent component, ref GetAmmoCountEvent args)
index d9a7cb53c10813181c84da5413279fa82f5b6c51..27104c9d93f631a7e6a19065f2a1d38d564b70ca 100644 (file)
@@ -28,7 +28,7 @@ public partial class SharedGunSystem
             var ent = container.ContainedEntities[0];
 
             if (_netManager.IsServer)
-                container.Remove(ent);
+                Containers.Remove(ent, container);
 
             args.Ammo.Add((ent, EnsureShootable(ent)));
         }
index f5eb7e87121fee078021bf8ec35d72e35a03192d..d3d3b7fcdea19cbe0a02c7037ac9289168cc7664 100644 (file)
@@ -132,7 +132,7 @@ public partial class SharedGunSystem
                 }
 
                 component.AmmoSlots[index] = ent.Value;
-                component.AmmoContainer.Insert(ent.Value, EntityManager);
+                Containers.Insert(ent.Value, component.AmmoContainer);
 
                 if (ev.Ammo.Count == 0)
                     break;
@@ -160,7 +160,7 @@ public partial class SharedGunSystem
             }
 
             component.AmmoSlots[index] = uid;
-            component.AmmoContainer.Insert(uid);
+            Containers.Insert(uid, component.AmmoContainer);
             Audio.PlayPredicted(component.SoundInsert, revolverUid, user);
             Popup(Loc.GetString("gun-revolver-insert"), revolverUid, user);
             UpdateRevolverAppearance(revolverUid, component);
@@ -283,7 +283,7 @@ public partial class SharedGunSystem
             else
             {
                 component.AmmoSlots[i] = null;
-                component.AmmoContainer.Remove(slot.Value);
+                Containers.Remove(slot.Value, component.AmmoContainer);
 
                 if (!_netManager.IsClient)
                     EjectCartridge(slot.Value);
@@ -366,7 +366,7 @@ public partial class SharedGunSystem
                     continue;
                 }
 
-                component.AmmoContainer.Remove(ent.Value);
+                Containers.Remove(ent.Value, component.AmmoContainer);
                 component.AmmoSlots[index] = null;
                 args.Ammo.Add((ent.Value, EnsureShootable(ent.Value)));
                 TransformSystem.SetCoordinates(ent.Value, args.Coordinates);