Separate "thank you" messages from general ads (#25867)

* Separated "thank you" messages from general ads

* Moved MessagePackPrototype to shared, cleaned up AdvertiseComponent, and actually killed AdvertisementsPackPrototype.
+More suggests changes.

* Rename PackPrototypeID to Pack in both components.
This commit is contained in:
Tayrtahn
2024-03-28 02:46:26 -04:00
committed by GitHub
parent 29f34d8423
commit 794a447bb7
72 changed files with 603 additions and 470 deletions

View File

@@ -0,0 +1,45 @@
using Content.Server.Advertise.EntitySystems;
using Content.Shared.Advertise;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.Advertise.Components;
/// <summary>
/// Makes this entity periodically advertise by speaking a randomly selected
/// message from a specified MessagePack into local chat.
/// </summary>
[RegisterComponent, Access(typeof(AdvertiseSystem))]
public sealed partial class AdvertiseComponent : Component
{
/// <summary>
/// Minimum time in seconds to wait before saying a new ad, in seconds. Has to be larger than or equal to 1.
/// </summary>
[DataField]
public int MinimumWait { get; private set; } = 8 * 60;
/// <summary>
/// Maximum time in seconds to wait before saying a new ad, in seconds. Has to be larger than or equal
/// to <see cref="MinimumWait"/>
/// </summary>
[DataField]
public int MaximumWait { get; private set; } = 10 * 60;
/// <summary>
/// The identifier for the advertisements pack prototype.
/// </summary>
[DataField(required: true)]
public ProtoId<MessagePackPrototype> Pack { get; private set; }
/// <summary>
/// The next time an advertisement will be said.
/// </summary>
[DataField]
public TimeSpan NextAdvertisementTime { get; set; } = TimeSpan.Zero;
/// <summary>
/// Whether the entity will say advertisements or not.
/// </summary>
[DataField]
public bool Enabled { get; set; } = true;
}