Adds DSay command (#2901)
* DSay command * Moves getting the clients from DeadChat and AdminDeadChat to a function
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.GUI;
|
||||
@@ -212,9 +212,7 @@ namespace Content.Server.Chat
|
||||
return;
|
||||
}
|
||||
|
||||
var clients = _playerManager
|
||||
.GetPlayersBy(x => x.AttachedEntity != null && x.AttachedEntity.HasComponent<GhostComponent>())
|
||||
.Select(p => p.ConnectedClient);
|
||||
var clients = GetDeadChatClients();
|
||||
|
||||
var msg = _netManager.CreateNetMessage<MsgChatMessage>();
|
||||
msg.Channel = ChatChannel.Dead;
|
||||
@@ -224,6 +222,31 @@ namespace Content.Server.Chat
|
||||
_netManager.ServerSendToMany(msg, clients.ToList());
|
||||
}
|
||||
|
||||
public void SendAdminDeadChat(IPlayerSession player, string message)
|
||||
{
|
||||
// Check if message exceeds the character limit
|
||||
if (message.Length > MaxMessageLength)
|
||||
{
|
||||
DispatchServerMessage(player, Loc.GetString(MaxLengthExceededMessage, MaxMessageLength));
|
||||
return;
|
||||
}
|
||||
|
||||
var clients = GetDeadChatClients();
|
||||
|
||||
var msg = _netManager.CreateNetMessage<MsgChatMessage>();
|
||||
msg.Channel = ChatChannel.Dead;
|
||||
msg.Message = message;
|
||||
msg.MessageWrap = $"{Loc.GetString("ADMIN")}:(${player.ConnectedClient.UserName}): {{0}}";
|
||||
_netManager.ServerSendToMany(msg, clients.ToList());
|
||||
}
|
||||
|
||||
private IEnumerable<INetChannel> GetDeadChatClients()
|
||||
{
|
||||
return _playerManager
|
||||
.GetPlayersBy(x => x.AttachedEntity != null && x.AttachedEntity.HasComponent<GhostComponent>())
|
||||
.Select(p => p.ConnectedClient);
|
||||
}
|
||||
|
||||
public void SendAdminChat(IPlayerSession player, string message)
|
||||
{
|
||||
// Check if message exceeds the character limit
|
||||
|
||||
Reference in New Issue
Block a user