2021-12-21 12:31:20 -08:00
|
|
|
using Robust.Shared.Prototypes;
|
|
|
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.Speech.Components
|
|
|
|
|
{
|
|
|
|
|
[Prototype("accent")]
|
2023-11-01 19:56:23 -07:00
|
|
|
public sealed partial class ReplacementAccentPrototype : IPrototype
|
2021-12-21 12:31:20 -08:00
|
|
|
{
|
|
|
|
|
[ViewVariables]
|
2023-01-19 03:56:45 +01:00
|
|
|
[IdDataField]
|
2023-08-22 18:14:33 -07:00
|
|
|
public string ID { get; private set; } = default!;
|
2021-12-21 12:31:20 -08:00
|
|
|
|
2023-04-03 19:50:37 -07:00
|
|
|
/// <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;
|
2024-05-17 18:33:22 +02:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Allows you to substitute words, not always, but with some chance
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField]
|
|
|
|
|
public float ReplacementChance = 1f;
|
2021-12-21 12:31:20 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2023-04-03 19:50:37 -07:00
|
|
|
/// Replaces full sentences or words within sentences with new strings.
|
2021-12-21 12:31:20 -08:00
|
|
|
/// </summary>
|
|
|
|
|
[RegisterComponent]
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class ReplacementAccentComponent : Component
|
2021-12-21 12:31:20 -08:00
|
|
|
{
|
|
|
|
|
[DataField("accent", customTypeSerializer: typeof(PrototypeIdSerializer<ReplacementAccentPrototype>), required: true)]
|
|
|
|
|
public string Accent = default!;
|
2024-05-04 14:11:46 +03:00
|
|
|
|
2021-12-21 12:31:20 -08:00
|
|
|
}
|
|
|
|
|
}
|