Split `ReplacementAccentPrototype and ReplacementAccentComponent` in different files (#35107)

* Split ReplacementAccentPrototype  and ReplacementAccentComponent

* Fixes

* Fixes

* inheritdoc
This commit is contained in:
Winkarst
2025-02-12 14:21:12 +03:00
committed by GitHub
parent 773159d6db
commit 0d33e6182c
5 changed files with 45 additions and 40 deletions

View File

@@ -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;

View File

@@ -1,43 +1,15 @@
using Robust.Shared.Prototypes;
using Content.Server.Speech.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.Speech.Components
namespace Content.Server.Speech.Components;
/// <summary>
/// Replaces full sentences or words within sentences with new strings.
/// </summary>
[RegisterComponent]
public sealed partial class ReplacementAccentComponent : Component
{
[Prototype("accent")]
public sealed partial class ReplacementAccentPrototype : IPrototype
{
[ViewVariables]
[IdDataField]
public string ID { get; private set; } = default!;
[DataField(customTypeSerializer: typeof(PrototypeIdSerializer<ReplacementAccentPrototype>), required: true)]
public string Accent = 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>
/// Replaces full sentences or words within sentences with new strings.
/// </summary>
[RegisterComponent]
public sealed partial class ReplacementAccentComponent : Component
{
[DataField("accent", customTypeSerializer: typeof(PrototypeIdSerializer<ReplacementAccentPrototype>), required: true)]
public string Accent = default!;
}
}