Files
tbd-station-14/Content.Shared/Advertise/Components/SpeakOnUIClosedComponent.cs
2025-03-02 13:47:52 +11:00

39 lines
1.3 KiB
C#

using Content.Shared.Advertise.Systems;
using Content.Shared.Dataset;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
namespace Content.Shared.Advertise.Components;
/// <summary>
/// Causes the entity to speak using the Chat system when its ActivatableUI is closed, optionally
/// requiring that a Flag be set as well.
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, Access(typeof(SharedSpeakOnUIClosedSystem))]
public sealed partial class SpeakOnUIClosedComponent : Component
{
/// <summary>
/// The identifier for the dataset prototype containing messages to be spoken by this entity.
/// </summary>
[DataField(required: true)]
public ProtoId<LocalizedDatasetPrototype> Pack { get; private set; }
/// <summary>
/// Is this component active? If false, no messages will be spoken.
/// </summary>
[DataField]
public bool Enabled = true;
/// <summary>
/// Should messages be spoken only if the <see cref="Flag"/> is set (true), or every time the UI is closed (false)?
/// </summary>
[DataField]
public bool RequireFlag = true;
/// <summary>
/// State variable only used if <see cref="RequireFlag"/> is true. Set with <see cref="SpeakOnUIClosedSystem.TrySetFlag"/>.
/// </summary>
[DataField, AutoNetworkedField]
public bool Flag;
}