Add ability to show stack visuals on closed containers (#29309)
* add ability to show stack visuals on closed containers * remove container stack visuals logic from sharedstoragesystem * improve comments a bit * move logic for open/closed containers into itemcountersystem * move behavior to storage component * remove unused import * remove old comment * fix comments * fix wrong property name * Update Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs * Rename variable for clarity --------- Co-authored-by: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
using Content.Shared.Storage.EntitySystems;
|
using Content.Shared.Storage.EntitySystems;
|
||||||
using Content.Shared.Whitelist;
|
using Content.Shared.Whitelist;
|
||||||
|
|
||||||
namespace Content.Shared.Storage.Components
|
namespace Content.Shared.Storage.Components
|
||||||
|
|||||||
@@ -806,6 +806,10 @@ public abstract class SharedStorageSystem : EntitySystem
|
|||||||
_appearance.SetData(uid, StorageVisuals.Capacity, capacity, appearance);
|
_appearance.SetData(uid, StorageVisuals.Capacity, capacity, appearance);
|
||||||
_appearance.SetData(uid, StorageVisuals.Open, isOpen, appearance);
|
_appearance.SetData(uid, StorageVisuals.Open, isOpen, appearance);
|
||||||
_appearance.SetData(uid, SharedBagOpenVisuals.BagState, isOpen ? SharedBagState.Open : SharedBagState.Closed, appearance);
|
_appearance.SetData(uid, SharedBagOpenVisuals.BagState, isOpen ? SharedBagState.Open : SharedBagState.Closed, 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);
|
_appearance.SetData(uid, StackVisuals.Hide, !isOpen, appearance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -123,6 +123,14 @@ namespace Content.Shared.Storage
|
|||||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||||
public StorageDefaultOrientation? DefaultStorageOrientation;
|
public StorageDefaultOrientation? DefaultStorageOrientation;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 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
|
||||||
|
/// </summary>
|
||||||
|
[DataField]
|
||||||
|
public bool HideStackVisualsWhenClosed = true;
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
public enum StorageUiKey : byte
|
public enum StorageUiKey : byte
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -432,6 +432,7 @@
|
|||||||
whitelist:
|
whitelist:
|
||||||
tags:
|
tags:
|
||||||
- Cola
|
- Cola
|
||||||
|
hideStackVisualsWhenClosed: false
|
||||||
- type: StorageFill
|
- type: StorageFill
|
||||||
contents:
|
contents:
|
||||||
- id: DrinkColaCan
|
- id: DrinkColaCan
|
||||||
|
|||||||
Reference in New Issue
Block a user