diff --git a/Content.IntegrationTests/Tests/StorageFillTest.cs b/Content.IntegrationTests/Tests/StorageTest.cs similarity index 51% rename from Content.IntegrationTests/Tests/StorageFillTest.cs rename to Content.IntegrationTests/Tests/StorageTest.cs index 1f2f4c4c60..21b5e7c40a 100644 --- a/Content.IntegrationTests/Tests/StorageFillTest.cs +++ b/Content.IntegrationTests/Tests/StorageTest.cs @@ -1,14 +1,42 @@ #nullable enable using System.Threading.Tasks; using Content.Server.Storage.Components; +using Content.Shared.Item; +using Content.Shared.Storage; using NUnit.Framework; using Robust.Shared.Prototypes; namespace Content.IntegrationTests.Tests { [TestFixture] - public sealed class StorageFillTest + public sealed class StorageTest { + /// + /// Can an item store more than itself weighs. + /// In an ideal world this test wouldn't need to exist because sizes would be recursive. + /// + [Test] + public async Task StorageSizeArbitrageTest() + { + await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true}); + var server = pairTracker.Pair.Server; + + var protoManager = server.ResolveDependency(); + + await server.WaitAssertion(() => + { + foreach (var proto in protoManager.EnumeratePrototypes()) + { + if (!proto.TryGetComponent("Storage", out var storage) || + storage.Whitelist != null || + !proto.TryGetComponent("Item", out var item)) continue; + + Assert.That(storage.StorageCapacityMax, Is.LessThanOrEqualTo(item.Size), $"Found storage arbitrage on {proto.ID}"); + } + }); + await pairTracker.CleanReturnAsync(); + } + [Test] public async Task TestStorageFillPrototypes() { diff --git a/Resources/Prototypes/Entities/Clothing/Back/backpacks.yml b/Resources/Prototypes/Entities/Clothing/Back/backpacks.yml index 335a994a3a..83a8424a8f 100644 --- a/Resources/Prototypes/Entities/Clothing/Back/backpacks.yml +++ b/Resources/Prototypes/Entities/Clothing/Back/backpacks.yml @@ -191,4 +191,4 @@ - type: Clothing equippedPrefix: holding - type: Storage - capacity: 10000 + capacity: 9999 diff --git a/Resources/Prototypes/Entities/Clothing/Back/duffel.yml b/Resources/Prototypes/Entities/Clothing/Back/duffel.yml index 17d09be0f7..8b2d360306 100644 --- a/Resources/Prototypes/Entities/Clothing/Back/duffel.yml +++ b/Resources/Prototypes/Entities/Clothing/Back/duffel.yml @@ -157,4 +157,4 @@ - state: icon-unlit shader: unshaded - type: Storage - capacity: 10000 + capacity: 9999 diff --git a/Resources/Prototypes/Entities/Clothing/Back/satchel.yml b/Resources/Prototypes/Entities/Clothing/Back/satchel.yml index 5abef34c03..9c3417cdf9 100644 --- a/Resources/Prototypes/Entities/Clothing/Back/satchel.yml +++ b/Resources/Prototypes/Entities/Clothing/Back/satchel.yml @@ -101,4 +101,4 @@ - state: icon-unlit shader: unshaded - type: Storage - capacity: 10000 + capacity: 9999 diff --git a/Resources/Prototypes/Entities/Clothing/Belt/belts.yml b/Resources/Prototypes/Entities/Clothing/Belt/belts.yml index 8db353aa63..95d2674b91 100644 --- a/Resources/Prototypes/Entities/Clothing/Belt/belts.yml +++ b/Resources/Prototypes/Entities/Clothing/Belt/belts.yml @@ -391,6 +391,8 @@ sprite: Clothing/Belt/bandolier.rsi - type: Clothing sprite: Clothing/Belt/bandolier.rsi + - type: Item + size: 60 - type: Storage capacity: 60 whitelist: @@ -432,6 +434,8 @@ sprite: Clothing/Belt/syndieholster.rsi - type: Clothing sprite: Clothing/Belt/syndieholster.rsi + - type: Item + size: 60 - type: Storage capacity: 60 whitelist: @@ -473,6 +477,8 @@ sprite: Clothing/Belt/militarywebbingmed.rsi - type: Clothing sprite: Clothing/Belt/militarywebbingmed.rsi + - type: Item + size: 60 - type: Storage capacity: 60 diff --git a/Resources/Prototypes/Entities/Clothing/OuterClothing/base_clothingouter.yml b/Resources/Prototypes/Entities/Clothing/OuterClothing/base_clothingouter.yml index a577a9168a..2c0079d502 100644 --- a/Resources/Prototypes/Entities/Clothing/OuterClothing/base_clothingouter.yml +++ b/Resources/Prototypes/Entities/Clothing/OuterClothing/base_clothingouter.yml @@ -28,6 +28,8 @@ parent: ClothingOuterBase id: ClothingOuterStorageBase components: + - type: Item + size: 10 - type: Storage capacity: 10 - type: ContainerContainer diff --git a/Resources/Prototypes/Entities/Objects/Tools/matches.yml b/Resources/Prototypes/Entities/Objects/Tools/matches.yml index c5888f8f3b..78e593799a 100644 --- a/Resources/Prototypes/Entities/Objects/Tools/matches.yml +++ b/Resources/Prototypes/Entities/Objects/Tools/matches.yml @@ -62,6 +62,7 @@ - type: Item sprite: Objects/Tools/matches.rsi heldPrefix: matchbox + size: 10 - type: StorageFill contents: - id: Matchstick