using Content.Shared.Containers.ItemSlots; using Robust.Shared.Audio; using Robust.Shared.GameStates; using Robust.Shared.Serialization; namespace Content.Shared.Cabinet; /// /// Used for entities that can be opened, closed, and can hold one item. E.g., fire extinguisher cabinets. /// [RegisterComponent, NetworkedComponent] public sealed class ItemCabinetComponent : Component { /// /// Sound to be played when the cabinet door is opened. /// [DataField("doorSound"), ViewVariables(VVAccess.ReadWrite)] public SoundSpecifier? DoorSound; /// /// The that stores the actual item. The entity whitelist, sounds, and other /// behaviours are specified by this definition. /// [DataField("cabinetSlot"), ViewVariables] public ItemSlot CabinetSlot = new(); /// /// Whether the cabinet is currently open or not. /// [DataField("opened")] public bool Opened; /// /// The state for when the cabinet is open /// [DataField("openState"), ViewVariables(VVAccess.ReadWrite)] public string? OpenState; /// /// The state for when the cabinet is closed /// [DataField("closedState"), ViewVariables(VVAccess.ReadWrite)] public string? ClosedState; } [Serializable, NetSerializable] public sealed class ItemCabinetComponentState : ComponentState { public SoundSpecifier? DoorSound; public bool Opened; public string? OpenState; public string? ClosedState; public ItemCabinetComponentState(SoundSpecifier? doorSound, bool opened, string? openState, string? closedState) { DoorSound = doorSound; Opened = opened; OpenState = openState; ClosedState = closedState; } }