--- /dev/null
+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);
+ }
+}
- 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
--- /dev/null
+{
+ "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
+ }
+ ]
+}