2022-06-23 20:11:03 +10:00
|
|
|
using Content.Server.Chat.Systems;
|
2021-01-03 12:13:31 -03:00
|
|
|
using Content.Shared.Administration;
|
2021-02-01 16:49:43 -08:00
|
|
|
using Robust.Shared.Console;
|
2021-01-03 12:13:31 -03:00
|
|
|
|
|
|
|
|
namespace Content.Server.Administration.Commands
|
|
|
|
|
{
|
2024-06-01 04:14:43 -04:00
|
|
|
[AdminCommand(AdminFlags.Moderator)]
|
2022-02-16 00:23:23 -07:00
|
|
|
sealed class DSay : IConsoleCommand
|
2021-01-03 12:13:31 -03:00
|
|
|
{
|
2024-05-12 17:34:52 -07:00
|
|
|
[Dependency] private readonly IEntityManager _e = default!;
|
|
|
|
|
|
2021-01-03 12:13:31 -03:00
|
|
|
public string Command => "dsay";
|
|
|
|
|
|
2021-06-21 02:13:54 +02:00
|
|
|
public string Description => Loc.GetString("dsay-command-description");
|
2021-01-03 12:13:31 -03:00
|
|
|
|
2021-06-21 02:13:54 +02:00
|
|
|
public string Help => Loc.GetString("dsay-command-help-text", ("command", Command));
|
2021-01-03 12:13:31 -03:00
|
|
|
|
2021-02-01 16:49:43 -08:00
|
|
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
2021-01-03 12:13:31 -03:00
|
|
|
{
|
2024-08-11 09:46:57 +00:00
|
|
|
if (shell.Player is not { } player)
|
2021-01-03 12:13:31 -03:00
|
|
|
{
|
2024-08-11 09:46:57 +00:00
|
|
|
shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
|
2021-01-03 12:13:31 -03:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-30 22:21:58 -07:00
|
|
|
if (player.AttachedEntity is not { Valid: true } entity)
|
|
|
|
|
return;
|
|
|
|
|
|
2021-01-03 12:13:31 -03:00
|
|
|
if (args.Length < 1)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var message = string.Join(" ", args).Trim();
|
|
|
|
|
if (string.IsNullOrEmpty(message))
|
|
|
|
|
return;
|
|
|
|
|
|
2024-05-12 17:34:52 -07:00
|
|
|
var chat = _e.System<ChatSystem>();
|
2022-03-30 22:21:58 -07:00
|
|
|
chat.TrySendInGameOOCMessage(entity, message, InGameOOCChatType.Dead, false, shell, player);
|
2021-01-03 12:13:31 -03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|