Reordered item insertion checks (#11822)

This commit is contained in:
Rapidgame7
2022-10-10 19:19:58 -03:00
committed by GitHub
parent 76bd5e93b4
commit cfeabc9731

View File

@@ -522,17 +522,9 @@ namespace Content.Server.Storage.EntitySystems
return false; return false;
} }
if (TryComp(insertEnt, out ServerStorageComponent? storage) && if (TryComp(insertEnt, out TransformComponent? transformComp) && transformComp.Anchored)
storage.StorageCapacityMax >= storageComp.StorageCapacityMax)
{ {
reason = "comp-storage-insufficient-capacity"; reason = "comp-storage-anchored-failure";
return false;
}
if (TryComp(insertEnt, out ItemComponent? itemComp) &&
itemComp.Size > storageComp.StorageCapacityMax - storageComp.StorageUsed)
{
reason = "comp-storage-insufficient-capacity";
return false; return false;
} }
@@ -548,9 +540,17 @@ namespace Content.Server.Storage.EntitySystems
return false; return false;
} }
if (TryComp(insertEnt, out TransformComponent? transformComp) && transformComp.Anchored) if (TryComp(insertEnt, out ServerStorageComponent? storage) &&
storage.StorageCapacityMax >= storageComp.StorageCapacityMax)
{ {
reason = "comp-storage-anchored-failure"; reason = "comp-storage-insufficient-capacity";
return false;
}
if (TryComp(insertEnt, out ItemComponent? itemComp) &&
itemComp.Size > storageComp.StorageCapacityMax - storageComp.StorageUsed)
{
reason = "comp-storage-insufficient-capacity";
return false; return false;
} }