Files
tbd-station-14/Content.Server/Speech/EntitySystems/BarkAccentSystem.cs
NoreUhh ae2067c5be Add 2 New Reagents (Felinase and Caninase) (#41136)
* Flavors, Flavor Profiles, Reagent Text

* Base Reagent and Mix reaction

* Borkinase, flavor stuff

* Final touches me thinks

* Comment out shit

* Update fun.yml

removed comments

* Update fun.yml

Increased output for borkinase and felinase

* explosive reaction

creates razorium when mixed and makes a radioactive explosion. screaming explosion funny!!!

* reagent descriptions

updated em

* chem is no longer nuclear bomb

* remove tile-break scale

* recipe change

done through web view dont kill me im lazy

* removed cellular, halved rads

done through web again, dont end me thanks

* updated locale to reflect name change

* updated reagent to reflect name change

* updated reactions to reflect name changes

---------

Co-authored-by: NoreUhh <noreuhh@gmail.com>
2025-10-31 01:02:43 +00:00

52 lines
1.6 KiB
C#

using Content.Shared.StatusEffectNew;
using Content.Server.Speech.Components;
using Content.Shared.Speech;
using Robust.Shared.Random;
namespace Content.Server.Speech.EntitySystems
{
public sealed class BarkAccentSystem : EntitySystem
{
[Dependency] private readonly IRobustRandom _random = default!;
private static readonly IReadOnlyList<string> Barks = new List<string>{
" Woof!", " WOOF", " wof-wof"
}.AsReadOnly();
private static readonly IReadOnlyDictionary<string, string> SpecialWords = new Dictionary<string, string>()
{
{ "ah", "arf" },
{ "Ah", "Arf" },
{ "oh", "oof" },
{ "Oh", "Oof" },
};
public override void Initialize()
{
SubscribeLocalEvent<BarkAccentComponent, AccentGetEvent>(OnAccent);
SubscribeLocalEvent<BarkAccentComponent, StatusEffectRelayedEvent<AccentGetEvent>>(OnAccentRelayed);
}
public string Accentuate(string message)
{
foreach (var (word, repl) in SpecialWords)
{
message = message.Replace(word, repl);
}
return message.Replace("!", _random.Pick(Barks))
.Replace("l", "r").Replace("L", "R");
}
private void OnAccent(Entity<BarkAccentComponent> entity, ref AccentGetEvent args)
{
args.Message = Accentuate(args.Message);
}
private void OnAccentRelayed(Entity<BarkAccentComponent> entity, ref StatusEffectRelayedEvent<AccentGetEvent> args)
{
args.Args.Message = Accentuate(args.Args.Message);
}
}
}