Add French accent beret (#21430)
This commit is contained in:
11
Content.Server/Speech/Components/FrenchAccentComponent.cs
Normal file
11
Content.Server/Speech/Components/FrenchAccentComponent.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using Content.Server.Speech.EntitySystems;
|
||||
|
||||
namespace Content.Server.Speech.Components;
|
||||
|
||||
/// <summary>
|
||||
/// French accent replaces spoken letters. "th" becomes "z" and "H" at the start of a word becomes "'".
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
[Access(typeof(FrenchAccentSystem))]
|
||||
public sealed partial class FrenchAccentComponent : Component
|
||||
{ }
|
||||
45
Content.Server/Speech/EntitySystems/FrenchAccentSystem.cs
Normal file
45
Content.Server/Speech/EntitySystems/FrenchAccentSystem.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using Content.Server.Speech.Components;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Content.Server.Speech.EntitySystems;
|
||||
|
||||
/// <summary>
|
||||
/// System that gives the speaker a faux-French accent.
|
||||
/// </summary>
|
||||
public sealed class FrenchAccentSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly ReplacementAccentSystem _replacement = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<FrenchAccentComponent, AccentGetEvent>(OnAccentGet);
|
||||
}
|
||||
|
||||
public string Accentuate(string message, FrenchAccentComponent component)
|
||||
{
|
||||
var msg = message;
|
||||
|
||||
msg = _replacement.ApplyReplacements(msg, "french");
|
||||
|
||||
// replaces th with dz
|
||||
msg = Regex.Replace(msg, @"th", "'z", RegexOptions.IgnoreCase);
|
||||
|
||||
// removes the letter h from the start of words.
|
||||
msg = Regex.Replace(msg, @"(?<!\w)[h]", "'", RegexOptions.IgnoreCase);
|
||||
|
||||
// spaces out ! ? : and ;.
|
||||
msg = Regex.Replace(msg, @"(?<=\w\w)!(?!\w)", " !", RegexOptions.IgnoreCase);
|
||||
msg = Regex.Replace(msg, @"(?<=\w\w)[?](?!\w)", " ?", RegexOptions.IgnoreCase);
|
||||
msg = Regex.Replace(msg, @"(?<=\w\w)[;](?!\w)", " ;", RegexOptions.IgnoreCase);
|
||||
msg = Regex.Replace(msg, @"(?<=\w\w)[:](?!\w)", " :", RegexOptions.IgnoreCase);
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
private void OnAccentGet(EntityUid uid, FrenchAccentComponent component, AccentGetEvent args)
|
||||
{
|
||||
args.Message = Accentuate(args.Message, component);
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@
|
||||
ClothingOuterSanta: 2
|
||||
ClothingHeadHatSkub: 2
|
||||
ClothingOuterSkub: 2
|
||||
ClothingHeadHatBeretFrench: 2
|
||||
ClothingOuterSuitChicken: 2
|
||||
ClothingHeadHatChickenhead: 2
|
||||
ClothingOuterSuitMonkey: 2
|
||||
|
||||
@@ -25,6 +25,23 @@
|
||||
- HamsterWearable
|
||||
- WhitelistChameleon
|
||||
|
||||
- type: entity
|
||||
parent: ClothingHeadBase
|
||||
id: ClothingHeadHatBeretFrench
|
||||
name: French beret
|
||||
description: A French beret, "vive la France".
|
||||
components:
|
||||
- type: Sprite
|
||||
sprite: Clothing/Head/Hats/beret_french.rsi
|
||||
- type: Clothing
|
||||
sprite: Clothing/Head/Hats/beret_french.rsi
|
||||
- type: AddAccentClothing
|
||||
accent: FrenchAccent
|
||||
- type: Tag
|
||||
tags:
|
||||
- ClothMade
|
||||
- WhitelistChameleon
|
||||
|
||||
- type: entity
|
||||
parent: ClothingHeadBase
|
||||
id: ClothingHeadHatBeretSecurity
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
- !type:AddComponentSpecial
|
||||
components:
|
||||
- type: MimePowers
|
||||
- type: FrenchAccent
|
||||
|
||||
- type: startingGear
|
||||
id: MimeGear
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
BIN
Resources/Textures/Clothing/Head/Hats/beret_french.rsi/icon.png
Normal file
BIN
Resources/Textures/Clothing/Head/Hats/beret_french.rsi/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"version": 1,
|
||||
"license": "CC-BY-SA-3.0",
|
||||
"copyright": "Taken from tgstation at commit https://github.com/tgstation/tgstation/commit/4f6190e2895e09116663ef282d3ce1d8b35c032e",
|
||||
"size": {
|
||||
"x": 32,
|
||||
"y": 32
|
||||
},
|
||||
"states": [
|
||||
{
|
||||
"name": "icon"
|
||||
},
|
||||
{
|
||||
"name": "equipped-HELMET",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-left",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-right",
|
||||
"directions": 4
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user