Apply smiley filter on me-command (#6153)

This commit is contained in:
Clyybber
2022-01-25 10:38:52 +01:00
committed by GitHub
parent ddcd4d267d
commit 107806775e
3 changed files with 39 additions and 24 deletions

View File

@@ -169,15 +169,38 @@ namespace Content.Server.Chat.Managers
var isEmote = _sanitizer.TrySanitizeOutSmilies(message, owned, out var sanitized, out var emoteStr);
if (sanitized.Length != 0)
{
SendEntityChatType(owned, sanitized, isWhisper);
}
if (isEmote)
EntityMe(owned, emoteStr!);
}
}
public void TryEmote(EntityUid source, string message, IConsoleShell? shell = null, IPlayerSession? player = null)
{
var mindComponent = player?.ContentData()?.Mind;
if (mindComponent == null)
{
shell?.WriteError("You don't have a mind!");
return;
}
if (mindComponent.OwnedEntity is not {Valid: true} owned)
{
shell?.WriteError("You don't have an entity!");
return;
}
var isEmote = _sanitizer.TrySanitizeOutSmilies(message, mindComponent.OwnedEntity.Value, out var sanitized, out var emoteStr);
if (sanitized.Length != 0)
EntityMe(mindComponent.OwnedEntity.Value, sanitized);
if (isEmote)
EntityMe(mindComponent.OwnedEntity.Value, emoteStr!);
}
public void EntitySay(EntityUid source, string message, bool hideChat=false)
{
if (!EntitySystem.Get<ActionBlockerSystem>().CanSpeak(source))