Fix being able to store larger or the same size storage containers within another (#172)

This commit is contained in:
clusterfack
2019-03-30 07:56:29 -05:00
committed by Pieter-Jan Briers
parent e381920e86
commit a73c76cd02

View File

@@ -110,12 +110,19 @@ namespace Content.Server.GameObjects
public bool CanInsert(IEntity toinsert) public bool CanInsert(IEntity toinsert)
{ {
_ensureInitialCalculated(); _ensureInitialCalculated();
if (toinsert.TryGetComponent(out ServerStorageComponent storage))
{
if (storage.StorageCapacityMax >= StorageCapacityMax)
return false;
}
if (toinsert.TryGetComponent(out StoreableComponent store)) if (toinsert.TryGetComponent(out StoreableComponent store))
{ {
if (store.ObjectSize <= (StorageCapacityMax - StorageUsed)) if (store.ObjectSize > (StorageCapacityMax - StorageUsed))
return true; return false;
} }
return false; return true;
} }
/// <summary> /// <summary>