From 440de19e3039b645b3365c12bf62f59bc9f0c208 Mon Sep 17 00:00:00 2001
From: lzk <124214523+lzk228@users.noreply.github.com>
Date: Mon, 27 Nov 2023 22:28:43 +0100
Subject: [PATCH] Moth accent (#21910)
* :trollface:
* :trollface:
* :trollface:
* Update moth.yml
* Update animals.yml
---
.../Speech/Components/MothAccentComponent.cs | 10 ++++++++
.../Speech/EntitySystems/MothAccentSystem.cs | 25 +++++++++++++++++++
.../Prototypes/Entities/Mobs/NPCs/animals.yml | 1 +
.../Prototypes/Entities/Mobs/Species/moth.yml | 1 +
4 files changed, 37 insertions(+)
create mode 100644 Content.Server/Speech/Components/MothAccentComponent.cs
create mode 100644 Content.Server/Speech/EntitySystems/MothAccentSystem.cs
diff --git a/Content.Server/Speech/Components/MothAccentComponent.cs b/Content.Server/Speech/Components/MothAccentComponent.cs
new file mode 100644
index 0000000000..e5b38f315d
--- /dev/null
+++ b/Content.Server/Speech/Components/MothAccentComponent.cs
@@ -0,0 +1,10 @@
+namespace Content.Server.Speech.Components;
+
+///
+/// Buzzz!
+///
+[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
index 0000000000..5f712fe9aa
--- /dev/null
+++ b/Content.Server/Speech/EntitySystems/MothAccentSystem.cs
@@ -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(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;
+ }
+}
diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml
index 06372055e9..5a53594737 100644
--- a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml
+++ b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml
@@ -364,6 +364,7 @@
- type: Speech
speechVerb: Moth
speechSounds: Squeak
+ - type: MothAccent
- type: Sprite
sprite: Mobs/Animals/mothroach.rsi
layers:
diff --git a/Resources/Prototypes/Entities/Mobs/Species/moth.yml b/Resources/Prototypes/Entities/Mobs/Species/moth.yml
index a18e47ead3..71385455ac 100644
--- a/Resources/Prototypes/Entities/Mobs/Species/moth.yml
+++ b/Resources/Prototypes/Entities/Mobs/Species/moth.yml
@@ -32,6 +32,7 @@
spawned:
- id: FoodMeat
amount: 5
+ - type: MothAccent
- type: Vocal
sounds:
Male: UnisexMoth
--
2.51.2