CatStation/Content.Shared/Storage/Components/SecretStashComponent.cs
Samuka 75239a2402
Fix matryoshka cake slice trick (#44969)
* yml changes

* recursive code

* use the recursive stuff

* fix

* use enum

* remove blank line

Co-authored-by: Pok <113675512+Pok27@users.noreply.github.com>

* remove code

* datafield removed

* add size proto

* rename to Plushie

* rename to cake

* cake size protos

* remove size protos

* ensure size smaller

* use map init and log error

* this is automatic now

* this is automatic now

* send to the client

* upgrade to error again

* update proto to avoid tiny items with secret stash

* ops

* add size to toilet

* update plushie protos to remove secret stash from ian

* ops, forgot to remove these lines

* remove datafield tag

Co-authored-by: Whatstone <166147148+whatston3@users.noreply.github.com>

* use WasModified

Co-authored-by: Whatstone <166147148+whatston3@users.noreply.github.com>

* review

* Update SecretStashComponent.cs

---------

Co-authored-by: Pok <113675512+Pok27@users.noreply.github.com>
Co-authored-by: Whatstone <166147148+whatston3@users.noreply.github.com>
2026-09-24 12:39:43 +00:00

77 lines
2.7 KiB
C#

using Content.Shared.Storage.EntitySystems;
using Content.Shared.Containers.ItemSlots;
using Content.Shared.Item;
using Robust.Shared.Containers;
using Robust.Shared.Prototypes;
using Content.Shared.Tools;
using Robust.Shared.GameStates;
using Content.Shared.DoAfter;
using Robust.Shared.Serialization;
using Robust.Shared.Audio;
using Content.Shared.Whitelist;
using Content.Shared.Damage;
namespace Content.Shared.Storage.Components
{
/// <summary>
/// Logic for a secret slot stash, like plant pot or toilet cistern.
/// Unlike <see cref="ItemSlotsComponent"/> it has logic for opening and closing
/// the stash.
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
[Access(typeof(SecretStashSystem))]
public sealed partial class SecretStashComponent : Component
{
/// <summary>
/// Max item size that can be inserted into secret stash.
/// If null, uses one size smaller than the stash's <see cref="ItemComponent"/> size.
/// </summary>
[DataField]
public ProtoId<ItemSizePrototype>? MaxItemSize;
/// <summary>
/// Entity blacklist for secret stashes.
/// </summary>
[DataField]
public EntityWhitelist? Blacklist;
/// <summary>
/// This sound will be played when you try to insert an item in the stash.
/// The sound will be played whether or not the item is actually inserted.
/// </summary>
[DataField]
public SoundSpecifier? TryInsertItemSound;
/// <summary>
/// This sound will be played when you try to remove an item in the stash.
/// The sound will be played whether or not the item is actually removed.
/// </summary>
[DataField]
public SoundSpecifier? TryRemoveItemSound;
/// <summary>
/// If true, verbs will appear to help interact with the stash.
/// </summary>
[DataField, AutoNetworkedField]
public bool HasVerbs = true;
/// <summary>
/// The name of the secret stash. For example "the toilet cistern".
/// If null, the name of the entity will be used instead.
/// </summary>
[DataField]
public string? SecretStashName;
/// <summary>
/// How much damage is delt to something after eating a secret stash that contains an item.
/// </summary>
[DataField]
public DamageSpecifier? DamageEatenItemInside;
/// <summary>
/// Container used to keep secret stash item.
/// </summary>
[ViewVariables]
public ContainerSlot ItemContainer = default!;
}
}