Added lisp as a character trait (#20350)

This commit is contained in:
dahnte
2023-09-19 21:51:50 -07:00
committed by GitHub
parent 9d8f835d15
commit 7631b66c69
4 changed files with 47 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
namespace Content.Server.Speech.Components;
[RegisterComponent]
public sealed partial class FrontalLispComponent : Component
{
}

View File

@@ -0,0 +1,30 @@
using System.Text.RegularExpressions;
using Content.Server.Speech.Components;
namespace Content.Server.Speech.EntitySystems;
public sealed class FrontalLispSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<FrontalLispComponent, AccentGetEvent>(OnAccent);
}
private void OnAccent(EntityUid uid, FrontalLispComponent component, AccentGetEvent args)
{
var message = args.Message;
// handles ts, c(iey), z, ps, ti
message = Regex.Replace(message, @"[T]+[S]+|[C]+(?=[IEY])|[Z]+|[P][S]+|[T](?=[I])", "TH");
message = Regex.Replace(message, @"[Tt]+[Ss]+|[Cc]+(?=[IiEeYy])|[Zz]+|[Pp][Ss]+|[Tt](?=[Ii])", "th");
// handles ex
message = Regex.Replace(message, @"(?![E])[X]", "KTH");
message = Regex.Replace(message, @"(?![Ee])[Xx]", "kth");
// handles sth and s
message = Regex.Replace(message, "[S]+[T]?[H]?", "TH");
message = Regex.Replace(message, "[Ss]+[Tt]?[Hh]?", "th");
args.Message = message;
}
}

View File

@@ -31,3 +31,6 @@ trait-accentless-desc = You don't have the accent that your species would usuall
trait-wheelchair-bound-name = Wheelchair Bound trait-wheelchair-bound-name = Wheelchair Bound
trait-wheelchair-bound-desc = You cannot move without your wheelchair. Wheelchair included. trait-wheelchair-bound-desc = You cannot move without your wheelchair. Wheelchair included.
trait-frontal-lisp-name = Frontal Lisp
trait-frontal-lisp-desc = You thpeak with a lithp

View File

@@ -57,3 +57,10 @@
components: components:
- type: WheelchairBound - type: WheelchairBound
- type: LegsParalyzed - type: LegsParalyzed
- type: trait
id: FrontalLisp
name: trait-frontal-lisp-name
description: trait-frontal-lisp-desc
components:
- type: FrontalLisp