Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate "thank you" messages from general ads #25867

Merged
merged 4 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Content.Client/Entry/EntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public override void Init()
_prototypeManager.RegisterIgnore("gameMapPool");
_prototypeManager.RegisterIgnore("npcFaction");
_prototypeManager.RegisterIgnore("lobbyBackground");
_prototypeManager.RegisterIgnore("messagePack");
Tayrtahn marked this conversation as resolved.
Show resolved Hide resolved
_prototypeManager.RegisterIgnore("advertisementsPack");
_prototypeManager.RegisterIgnore("gamePreset");
_prototypeManager.RegisterIgnore("noiseChannel");
Expand Down
42 changes: 0 additions & 42 deletions Content.Server/Advertise/AdvertiseComponent.cs

This file was deleted.

154 changes: 0 additions & 154 deletions Content.Server/Advertise/AdvertiseSystem.cs

This file was deleted.

10 changes: 10 additions & 0 deletions Content.Server/Advertise/AdvertisementsPackPrototype.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Robust.Shared.Prototypes;

namespace Content.Server.Advertise;

[Serializable, Prototype("advertisementsPack")]
public sealed partial class AdvertisementsPackPrototype : MessagePackPrototype
{
[Obsolete("Convert to MessagePack")]
public List<string> Advertisements => Messages;
}
39 changes: 39 additions & 0 deletions Content.Server/Advertise/Components/AdvertiseComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using Content.Server.Advertise.EntitySystems;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;

namespace Content.Server.Advertise.Components;

[RegisterComponent, Access(typeof(AdvertiseSystem))]
public sealed partial class AdvertiseComponent : Component
Tayrtahn marked this conversation as resolved.
Show resolved Hide resolved
{
/// <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("minWait")]
Tayrtahn marked this conversation as resolved.
Show resolved Hide resolved
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("maxWait")]
public int MaximumWait { get; private set; } = 10 * 60;

/// <summary>
/// The identifier for the advertisements pack prototype.
/// </summary>
[DataField("pack", customTypeSerializer: typeof(PrototypeIdSerializer<MessagePackPrototype>), required: true)]
public string PackPrototypeId { get; private set; } = string.Empty;
Tayrtahn marked this conversation as resolved.
Show resolved Hide resolved

/// <summary>
/// The next time an advertisement will be said.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public TimeSpan NextAdvertisementTime { get; set; } = TimeSpan.Zero;

/// <summary>
/// Whether the entity will say advertisements or not.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public bool Enabled { get; set; } = true;
Tayrtahn marked this conversation as resolved.
Show resolved Hide resolved
}
35 changes: 35 additions & 0 deletions Content.Server/Advertise/Components/SpeakOnUIClosedComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;

namespace Content.Server.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, Access(typeof(SpeakOnUIClosedSystem))]
public sealed partial class SpeakOnUIClosedComponent : Component
{
/// <summary>
/// The identifier for the message pack prototype containing messages to be spoken by this entity.
/// </summary>
[DataField("pack", customTypeSerializer: typeof(PrototypeIdSerializer<MessagePackPrototype>), required: true)]
public string PackPrototypeId { get; private set; } = string.Empty;
Tayrtahn marked this conversation as resolved.
Show resolved Hide resolved

/// <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]
public bool Flag;
}
Loading
Loading