SpeakOnUIClosedComponent.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using Content.Shared.Advertise.Systems;
  2. using Content.Shared.Dataset;
  3. using Robust.Shared.GameStates;
  4. using Robust.Shared.Prototypes;
  5. namespace Content.Shared.Advertise.Components;
  6. /// <summary>
  7. /// Causes the entity to speak using the Chat system when its ActivatableUI is closed, optionally
  8. /// requiring that a Flag be set as well.
  9. /// </summary>
  10. [RegisterComponent, NetworkedComponent, AutoGenerateComponentState, Access(typeof(SharedSpeakOnUIClosedSystem))]
  11. public sealed partial class SpeakOnUIClosedComponent : Component
  12. {
  13. /// <summary>
  14. /// The identifier for the dataset prototype containing messages to be spoken by this entity.
  15. /// </summary>
  16. [DataField(required: true)]
  17. public ProtoId<LocalizedDatasetPrototype> Pack { get; private set; }
  18. /// <summary>
  19. /// Is this component active? If false, no messages will be spoken.
  20. /// </summary>
  21. [DataField]
  22. public bool Enabled = true;
  23. /// <summary>
  24. /// Should messages be spoken only if the <see cref="Flag"/> is set (true), or every time the UI is closed (false)?
  25. /// </summary>
  26. [DataField]
  27. public bool RequireFlag = true;
  28. /// <summary>
  29. /// State variable only used if <see cref="RequireFlag"/> is true. Set with <see cref="SpeakOnUIClosedSystem.TrySetFlag"/>.
  30. /// </summary>
  31. [DataField, AutoNetworkedField]
  32. public bool Flag;
  33. }