Add bleating accent to goats (#34273)

This commit is contained in:
Tayrtahn
2025-01-07 20:00:20 -05:00
committed by GitHub
parent 90b46699f6
commit 23f0b304f2
7 changed files with 73 additions and 0 deletions

View File

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

View File

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

View File

@@ -118,6 +118,11 @@ chat-speech-verb-canine-1 = barks
chat-speech-verb-canine-2 = woofs chat-speech-verb-canine-2 = woofs
chat-speech-verb-canine-3 = howls 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-name-small-mob = Mouse
chat-speech-verb-small-mob-1 = squeaks chat-speech-verb-small-mob-1 = squeaks
chat-speech-verb-small-mob-2 = pieps chat-speech-verb-small-mob-2 = pieps

View File

@@ -998,6 +998,15 @@
- type: Grammar - type: Grammar
attributes: attributes:
gender: female # Here because of UdderComponent 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 - type: InteractionPopup
successChance: 0.2 successChance: 0.2
interactSuccessString: petting-success-goat interactSuccessString: petting-success-goat

View File

@@ -527,3 +527,10 @@
path: /Audio/Animals/parrot_raught.ogg path: /Audio/Animals/parrot_raught.ogg
params: params:
variation: 0.125 variation: 0.125
- type: emoteSounds
id: Goat
sound:
path: /Audio/Animals/goat_bah.ogg
params:
variation: 0.125

View File

@@ -159,3 +159,12 @@
path: /Audio/Animals/chicken_cluck_happy.ogg path: /Audio/Animals/chicken_cluck_happy.ogg
exclaimSound: exclaimSound:
path: /Audio/Animals/chicken_cluck_happy.ogg 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

View File

@@ -110,6 +110,14 @@
- chat-speech-verb-canine-2 - chat-speech-verb-canine-2
- chat-speech-verb-canine-3 - 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 - type: speechVerb
id: LargeMob id: LargeMob
name: chat-speech-verb-name-large-mob name: chat-speech-verb-name-large-mob