forked from space-wizards/space-station-14
-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate "thank you" messages from general ads (space-wizards#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.
- Loading branch information
Showing
72 changed files
with
603 additions
and
470 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
36 changes: 36 additions & 0 deletions
36
Content.Server/Advertise/Components/SpeakOnUIClosedComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using Content.Shared.Advertise; | ||
using Robust.Shared.Prototypes; | ||
|
||
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(required: true)] | ||
public ProtoId<MessagePackPrototype> Pack { get; private set; } | ||
|
||
/// <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; | ||
} |
Oops, something went wrong.