Moth accent (#21910)

* :trollface:

* :trollface:

* :trollface:

* Update moth.yml

* Update animals.yml
This commit is contained in:
lzk
2023-11-27 22:28:43 +01:00
committed by GitHub
parent be53e16746
commit 440de19e30
4 changed files with 37 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
namespace Content.Server.Speech.Components;
/// <summary>
/// Buzzz!
/// </summary>
[RegisterComponent]
public sealed partial class MothAccentComponent : Component
{
}

View File

@@ -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;
}
}

View File

@@ -364,6 +364,7 @@
- type: Speech
speechVerb: Moth
speechSounds: Squeak
- type: MothAccent
- type: Sprite
sprite: Mobs/Animals/mothroach.rsi
layers:

View File

@@ -32,6 +32,7 @@
spawned:
- id: FoodMeat
amount: 5
- type: MothAccent
- type: Vocal
sounds:
Male: UnisexMoth