Merge branch 'master' into buckle-locker-fix-1262

This commit is contained in:
DrSmugleaf
2020-07-08 15:35:20 +02:00
121 changed files with 1116 additions and 772 deletions

View File

@@ -4,6 +4,7 @@ using Content.Server.Interfaces.Chat;
using Content.Server.Interfaces.GameObjects;
using Content.Server.Players;
using Content.Shared.GameObjects;
using Robust.Server.Console;
using Robust.Server.Interfaces.Console;
using Robust.Server.Interfaces.Player;
using Robust.Shared.Enums;
@@ -80,6 +81,19 @@ namespace Content.Server.Chat
}
}
internal class AdminChatCommand : IClientCommand
{
public string Command => "asay";
public string Description => "Send chat messages to the private admin chat channel.";
public string Help => "asay <text>";
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
{
var chat = IoCManager.Resolve<IChatManager>();
chat.SendAdminChat(player, string.Join(" ", args));
}
}
internal class SuicideCommand : IClientCommand
{
public string Command => "suicide";

View File

@@ -7,6 +7,7 @@ using Content.Server.Observer;
using Content.Server.Players;
using Content.Shared.Chat;
using Content.Shared.GameObjects.EntitySystems;
using Robust.Server.Console;
using Robust.Server.Interfaces.Player;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Network;
@@ -28,6 +29,7 @@ namespace Content.Server.Chat
[Dependency] private readonly IPlayerManager _playerManager;
[Dependency] private readonly ILocalizationManager _localizationManager;
[Dependency] private readonly IMoMMILink _mommiLink;
[Dependency] private readonly IConGroupController _conGroupController;
#pragma warning restore 649
public void Initialize()
@@ -112,6 +114,23 @@ namespace Content.Server.Chat
_netManager.ServerSendToMany(msg, clients.ToList());
}
public void SendAdminChat(IPlayerSession player, string message)
{
if(!_conGroupController.CanCommand(player, "asay"))
{
SendOOC(player, message);
return;
}
var clients = _playerManager.GetPlayersBy(x => _conGroupController.CanCommand(x, "asay")).Select(p => p.ConnectedClient);;
var msg = _netManager.CreateNetMessage<MsgChatMessage>();
msg.Channel = ChatChannel.AdminChat;
msg.Message = message;
msg.MessageWrap = $"{_localizationManager.GetString("ADMIN")}: {player.SessionId}: {{0}}";
_netManager.ServerSendToMany(msg, clients.ToList());
}
public void SendHookOOC(string sender, string message)
{
var msg = _netManager.CreateNetMessage<MsgChatMessage>();