Delta-v/Content.Server/_DV/Storage/EntitySystems/MouthStorageSystem.cs

28 lines
877 B
C#

using Content.Server.Speech;
using Content.Server.Speech.EntitySystems;
using Content.Shared._DV.Storage.Components;
using Content.Shared._DV.Storage.EntitySystems;
using Content.Shared.Speech;
using Content.Shared.Storage;
namespace Content.Server._DV.Storage.EntitySystems;
public sealed class MouthStorageSystem : SharedMouthStorageSystem
{
[Dependency] private readonly ReplacementAccentSystem _replacement = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<MouthStorageComponent, AccentGetEvent>(OnAccent);
}
// Force you to mumble if you have items in your mouth
private void OnAccent(EntityUid uid, MouthStorageComponent component, AccentGetEvent args)
{
if (IsMouthBlocked(component))
args.Message = _replacement.ApplyReplacements(args.Message, "mumble");
}
}