Files
tbd-station-14/Content.Server/Chat/Commands/MeCommand.cs
slarticodefast ee9d1032bb Move ChatSystem.Emotes to shared (#40866)
* move to shared

* entity effect to shared

* refactor: whitespaces+xml-doc typo fixups

* refactor: a little bit more of xml-doc typos fixups

---------

Co-authored-by: pa.pecherskij <pa.pecherskij@interfax.ru>
2025-10-13 18:06:01 +00:00

44 lines
1.3 KiB
C#

using Content.Server.Chat.Systems;
using Content.Shared.Administration;
using Content.Shared.Chat;
using Robust.Shared.Console;
using Robust.Shared.Enums;
namespace Content.Server.Chat.Commands
{
[AnyCommand]
internal sealed class MeCommand : LocalizedEntityCommands
{
[Dependency] private readonly ChatSystem _chatSystem = default!;
public override string Command => "me";
public override void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player is not { } player)
{
shell.WriteError(Loc.GetString($"shell-cannot-run-command-from-server"));
return;
}
if (player.Status != SessionStatus.InGame)
return;
if (player.AttachedEntity is not {} playerEntity)
{
shell.WriteError(Loc.GetString($"shell-must-be-attached-to-entity"));
return;
}
if (args.Length < 1)
return;
var message = string.Join(" ", args).Trim();
if (string.IsNullOrEmpty(message))
return;
_chatSystem.TrySendInGameICMessage(playerEntity, message, InGameICChatType.Emote, ChatTransmitRange.Normal, false, shell, player);
}
}
}