]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Moth accent (#21910)
authorlzk <124214523+lzk228@users.noreply.github.com>
Mon, 27 Nov 2023 21:28:43 +0000 (22:28 +0100)
committerGitHub <noreply@github.com>
Mon, 27 Nov 2023 21:28:43 +0000 (14:28 -0700)
* :trollface:

* :trollface:

* :trollface:

* Update moth.yml

* Update animals.yml

Content.Server/Speech/Components/MothAccentComponent.cs [new file with mode: 0644]
Content.Server/Speech/EntitySystems/MothAccentSystem.cs [new file with mode: 0644]
Resources/Prototypes/Entities/Mobs/NPCs/animals.yml
Resources/Prototypes/Entities/Mobs/Species/moth.yml

diff --git a/Content.Server/Speech/Components/MothAccentComponent.cs b/Content.Server/Speech/Components/MothAccentComponent.cs
new file mode 100644 (file)
index 0000000..e5b38f3
--- /dev/null
@@ -0,0 +1,10 @@
+namespace Content.Server.Speech.Components;
+
+/// <summary>
+///     Buzzz!
+/// </summary>
+[RegisterComponent]
+public sealed partial class MothAccentComponent : Component
+{
+
+}
diff --git a/Content.Server/Speech/EntitySystems/MothAccentSystem.cs b/Content.Server/Speech/EntitySystems/MothAccentSystem.cs
new file mode 100644 (file)
index 0000000..5f712fe
--- /dev/null
@@ -0,0 +1,25 @@
+using System.Text.RegularExpressions;
+using Content.Server.Speech.Components;
+
+namespace Content.Server.Speech.EntitySystems;
+
+public sealed class MothAccentSystem : EntitySystem
+{
+    public override void Initialize()
+    {
+        base.Initialize();
+        SubscribeLocalEvent<MothAccentComponent, AccentGetEvent>(OnAccent);
+    }
+
+    private void OnAccent(EntityUid uid, MothAccentComponent component, AccentGetEvent args)
+    {
+        var message = args.Message;
+
+        // buzzz
+        message = Regex.Replace(message, "z+", "zzz");
+        // buZZZ
+        message = Regex.Replace(message, "Z+", "ZZZ");
+        
+        args.Message = message;
+    }
+}
index 06372055e9d181e1688c57c7eab2b41df564ecd0..5a535947370f530c8b993c340ad0fb54cc16b40b 100644 (file)
   - type: Speech
     speechVerb: Moth
     speechSounds: Squeak
+  - type: MothAccent
   - type: Sprite
     sprite: Mobs/Animals/mothroach.rsi
     layers:
index a18e47ead36c011611cb312c1e4a1f7ed2bd8d80..71385455ac16f31956c2ccc157ff3129eab16183 100644 (file)
@@ -32,6 +32,7 @@
     spawned:
     - id: FoodMeat
       amount: 5
+  - type: MothAccent
   - type: Vocal
     sounds:
       Male: UnisexMoth