Split `ReplacementAccentPrototype and ReplacementAccentComponent` in different files (#35107)
* Split ReplacementAccentPrototype and ReplacementAccentComponent * Fixes * Fixes * inheritdoc
This commit is contained in:
@@ -6,7 +6,7 @@ using Content.Server.Administration.Managers;
|
|||||||
using Content.Server.Chat.Managers;
|
using Content.Server.Chat.Managers;
|
||||||
using Content.Server.GameTicking;
|
using Content.Server.GameTicking;
|
||||||
using Content.Server.Players.RateLimiting;
|
using Content.Server.Players.RateLimiting;
|
||||||
using Content.Server.Speech.Components;
|
using Content.Server.Speech.Prototypes;
|
||||||
using Content.Server.Speech.EntitySystems;
|
using Content.Server.Speech.EntitySystems;
|
||||||
using Content.Server.Station.Components;
|
using Content.Server.Station.Components;
|
||||||
using Content.Server.Station.Systems;
|
using Content.Server.Station.Systems;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
using Content.Server.Speech.Prototypes;
|
||||||
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||||
|
|
||||||
namespace Content.Server.Speech.Components;
|
namespace Content.Server.Speech.Components;
|
||||||
|
|
||||||
|
|||||||
@@ -1,34 +1,7 @@
|
|||||||
using Robust.Shared.Prototypes;
|
using Content.Server.Speech.Prototypes;
|
||||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||||
|
|
||||||
namespace Content.Server.Speech.Components
|
namespace Content.Server.Speech.Components;
|
||||||
{
|
|
||||||
[Prototype("accent")]
|
|
||||||
public sealed partial class ReplacementAccentPrototype : IPrototype
|
|
||||||
{
|
|
||||||
[ViewVariables]
|
|
||||||
[IdDataField]
|
|
||||||
public string ID { get; private set; } = default!;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// If this array is non-null, the full text of anything said will be randomly replaced with one of these words.
|
|
||||||
/// </summary>
|
|
||||||
[DataField("fullReplacements")]
|
|
||||||
public string[]? FullReplacements;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// If this dictionary is non-null and <see cref="FullReplacements"/> is null, any keys surrounded by spaces
|
|
||||||
/// (words) will be replaced by the value, attempting to intelligently keep capitalization.
|
|
||||||
/// </summary>
|
|
||||||
[DataField("wordReplacements")]
|
|
||||||
public Dictionary<string, string>? WordReplacements;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Allows you to substitute words, not always, but with some chance
|
|
||||||
/// </summary>
|
|
||||||
[DataField]
|
|
||||||
public float ReplacementChance = 1f;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Replaces full sentences or words within sentences with new strings.
|
/// Replaces full sentences or words within sentences with new strings.
|
||||||
@@ -36,8 +9,7 @@ namespace Content.Server.Speech.Components
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public sealed partial class ReplacementAccentComponent : Component
|
public sealed partial class ReplacementAccentComponent : Component
|
||||||
{
|
{
|
||||||
[DataField("accent", customTypeSerializer: typeof(PrototypeIdSerializer<ReplacementAccentPrototype>), required: true)]
|
[DataField(customTypeSerializer: typeof(PrototypeIdSerializer<ReplacementAccentPrototype>), required: true)]
|
||||||
public string Accent = default!;
|
public string Accent = default!;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Content.Server.Speech.Components;
|
using Content.Server.Speech.Components;
|
||||||
|
using Content.Server.Speech.Prototypes;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
|
namespace Content.Server.Speech.Prototypes;
|
||||||
|
|
||||||
|
[Prototype("accent")]
|
||||||
|
public sealed partial class ReplacementAccentPrototype : IPrototype
|
||||||
|
{
|
||||||
|
/// <inheritdoc/>
|
||||||
|
[ViewVariables]
|
||||||
|
[IdDataField]
|
||||||
|
public string ID { get; private set; } = default!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If this array is non-null, the full text of anything said will be randomly replaced with one of these words.
|
||||||
|
/// </summary>
|
||||||
|
[DataField]
|
||||||
|
public string[]? FullReplacements;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If this dictionary is non-null and <see cref="FullReplacements"/> is null, any keys surrounded by spaces
|
||||||
|
/// (words) will be replaced by the value, attempting to intelligently keep capitalization.
|
||||||
|
/// </summary>
|
||||||
|
[DataField]
|
||||||
|
public Dictionary<string, string>? WordReplacements;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Allows you to substitute words, not always, but with some chance
|
||||||
|
/// </summary>
|
||||||
|
[DataField]
|
||||||
|
public float ReplacementChance = 1f;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user