* Engine namespace changes.
* Automated remove redundant using statements.
* Simplified Graphics namespace.
* Apparently the container system stores full type names in the map file.😞 This updates those names.
* API Changes to LocalizationManager.LoadCulture.
* Update submodule to v0.3.2
39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
using System.Text.RegularExpressions;
|
|
using Content.Server.Interfaces.Chat;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.IoC;
|
|
|
|
namespace Content.Server.GameObjects.Components.Mobs.Speech
|
|
{
|
|
public interface IAccentManager
|
|
{
|
|
public void Initialize();
|
|
}
|
|
|
|
public class AccentManager : IAccentManager
|
|
{
|
|
[Dependency] private readonly IChatManager _chatManager = default!;
|
|
[Dependency] private readonly IComponentManager _componentManager = default!;
|
|
|
|
public static readonly Regex SentenceRegex = new(@"(?<=[\.!\?])");
|
|
|
|
public void Initialize()
|
|
{
|
|
IoCManager.InjectDependencies(this);
|
|
|
|
_chatManager.RegisterChatTransform(AccentHandler);
|
|
}
|
|
|
|
public string AccentHandler(IEntity player, string message)
|
|
{
|
|
//TODO: give accents a prio?
|
|
var accents = _componentManager.GetComponents<IAccentComponent>(player.Uid);
|
|
foreach (var accent in accents)
|
|
{
|
|
message = accent.Accentuate(message);
|
|
}
|
|
return message;
|
|
}
|
|
}
|
|
}
|