diff --git a/Content.Client/Storage/Systems/ItemCounterSystem.cs b/Content.Client/Storage/Systems/ItemCounterSystem.cs index 605f47d3b8..fcb1ca17dc 100644 --- a/Content.Client/Storage/Systems/ItemCounterSystem.cs +++ b/Content.Client/Storage/Systems/ItemCounterSystem.cs @@ -31,7 +31,7 @@ public sealed class ItemCounterSystem : SharedItemCounterSystem if (!_appearanceSystem.TryGetData(uid, StackVisuals.Hide, out var hidden, args.Component)) hidden = false; - + if (comp.IsComposite) ProcessCompositeSprite(uid, actual, maxCount, comp.LayerStates, hidden, sprite: args.Sprite); else diff --git a/Content.Shared/Storage/Components/ItemCounterComponent.cs b/Content.Shared/Storage/Components/ItemCounterComponent.cs index 890bc84e72..6a1444ebf6 100644 --- a/Content.Shared/Storage/Components/ItemCounterComponent.cs +++ b/Content.Shared/Storage/Components/ItemCounterComponent.cs @@ -1,4 +1,4 @@ -using Content.Shared.Storage.EntitySystems; +using Content.Shared.Storage.EntitySystems; using Content.Shared.Whitelist; namespace Content.Shared.Storage.Components diff --git a/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs b/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs index 5c2e0080a6..4bb4192fc4 100644 --- a/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs +++ b/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs @@ -806,7 +806,11 @@ public abstract class SharedStorageSystem : EntitySystem _appearance.SetData(uid, StorageVisuals.Capacity, capacity, appearance); _appearance.SetData(uid, StorageVisuals.Open, isOpen, appearance); _appearance.SetData(uid, SharedBagOpenVisuals.BagState, isOpen ? SharedBagState.Open : SharedBagState.Closed, appearance); - _appearance.SetData(uid, StackVisuals.Hide, !isOpen, appearance); + + // HideClosedStackVisuals true sets the StackVisuals.Hide to the open state of the storage. + // This is for containers that only show their contents when open. (e.g. donut boxes) + if (storage.HideStackVisualsWhenClosed) + _appearance.SetData(uid, StackVisuals.Hide, !isOpen, appearance); } /// diff --git a/Content.Shared/Storage/StorageComponent.cs b/Content.Shared/Storage/StorageComponent.cs index 2860f8dacf..a666169f52 100644 --- a/Content.Shared/Storage/StorageComponent.cs +++ b/Content.Shared/Storage/StorageComponent.cs @@ -123,6 +123,14 @@ namespace Content.Shared.Storage [DataField, ViewVariables(VVAccess.ReadWrite)] public StorageDefaultOrientation? DefaultStorageOrientation; + /// + /// If true, sets StackVisuals.Hide to true when the container is closed + /// Used in cases where there are sprites that are shown when the container is open but not + /// when it is closed + /// + [DataField] + public bool HideStackVisualsWhenClosed = true; + [Serializable, NetSerializable] public enum StorageUiKey : byte { diff --git a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_cans.yml b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_cans.yml index f5cb260e03..b6488dbe8b 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_cans.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_cans.yml @@ -432,6 +432,7 @@ whitelist: tags: - Cola + hideStackVisualsWhenClosed: false - type: StorageFill contents: - id: DrinkColaCan