]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add bleating accent to goats (#34273)
authorTayrtahn <tayrtahn@gmail.com>
Wed, 8 Jan 2025 01:00:20 +0000 (20:00 -0500)
committerGitHub <noreply@github.com>
Wed, 8 Jan 2025 01:00:20 +0000 (02:00 +0100)
Content.Server/Speech/Components/BleatingAccentComponent.cs [new file with mode: 0644]
Content.Server/Speech/EntitySystems/BleatingAccentSystem.cs [new file with mode: 0644]
Resources/Locale/en-US/chat/managers/chat-manager.ftl
Resources/Prototypes/Entities/Mobs/NPCs/animals.yml
Resources/Prototypes/Voice/speech_emote_sounds.yml
Resources/Prototypes/Voice/speech_sounds.yml
Resources/Prototypes/Voice/speech_verbs.yml

diff --git a/Content.Server/Speech/Components/BleatingAccentComponent.cs b/Content.Server/Speech/Components/BleatingAccentComponent.cs
new file mode 100644 (file)
index 0000000..484235a
--- /dev/null
@@ -0,0 +1,7 @@
+namespace Content.Server.Speech.Components;
+
+/// <summary>
+/// Makes this entity speak like a sheep or a goat in all chat messages it sends.
+/// </summary>
+[RegisterComponent]
+public sealed partial class BleatingAccentComponent : Component { }
diff --git a/Content.Server/Speech/EntitySystems/BleatingAccentSystem.cs b/Content.Server/Speech/EntitySystems/BleatingAccentSystem.cs
new file mode 100644 (file)
index 0000000..9033774
--- /dev/null
@@ -0,0 +1,28 @@
+using System.Text.RegularExpressions;
+using Content.Server.Speech.Components;
+
+namespace Content.Server.Speech.EntitySystems;
+
+public sealed partial class BleatingAccentSystem : EntitySystem
+{
+    private static readonly Regex BleatRegex = new("([mbdlpwhrkcnytfo])([aiu])", RegexOptions.IgnoreCase);
+
+    public override void Initialize()
+    {
+        base.Initialize();
+
+        SubscribeLocalEvent<BleatingAccentComponent, AccentGetEvent>(OnAccentGet);
+    }
+
+    private void OnAccentGet(Entity<BleatingAccentComponent> entity, ref AccentGetEvent args)
+    {
+        args.Message = Accentuate(args.Message);
+    }
+
+    public static string Accentuate(string message)
+    {
+        // Repeats the vowel in certain consonant-vowel pairs
+        // So you taaaalk liiiike thiiiis
+        return BleatRegex.Replace(message, "$1$2$2$2$2");
+    }
+}
index 59b927742bb2b91db044928c622dc6dedd52c7ec..c3d35c97395efea1e49083bffb855239d2881f0a 100644 (file)
@@ -118,6 +118,11 @@ chat-speech-verb-canine-1 = barks
 chat-speech-verb-canine-2 = woofs
 chat-speech-verb-canine-3 = howls
 
+chat-speech-verb-name-goat = Goat
+chat-speech-verb-goat-1 = bleats
+chat-speech-verb-goat-2 = grunts
+chat-speech-verb-goat-3 = cries
+
 chat-speech-verb-name-small-mob = Mouse
 chat-speech-verb-small-mob-1 = squeaks
 chat-speech-verb-small-mob-2 = pieps
index 2413d5531b7173fff8a53871a2cd5c7ab24ab566..e88100d22c9959892e2bffca9b64154bdf6b3385 100644 (file)
   - type: Grammar
     attributes:
       gender: female # Here because of UdderComponent
+  - type: Speech
+    speechSounds: Goat
+    speechVerb: Goat
+  - type: Vocal
+    sounds:
+      Female: Goat
+      Male: Goat
+      Unsexed: Goat
+  - type: BleatingAccent
   - type: InteractionPopup
     successChance: 0.2
     interactSuccessString: petting-success-goat
index a45260093fdf2799496124e19e13ac3ed4b41288..8f4d4fc88eeb61f21f73ffe5cc55f1a422d83085 100644 (file)
     path: /Audio/Animals/parrot_raught.ogg
     params:
       variation: 0.125
+
+- type: emoteSounds
+  id: Goat
+  sound:
+    path: /Audio/Animals/goat_bah.ogg
+    params:
+      variation: 0.125
index bc3cffb3596e30e038b3920bd0cd0bbf68fb3e06..c1ad6b9e4096ab687070a998fa904b1d1126d926 100644 (file)
     path: /Audio/Animals/chicken_cluck_happy.ogg
   exclaimSound:
     path: /Audio/Animals/chicken_cluck_happy.ogg
+
+- type: speechSounds
+  id: Goat
+  saySound:
+    path: /Audio/Animals/goat_bah.ogg
+  askSound:
+    path: /Audio/Animals/goat_bah.ogg
+  exclaimSound:
+    path: /Audio/Animals/goat_bah.ogg
index 9879cefb75d8d4a92b969069c89e0a86c6aeb1d5..f8202847fd6c1668c67aacb71c1a625810f12ea4 100644 (file)
   - chat-speech-verb-canine-2
   - chat-speech-verb-canine-3
 
+- type: speechVerb
+  id: Goat
+  name: chat-speech-verb-name-goat
+  speechVerbStrings:
+  - chat-speech-verb-goat-1
+  - chat-speech-verb-goat-2
+  - chat-speech-verb-goat-3
+
 - type: speechVerb
   id: LargeMob
   name: chat-speech-verb-name-large-mob