Basic Russian Accent (#6049)
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Server.Speech.Components;
|
||||
|
||||
[RegisterComponent]
|
||||
[ComponentProtoName("RussianAccent")]
|
||||
public sealed class RussianAccentComponent : Component {}
|
||||
50
Content.Server/Speech/EntitySystems/RussianAccentSystem.cs
Normal file
50
Content.Server/Speech/EntitySystems/RussianAccentSystem.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using System.Text;
|
||||
using Content.Server.Speech.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.Speech.EntitySystems;
|
||||
|
||||
public sealed class RussianAccentSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<RussianAccentComponent, AccentGetEvent>(OnAccent);
|
||||
}
|
||||
|
||||
public static string Accentuate(string message)
|
||||
{
|
||||
var accentedMessage = new StringBuilder(message);
|
||||
|
||||
for (var i = 0; i < accentedMessage.Length; i++)
|
||||
{
|
||||
var c = accentedMessage[i];
|
||||
|
||||
accentedMessage[i] = c switch
|
||||
{
|
||||
'b' => 'в',
|
||||
'N' => 'И',
|
||||
'n' => 'и',
|
||||
'K' => 'К',
|
||||
'k' => 'к',
|
||||
'm' => 'м',
|
||||
'h' => 'н',
|
||||
't' => 'т',
|
||||
'R' => 'Я',
|
||||
'r' => 'я',
|
||||
'Y' => 'У',
|
||||
'W' => 'Ш',
|
||||
'w' => 'ш',
|
||||
_ => accentedMessage[i]
|
||||
};
|
||||
}
|
||||
|
||||
return accentedMessage.ToString();
|
||||
}
|
||||
|
||||
private void OnAccent(EntityUid uid, RussianAccentComponent component, AccentGetEvent args)
|
||||
{
|
||||
args.Message = Accentuate(args.Message);
|
||||
}
|
||||
}
|
||||
@@ -294,6 +294,8 @@
|
||||
sprite: Clothing/Head/Hats/ushanka.rsi
|
||||
- type: Clothing
|
||||
sprite: Clothing/Head/Hats/ushanka.rsi
|
||||
- type: AddAccentClothing
|
||||
accent: RussianAccent
|
||||
|
||||
- type: entity
|
||||
parent: ClothingHeadBase
|
||||
|
||||
Reference in New Issue
Block a user