]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add French accent beret (#21430)
authorbrainfood1183 <113240905+brainfood1183@users.noreply.github.com>
Thu, 15 Feb 2024 00:52:24 +0000 (00:52 +0000)
committerGitHub <noreply@github.com>
Thu, 15 Feb 2024 00:52:24 +0000 (16:52 -0800)
Content.Server/Speech/Components/FrenchAccentComponent.cs [new file with mode: 0644]
Content.Server/Speech/EntitySystems/FrenchAccentSystem.cs [new file with mode: 0644]
Resources/Prototypes/Catalog/VendingMachines/Inventories/theater.yml
Resources/Prototypes/Entities/Clothing/Head/hats.yml
Resources/Prototypes/Roles/Jobs/Civilian/mime.yml
Resources/Textures/Clothing/Head/Hats/beret_french.rsi/equipped-HELMET.png [new file with mode: 0644]
Resources/Textures/Clothing/Head/Hats/beret_french.rsi/icon.png [new file with mode: 0644]
Resources/Textures/Clothing/Head/Hats/beret_french.rsi/inhand-left.png [new file with mode: 0644]
Resources/Textures/Clothing/Head/Hats/beret_french.rsi/inhand-right.png [new file with mode: 0644]
Resources/Textures/Clothing/Head/Hats/beret_french.rsi/meta.json [new file with mode: 0644]

diff --git a/Content.Server/Speech/Components/FrenchAccentComponent.cs b/Content.Server/Speech/Components/FrenchAccentComponent.cs
new file mode 100644 (file)
index 0000000..f696c35
--- /dev/null
@@ -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
+{ }
diff --git a/Content.Server/Speech/EntitySystems/FrenchAccentSystem.cs b/Content.Server/Speech/EntitySystems/FrenchAccentSystem.cs
new file mode 100644 (file)
index 0000000..5637288
--- /dev/null
@@ -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);
+    }
+}
index 23444194f26bbf149c6802b0660aabad6a22e831..f39cda0ed4d4afba8d2e9962b95cbcabe86f6bc9 100644 (file)
@@ -21,6 +21,7 @@
     ClothingOuterSanta: 2
     ClothingHeadHatSkub: 2
     ClothingOuterSkub: 2
+    ClothingHeadHatBeretFrench: 2
     ClothingOuterSuitChicken: 2
     ClothingHeadHatChickenhead: 2
     ClothingOuterSuitMonkey: 2
index e5dabb36d71f35694676365ff39deff2a038cd60..467a2070d220ecac10fc3a465f0556063b90a7c7 100644 (file)
     - 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
index 76ae6a407afe0d81be82b58a5ef6047711107b29..83e916a68730bafd46823c18db15b512a99c4685 100644 (file)
@@ -16,6 +16,7 @@
   - !type:AddComponentSpecial
     components:
     - type: MimePowers
+    - type: FrenchAccent
 
 - type: startingGear
   id: MimeGear
diff --git a/Resources/Textures/Clothing/Head/Hats/beret_french.rsi/equipped-HELMET.png b/Resources/Textures/Clothing/Head/Hats/beret_french.rsi/equipped-HELMET.png
new file mode 100644 (file)
index 0000000..8175d93
Binary files /dev/null and b/Resources/Textures/Clothing/Head/Hats/beret_french.rsi/equipped-HELMET.png differ
diff --git a/Resources/Textures/Clothing/Head/Hats/beret_french.rsi/icon.png b/Resources/Textures/Clothing/Head/Hats/beret_french.rsi/icon.png
new file mode 100644 (file)
index 0000000..608a155
Binary files /dev/null and b/Resources/Textures/Clothing/Head/Hats/beret_french.rsi/icon.png differ
diff --git a/Resources/Textures/Clothing/Head/Hats/beret_french.rsi/inhand-left.png b/Resources/Textures/Clothing/Head/Hats/beret_french.rsi/inhand-left.png
new file mode 100644 (file)
index 0000000..84d21a6
Binary files /dev/null and b/Resources/Textures/Clothing/Head/Hats/beret_french.rsi/inhand-left.png differ
diff --git a/Resources/Textures/Clothing/Head/Hats/beret_french.rsi/inhand-right.png b/Resources/Textures/Clothing/Head/Hats/beret_french.rsi/inhand-right.png
new file mode 100644 (file)
index 0000000..aee4b59
Binary files /dev/null and b/Resources/Textures/Clothing/Head/Hats/beret_french.rsi/inhand-right.png differ
diff --git a/Resources/Textures/Clothing/Head/Hats/beret_french.rsi/meta.json b/Resources/Textures/Clothing/Head/Hats/beret_french.rsi/meta.json
new file mode 100644 (file)
index 0000000..a470e00
--- /dev/null
@@ -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
+    }
+  ]
+}