mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* move-accents-to-shared * Update AccentSystem.cs * Update ListeningSystem.cs * aaaaaa * Update AccentSystem.cs * oh god * aaooao * // * review * fix * Update VocalSystem.cs
25 lines
1.2 KiB
C#
25 lines
1.2 KiB
C#
using System.Text.RegularExpressions;
|
|
using Content.Shared.Speech.Components;
|
|
|
|
namespace Content.Shared.Speech.EntitySystems;
|
|
|
|
public sealed class FrontalLispSystem : RelayAccentSystem<FrontalLispComponent>
|
|
{
|
|
// @formatter:off
|
|
private static readonly Regex RegexUpperTh = new("[T]+[Ss]+|[S]+[Cc]+(?=[IiEeYy]+)|[C]+(?=[IiEeYy]+)|[P][Ss]+|([S]+[Tt]+|[T]+)(?=[Ii]+[Oo]+[Uu]*[Nn]*)|[C]+[Hh]+(?=[Ii]*[Ee]*)|[Z]+|[S]+|[X]+(?=[Ee]+)");
|
|
private static readonly Regex RegexLowerTh = new("[t]+[s]+|[s]+[c]+(?=[iey]+)|[c]+(?=[iey]+)|[p][s]+|([s]+[t]+|[t]+)(?=[i]+[o]+[u]*[n]*)|[c]+[h]+(?=[i]*[e]*)|[z]+|[s]+|[x]+(?=[e]+)");
|
|
private static readonly Regex RegexUpperEcks = new("[E]+[Xx]+[Cc]*|[X]+");
|
|
private static readonly Regex RegexLowerEcks = new("[e]+[x]+[c]*|[x]+");
|
|
// @formatter:on
|
|
|
|
public override string Accentuate(string message, Entity<FrontalLispComponent>? ent = null)
|
|
{
|
|
// handles ts, sc(i|e|y), c(i|e|y), ps, st(io(u|n)), ch(i|e), z, s
|
|
message = RegexUpperTh.Replace(message, "TH");
|
|
message = RegexLowerTh.Replace(message, "th");
|
|
// handles ex(c), x
|
|
message = RegexUpperEcks.Replace(message, "EKTH");
|
|
message = RegexLowerEcks.Replace(message, "ekth");
|
|
return message;
|
|
}
|
|
}
|