Added lisp as a character trait (#20350)
This commit is contained in:
7
Content.Server/Speech/Components/FrontalLispComponent.cs
Normal file
7
Content.Server/Speech/Components/FrontalLispComponent.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
namespace Content.Server.Speech.Components;
|
||||||
|
|
||||||
|
[RegisterComponent]
|
||||||
|
public sealed partial class FrontalLispComponent : Component
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
30
Content.Server/Speech/EntitySystems/FrontalLispSystem.cs
Normal file
30
Content.Server/Speech/EntitySystems/FrontalLispSystem.cs
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user