2022-06-23 20:11:03 +10:00
|
|
|
using Content.Server.Chat.Systems;
|
2021-12-13 16:45:49 +11:00
|
|
|
using Content.Shared.Administration;
|
2021-02-01 16:49:43 -08:00
|
|
|
using Robust.Shared.Console;
|
2020-12-03 03:40:47 +01:00
|
|
|
using Robust.Shared.Enums;
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Server.Chat.Commands
|
2020-12-03 03:40:47 +01:00
|
|
|
{
|
|
|
|
|
[AnyCommand]
|
2025-06-18 20:03:28 -04:00
|
|
|
internal sealed class MeCommand : LocalizedEntityCommands
|
2020-12-03 03:40:47 +01:00
|
|
|
{
|
2025-06-18 20:03:28 -04:00
|
|
|
[Dependency] private readonly ChatSystem _chatSystem = default!;
|
2020-12-03 03:40:47 +01:00
|
|
|
|
2025-06-18 20:03:28 -04:00
|
|
|
public override string Command => "me";
|
|
|
|
|
|
|
|
|
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
2020-12-03 03:40:47 +01:00
|
|
|
{
|
2023-10-28 09:59:53 +11:00
|
|
|
if (shell.Player is not { } player)
|
2020-12-03 03:40:47 +01:00
|
|
|
{
|
2025-06-18 20:03:28 -04:00
|
|
|
shell.WriteError(Loc.GetString($"shell-cannot-run-command-from-server"));
|
2020-12-03 03:40:47 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-25 10:38:52 +01:00
|
|
|
if (player.Status != SessionStatus.InGame)
|
2020-12-03 03:40:47 +01:00
|
|
|
return;
|
|
|
|
|
|
2022-01-25 10:38:52 +01:00
|
|
|
if (player.AttachedEntity is not {} playerEntity)
|
2020-12-03 03:40:47 +01:00
|
|
|
{
|
2025-06-18 20:03:28 -04:00
|
|
|
shell.WriteError(Loc.GetString($"shell-must-be-attached-to-entity"));
|
2021-03-16 15:50:20 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-25 10:38:52 +01:00
|
|
|
if (args.Length < 1)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var message = string.Join(" ", args).Trim();
|
|
|
|
|
if (string.IsNullOrEmpty(message))
|
2020-12-03 03:40:47 +01:00
|
|
|
return;
|
|
|
|
|
|
2025-06-18 20:03:28 -04:00
|
|
|
_chatSystem.TrySendInGameICMessage(playerEntity, message, InGameICChatType.Emote, ChatTransmitRange.Normal, false, shell, player);
|
2020-12-03 03:40:47 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|