main cult
This commit is contained in:
48
Content.Server/Chat/Commands/CultCommand.cs
Normal file
48
Content.Server/Chat/Commands/CultCommand.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using Content.Server.Chat.Systems;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Chat;
|
||||
using Content.Shared.White.Cult;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Enums;
|
||||
|
||||
namespace Content.Server.Chat.Commands
|
||||
{
|
||||
[AnyCommand]
|
||||
internal sealed class CultCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "csay";
|
||||
public string Description => "Send cult message";
|
||||
public string Help => "csay <text>";
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (shell.Player is not IPlayerSession player)
|
||||
{
|
||||
shell.WriteError("This command cannot be run from the server.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.AttachedEntity is not { Valid: true } entity)
|
||||
return;
|
||||
|
||||
if (player.Status != SessionStatus.InGame)
|
||||
return;
|
||||
|
||||
if (args.Length < 1)
|
||||
return;
|
||||
|
||||
var entityManager = IoCManager.Resolve<EntityManager>();
|
||||
|
||||
if (!entityManager.HasComponent<CultistComponent>(entity))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var message = string.Join(" ", args).Trim();
|
||||
if (string.IsNullOrEmpty(message))
|
||||
return;
|
||||
EntitySystem.Get<ChatSystem>().TrySendInGameOOCMessage(entity, message, InGameOOCChatType.Cult, false, shell, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,7 @@ using Content.Shared.Players;
|
||||
using Content.Shared.Radio;
|
||||
using Content.Shared.White;
|
||||
using Content.Shared.Speech;
|
||||
using Content.Shared.White.Cult;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
@@ -343,6 +344,9 @@ public sealed partial class ChatSystem : SharedChatSystem
|
||||
case InGameOOCChatType.Looc:
|
||||
SendLOOC(source, player, message, hideChat);
|
||||
break;
|
||||
case InGameOOCChatType.Cult:
|
||||
SendCultChat(source, player, message, hideChat);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -701,6 +705,32 @@ public sealed partial class ChatSystem : SharedChatSystem
|
||||
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"LOOC from {player:Player}: {message}");
|
||||
}
|
||||
|
||||
// WD EDIT
|
||||
private void SendCultChat(EntityUid source, ICommonSession player, string message, bool hideChat)
|
||||
{
|
||||
var clients = GetCultChatClients();
|
||||
var playerName = Name(source);
|
||||
string wrappedMessage;
|
||||
wrappedMessage = Loc.GetString("chat-manager-send-cult-chat-wrap-message",
|
||||
("channelName", Loc.GetString("chat-manager-cult-channel-name")),
|
||||
("player", playerName),
|
||||
("message", FormattedMessage.EscapeText(message)));
|
||||
|
||||
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"Cult chat from {player:Player}: {message}");
|
||||
|
||||
_chatManager.ChatMessageToMany(ChatChannel.Cult, message, wrappedMessage, source, hideChat, false, clients.ToList());
|
||||
}
|
||||
|
||||
private IEnumerable<INetChannel> GetCultChatClients()
|
||||
{
|
||||
return Filter.Empty()
|
||||
.AddWhereAttachedEntity(HasComp<GhostComponent>)
|
||||
.AddWhereAttachedEntity(HasComp<CultistComponent>)
|
||||
.Recipients
|
||||
.Union(_adminManager.ActiveAdmins)
|
||||
.Select(p => p.ConnectedClient);
|
||||
}
|
||||
|
||||
private void SendDeadChat(EntityUid source, ICommonSession player, string message, bool hideChat)
|
||||
{
|
||||
var clients = GetDeadChatClients();
|
||||
@@ -1104,7 +1134,8 @@ public enum InGameICChatType : byte
|
||||
public enum InGameOOCChatType : byte
|
||||
{
|
||||
Looc,
|
||||
Dead
|
||||
Dead,
|
||||
Cult
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user