* move chat stuff to shared * refactor: using cleanup +whitespaces + xml-doc * review --------- Co-authored-by: pa.pecherskij <pa.pecherskij@interfax.ru>
39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
using Content.Server.Chat.Systems;
|
|
using Content.Shared.Administration;
|
|
using Content.Shared.Chat;
|
|
using Robust.Shared.Console;
|
|
|
|
namespace Content.Server.Administration.Commands;
|
|
|
|
[AdminCommand(AdminFlags.Moderator)]
|
|
public sealed class DsayCommand : LocalizedEntityCommands
|
|
{
|
|
[Dependency] private readonly ChatSystem _chatSystem = default!;
|
|
|
|
public override string Command => "dsay";
|
|
|
|
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.AttachedEntity is not { Valid: true } entity)
|
|
{
|
|
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.TrySendInGameOOCMessage(entity, message, InGameOOCChatType.Dead, false, shell, player);
|
|
}
|
|
}
|