using Content.Server.Speech.Components;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
namespace Content.Server.Speech.EntitySystems
{
// TODO: Code in-game languages and make this a language
///
/// Replaces any spoken sentences with a random word.
///
public sealed class ReplacementAccentSystem : EntitySystem
{
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly IRobustRandom _random = default!;
public override void Initialize()
{
SubscribeLocalEvent(OnAccent);
}
private void OnAccent(EntityUid uid, ReplacementAccentComponent component, AccentGetEvent args)
{
var words = _proto.Index(component.Accent).Words;
args.Message = words.Length != 0 ? Loc.GetString(_random.Pick(words)) : "";
}
}
}