Fix comms consoles not working (#8644)

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
Veritius
2022-06-04 19:09:04 +10:00
committed by GitHub
parent 68a58aa0d1
commit 33faf00112
10 changed files with 37 additions and 30 deletions

View File

@@ -158,7 +158,7 @@ public sealed class ChatSystem : SharedChatSystem
bool playDefaultSound = true, Color? colorOverride = null)
{
var messageWrap = Loc.GetString("chat-manager-sender-announcement-wrap-message", ("sender", sender));
_chatManager.ChatMessageToAll(ChatChannel.Radio, message, messageWrap);
_chatManager.ChatMessageToAll(ChatChannel.Radio, message, messageWrap, colorOverride);
if (playDefaultSound)
{
SoundSystem.Play(Filter.Broadcast(), AnnouncementSound, AudioParams.Default.WithVolume(-2f));
@@ -180,21 +180,20 @@ public sealed class ChatSystem : SharedChatSystem
var station = _stationSystem.GetOwningStation(source);
var filter = Filter.Empty();
if (station != null)
if (station == null)
{
if (!EntityManager.TryGetComponent<StationDataComponent>(station, out var stationDataComp)) return;
foreach (var gridEnt in stationDataComp.Grids)
{
filter.AddInGrid(gridEnt);
}
}
else
{
filter = Filter.Pvs(source, entityManager: EntityManager);
// you can't make a station announcement without a station
return;
}
_chatManager.ChatMessageToManyFiltered(filter, ChatChannel.Radio, message, messageWrap, source, true, colorOverride);
if (!EntityManager.TryGetComponent<StationDataComponent>(station, out var stationDataComp)) return;
foreach (var gridEnt in stationDataComp.Grids)
{
filter.AddInGrid(gridEnt);
}
_chatManager.ChatMessageToManyFiltered(filter, ChatChannel.Radio, message, messageWrap, source, false, colorOverride);
if (playDefaultSound)
{

View File

@@ -218,7 +218,7 @@ namespace Content.Server.Chat.Managers
_netManager.ServerSendMessage(msg, client);
}
public void ChatMessageToMany(ChatChannel channel, string message, string messageWrap, EntityUid source, bool hideChat, List<INetChannel> clients)
public void ChatMessageToMany(ChatChannel channel, string message, string messageWrap, EntityUid source, bool hideChat, List<INetChannel> clients, Color? colorOverride = null)
{
var msg = new MsgChatMessage();
msg.Channel = channel;
@@ -226,6 +226,10 @@ namespace Content.Server.Chat.Managers
msg.MessageWrap = messageWrap;
msg.SenderEntity = source;
msg.HideChat = hideChat;
if (colorOverride != null)
{
msg.MessageColorOverride = colorOverride.Value;
}
_netManager.ServerSendToMany(msg, clients);
}
@@ -240,7 +244,7 @@ namespace Content.Server.Chat.Managers
clients.Add(recipient.ConnectedClient);
}
ChatMessageToMany(channel, message, messageWrap, source, hideChat, clients);
ChatMessageToMany(channel, message, messageWrap, source, hideChat, clients, colorOverride);
}
public void ChatMessageToAll(ChatChannel channel, string message, string messageWrap, Color? colorOverride = null)

View File

@@ -26,7 +26,7 @@ namespace Content.Server.Chat.Managers
void ChatMessageToOne(ChatChannel channel, string message, string messageWrap, EntityUid source, bool hideChat,
INetChannel client);
void ChatMessageToMany(ChatChannel channel, string message, string messageWrap, EntityUid source, bool hideChat,
List<INetChannel> clients);
List<INetChannel> clients, Color? colorOverride = null);
void ChatMessageToManyFiltered(Filter filter, ChatChannel channel, string message, string messageWrap, EntityUid source, bool hideChat, Color? colorOverride);
void ChatMessageToAll(ChatChannel channel, string message, string messageWrap, Color? colorOverride = null);