Add French accent beret (#21430)

This commit is contained in:
brainfood1183
2024-02-15 00:52:24 +00:00
committed by GitHub
parent 2f0c837816
commit e1805e04d4
10 changed files with 101 additions and 0 deletions

View 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
{ }

View 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);
}
}

View File

@@ -21,6 +21,7 @@
ClothingOuterSanta: 2
ClothingHeadHatSkub: 2
ClothingOuterSkub: 2
ClothingHeadHatBeretFrench: 2
ClothingOuterSuitChicken: 2
ClothingHeadHatChickenhead: 2
ClothingOuterSuitMonkey: 2

View File

@@ -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

View File

@@ -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

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

View File

@@ -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
}
]
}