Accent System (#1892)
* First Accent Prototype * -RegisterSystem -Fixed addaccent cmd -Spanish accent * -list is now ? -Checks if the accent is already added -Made components public * owo whats this * special word filter * Eeeeeeeeee * Better? * -Use a delegate func -Made some funcs not static -Moved SentenceRegex * InjectDependencies * Name change? Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
using System.Linq;
|
||||
using Content.Server.GameObjects.Components.Observer;
|
||||
using Content.Server.GameObjects.Components.Observer;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Server.Interfaces.Chat;
|
||||
using Content.Shared.Chat;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using NFluidsynth;
|
||||
using Robust.Server.Console;
|
||||
using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
@@ -13,6 +11,10 @@ using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Network;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using static Content.Server.Interfaces.Chat.IChatManager;
|
||||
|
||||
namespace Content.Server.Chat
|
||||
{
|
||||
@@ -33,6 +35,9 @@ namespace Content.Server.Chat
|
||||
/// </summary>
|
||||
private const string MaxLengthExceededMessage = "Your message exceeded {0} character limit";
|
||||
|
||||
//TODO: make prio based?
|
||||
private List<TransformChat> _chatTransformHandlers;
|
||||
|
||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
|
||||
[Dependency] private readonly IServerNetManager _netManager = default!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
@@ -49,6 +54,8 @@ namespace Content.Server.Chat
|
||||
var msg = _netManager.CreateNetMessage<ChatMaxMsgLengthMessage>();
|
||||
msg.MaxMessageLength = MaxMessageLength;
|
||||
_netManager.ServerSendToAll(msg);
|
||||
|
||||
_chatTransformHandlers = new List<TransformChat>();
|
||||
}
|
||||
|
||||
public void DispatchServerAnnouncement(string message)
|
||||
@@ -96,6 +103,12 @@ namespace Content.Server.Chat
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var handler in _chatTransformHandlers)
|
||||
{
|
||||
//TODO: rather return a bool and use a out var?
|
||||
message = handler(source, message);
|
||||
}
|
||||
|
||||
var pos = source.Transform.GridPosition;
|
||||
var clients = _playerManager.GetPlayersInRange(pos, VoiceRange).Select(p => p.ConnectedClient);
|
||||
|
||||
@@ -215,5 +228,10 @@ namespace Content.Server.Chat
|
||||
response.MaxMessageLength = MaxMessageLength;
|
||||
_netManager.ServerSendMessage(response, msg.MsgChannel);
|
||||
}
|
||||
|
||||
public void RegisterChatTransform(TransformChat handler)
|
||||
{
|
||||
_chatTransformHandlers.Add(handler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user