Files
tbd-station-14/Content.Shared/Nutrition/Components/OpenableComponent.cs
Princess Cheeseballs 91854e0776 Debody Food and Drink Systems, Combine Food and Drink into One System. (#39031)
* Shelve

* 22 file diff

* What if it was just better

* Hold that thought

* Near final Commit, then YAML hell

* 95% done with cs

* Working Commit

* Final Commit (Before reviews tear it apart and kill me)

* Add a really stupid comment.

* KILL

* EXPLODE TEST FAILS WITH MY MIND

* I hate it here

* TACTICAL NUCLEAR STRIKE

* Wait what the fuck was I doing?

* Comments

* Me when I'm stupid

* Food doesn't need solutions

* API improvements with some API weirdness

* Move non-API out of API

* Better comment

* Fixes and spelling mistakes

* Final fixes

* Final fixes for real...

* Kill food and drink localization files because I hate them.

* Water droplet fix

* Utensil fixes

* Fix verb priority (It should've been 2)

* A few minor localization fixes

* merge conflict and stuff

* MERGE CONFLICT NUCLEAR WAR!!!

* Cleanup

---------

Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
2025-08-06 12:53:38 -04:00

81 lines
2.6 KiB
C#

using Content.Shared.Nutrition.EntitySystems;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
namespace Content.Shared.Nutrition.Components;
/// <summary>
/// A drink or food that can be opened.
/// Starts closed, open it with Z or E.
/// </summary>
[NetworkedComponent, AutoGenerateComponentState]
[RegisterComponent, Access(typeof(OpenableSystem))]
public sealed partial class OpenableComponent : Component
{
/// <summary>
/// Whether this drink or food is opened or not.
/// Drinks can only be drunk or poured from/into when open, and food can only be eaten when open.
/// </summary>
[DataField, AutoNetworkedField]
public bool Opened;
/// <summary>
/// If this is false you cant press Z to open it.
/// Requires an OpenBehavior damage threshold or other logic to open.
/// </summary>
[DataField, AutoNetworkedField]
public bool OpenableByHand = true;
/// <summary>
/// If true, tries to open when activated in world.
/// </summary>
[DataField, AutoNetworkedField]
public bool OpenOnActivate;
/// <summary>
/// Text shown when examining and its open.
/// </summary>
[DataField]
public LocId ExamineText = "openable-component-on-examine-is-opened";
/// <summary>
/// The locale id for the popup shown when IsClosed is called and closed. Needs a "owner" entity argument passed to it.
/// Defaults to the popup drink uses since its "correct".
/// It's still generic enough that you should change it if you make openable non-drinks, i.e. unwrap it first, peel it first.
/// </summary>
[DataField]
public LocId ClosedPopup = "openable-component-try-use-closed";
/// <summary>
/// Text to show in the verb menu for the "Open" action.
/// You may want to change this for non-drinks, i.e. "Peel", "Unwrap"
/// </summary>
[DataField]
public LocId OpenVerbText = "openable-component-verb-open";
/// <summary>
/// Text to show in the verb menu for the "Close" action.
/// You may want to change this for non-drinks, i.e. "Wrap"
/// </summary>
[DataField]
public LocId CloseVerbText = "openable-component-verb-close";
/// <summary>
/// Sound played when opening.
/// </summary>
[DataField]
public SoundSpecifier? Sound = new SoundCollectionSpecifier("canOpenSounds");
/// <summary>
/// Can this item be closed again after opening?
/// </summary>
[DataField, AutoNetworkedField]
public bool Closeable;
/// <summary>
/// Sound played when closing.
/// </summary>
[DataField]
public SoundSpecifier? CloseSound;
}