Word replacement accent system (#15086)

This commit is contained in:
Kara
2023-04-03 19:50:37 -07:00
committed by GitHub
parent f8f318def8
commit 18df657fb6
11 changed files with 338 additions and 150 deletions

View File

@@ -1,9 +0,0 @@
namespace Content.Server.Speech.Components;
/// <summary>
/// Used for replacing words for dwarves (pseudo-scottish)
/// </summary>
[RegisterComponent]
public sealed class DwarfAccentComponent : Component
{
}

View File

@@ -10,12 +10,22 @@ namespace Content.Server.Speech.Components
[IdDataField]
public string ID { get; } = default!;
[DataField("words")]
public string[] Words = 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>
/// Replaces any spoken sentences with a random word.
/// Replaces full sentences or words within sentences with new strings.
/// </summary>
[RegisterComponent]
public sealed class ReplacementAccentComponent : Component