1
0

AdvertiseComponent.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using Content.Server.Advertise.EntitySystems;
  2. using Content.Shared.Dataset;
  3. using Robust.Shared.Prototypes;
  4. namespace Content.Server.Advertise.Components;
  5. /// <summary>
  6. /// Makes this entity periodically advertise by speaking a randomly selected
  7. /// message from a specified dataset into local chat.
  8. /// </summary>
  9. [RegisterComponent, Access(typeof(AdvertiseSystem))]
  10. public sealed partial class AdvertiseComponent : Component
  11. {
  12. /// <summary>
  13. /// Minimum time in seconds to wait before saying a new ad, in seconds. Has to be larger than or equal to 1.
  14. /// </summary>
  15. [DataField]
  16. public int MinimumWait { get; private set; } = 8 * 60;
  17. /// <summary>
  18. /// Maximum time in seconds to wait before saying a new ad, in seconds. Has to be larger than or equal
  19. /// to <see cref="MinimumWait"/>
  20. /// </summary>
  21. [DataField]
  22. public int MaximumWait { get; private set; } = 10 * 60;
  23. /// <summary>
  24. /// If true, the delay before the first advertisement (at MapInit) will ignore <see cref="MinimumWait"/>
  25. /// and instead be rolled between 0 and <see cref="MaximumWait"/>. This only applies to the initial delay;
  26. /// <see cref="MinimumWait"/> will be respected after that.
  27. /// </summary>
  28. [DataField]
  29. public bool Prewarm = true;
  30. /// <summary>
  31. /// The identifier for the advertisements dataset prototype.
  32. /// </summary>
  33. [DataField(required: true)]
  34. public ProtoId<LocalizedDatasetPrototype> Pack { get; private set; }
  35. /// <summary>
  36. /// The next time an advertisement will be said.
  37. /// </summary>
  38. [DataField]
  39. public TimeSpan NextAdvertisementTime { get; set; } = TimeSpan.Zero;
  40. }