2020-12-03 03:40:47 +01:00
|
|
|
using Content.Server.Administration;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Server.Chat.Managers;
|
2020-12-03 03:40:47 +01:00
|
|
|
using Content.Server.Players;
|
2021-12-13 16:45:49 +11:00
|
|
|
using Content.Shared.Administration;
|
2021-02-11 01:13:03 -08:00
|
|
|
using Robust.Server.Player;
|
2021-02-01 16:49:43 -08:00
|
|
|
using Robust.Shared.Console;
|
2020-12-03 03:40:47 +01:00
|
|
|
using Robust.Shared.Enums;
|
|
|
|
|
using Robust.Shared.IoC;
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Server.Chat.Commands
|
2020-12-03 03:40:47 +01:00
|
|
|
{
|
|
|
|
|
[AnyCommand]
|
2022-02-16 00:23:23 -07:00
|
|
|
internal sealed class MeCommand : IConsoleCommand
|
2020-12-03 03:40:47 +01:00
|
|
|
{
|
|
|
|
|
public string Command => "me";
|
|
|
|
|
public string Description => "Perform an action.";
|
|
|
|
|
public string Help => "me <text>";
|
|
|
|
|
|
2021-02-01 16:49:43 -08:00
|
|
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
2020-12-03 03:40:47 +01:00
|
|
|
{
|
2022-01-25 10:38:52 +01:00
|
|
|
if (shell.Player is not IPlayerSession player)
|
2020-12-03 03:40:47 +01:00
|
|
|
{
|
2022-01-25 10:38:52 +01:00
|
|
|
shell.WriteError("This command cannot be run from the 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
|
|
|
{
|
2022-01-25 10:38:52 +01:00
|
|
|
shell.WriteError("You don't have an 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;
|
|
|
|
|
|
2022-01-25 10:38:52 +01:00
|
|
|
IoCManager.Resolve<IChatManager>().TryEmote(playerEntity, message, shell, player);
|
2020-12-03 03:40:47 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|