SpookySpeakerComponent.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using Content.Shared.Dataset;
  2. using Robust.Shared.Prototypes;
  3. namespace Content.Server.Ghost.Components;
  4. /// <summary>
  5. /// Causes this entity to react to ghost player using the "Boo!" action by speaking
  6. /// a randomly chosen message from a specified set.
  7. /// </summary>
  8. [RegisterComponent, AutoGenerateComponentPause]
  9. public sealed partial class SpookySpeakerComponent : Component
  10. {
  11. /// <summary>
  12. /// ProtoId of the LocalizedDataset to use for messages.
  13. /// </summary>
  14. [DataField(required: true)]
  15. public ProtoId<LocalizedDatasetPrototype> MessageSet;
  16. /// <summary>
  17. /// Probability that this entity will speak if activated by a Boo action.
  18. /// This is so whole banks of entities don't trigger at the same time.
  19. /// </summary>
  20. [DataField]
  21. public float SpeakChance = 0.5f;
  22. /// <summary>
  23. /// Minimum time that must pass after speaking before this entity can speak again.
  24. /// </summary>
  25. [DataField]
  26. public TimeSpan Cooldown = TimeSpan.FromSeconds(30);
  27. /// <summary>
  28. /// Time when the cooldown will have elapsed and the entity can speak again.
  29. /// </summary>
  30. [DataField, AutoPausedField]
  31. public TimeSpan NextSpeakTime;
  32. }