Predict vending machine UI (#33412)

This commit is contained in:
metalgearsloth
2025-03-02 13:47:52 +11:00
committed by GitHub
parent ba1504d0d6
commit a8ebcac5c9
15 changed files with 542 additions and 318 deletions

View File

@@ -0,0 +1,38 @@
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;
}