From a73c76cd0269669a1bc8304fa63cde7eafb517a0 Mon Sep 17 00:00:00 2001 From: clusterfack <8516830+clusterfack@users.noreply.github.com> Date: Sat, 30 Mar 2019 07:56:29 -0500 Subject: [PATCH] Fix being able to store larger or the same size storage containers within another (#172) --- .../Items/Storage/ServerStorageComponent.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs index ac93415baa..bc31cad845 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs @@ -110,12 +110,19 @@ namespace Content.Server.GameObjects public bool CanInsert(IEntity toinsert) { _ensureInitialCalculated(); + + if (toinsert.TryGetComponent(out ServerStorageComponent storage)) + { + if (storage.StorageCapacityMax >= StorageCapacityMax) + return false; + } + if (toinsert.TryGetComponent(out StoreableComponent store)) { - if (store.ObjectSize <= (StorageCapacityMax - StorageUsed)) - return true; + if (store.ObjectSize > (StorageCapacityMax - StorageUsed)) + return false; } - return false; + return true; } ///