Files
wwdpublic/Content.Server/DeltaV/Speech/EntitySystems/ScottishAccentSystem.cs
Ps3Moira d2ca30c76c Scottish Trait (#608)
* Scottish Accent Draft

* Add Accent Component and Accent System

* Fix System and Component Slightly

* Fixed Accent and Component

* Fixed capitalization

* Added Plural Words

* God given right to own bag pipes

* Added Kilts

* Added Scottish Clothes to Theater Vend

* Updated Pricing

* Fixed Pricing
2023-12-29 20:44:43 +01:00

33 lines
988 B
C#

using Content.Server.DeltaV.Speech.Components;
using Content.Server.Speech;
using Content.Server.Speech.EntitySystems;
using System.Text.RegularExpressions;
namespace Content.Server.DeltaV.Speech.EntitySystems;
public sealed class ScottishAccentSystem : EntitySystem
{
[Dependency] private readonly ReplacementAccentSystem _replacement = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ScottishAccentComponent, AccentGetEvent>(OnAccentGet);
}
// converts left word when typed into the right word. For example typing you becomes ye.
public string Accentuate(string message, ScottishAccentComponent component)
{
var msg = message;
msg = _replacement.ApplyReplacements(msg, "scottish");
return msg;
}
private void OnAccentGet(EntityUid uid, ScottishAccentComponent component, AccentGetEvent args)
{
args.Message = Accentuate(args.Message, component);
}
}