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

@@ -182,7 +182,6 @@ public sealed class AlertLevelSystem : EntitySystem
if (announce) if (announce)
{ {
_chatSystem.DispatchStationAnnouncement(station, announcementFull, playDefaultSound: playDefault, _chatSystem.DispatchStationAnnouncement(station, announcementFull, playDefaultSound: playDefault,
colorOverride: detail.Color, sender: stationName); colorOverride: detail.Color, sender: stationName);
} }

View File

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

View File

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

View File

@@ -10,13 +10,12 @@ namespace Content.Server.Communications
/// <summary> /// <summary>
/// Remaining cooldown between making announcements. /// Remaining cooldown between making announcements.
/// </summary> /// </summary>
[ViewVariables] [ViewVariables(VVAccess.ReadWrite)]
public float AnnouncementCooldownRemaining; public float AnnouncementCooldownRemaining;
/// <summary> /// <summary>
/// Has the UI already been refreshed after the announcement /// Has the UI already been refreshed after the announcement
/// </summary> /// </summary>
[ViewVariables]
public bool AlreadyRefreshed = false; public bool AlreadyRefreshed = false;
/// <summary> /// <summary>

View File

@@ -2,7 +2,6 @@ using System.Globalization;
using Content.Server.Access.Systems; using Content.Server.Access.Systems;
using Content.Server.AlertLevel; using Content.Server.AlertLevel;
using Content.Server.Chat; using Content.Server.Chat;
using Content.Server.Chat.Managers;
using Content.Server.Popups; using Content.Server.Popups;
using Content.Server.RoundEnd; using Content.Server.RoundEnd;
using Content.Server.Station.Systems; using Content.Server.Station.Systems;
@@ -199,12 +198,10 @@ namespace Content.Server.Communications
if (comp.AnnounceGlobal) if (comp.AnnounceGlobal)
{ {
_chatSystem.DispatchGlobalStationAnnouncement(msg, title, colorOverride: comp.AnnouncementColor); _chatSystem.DispatchGlobalStationAnnouncement(msg, title, colorOverride: comp.AnnouncementColor);
return;
} }
else
{
_chatSystem.DispatchStationAnnouncement(uid, msg, title, colorOverride: comp.AnnouncementColor); _chatSystem.DispatchStationAnnouncement(uid, msg, title, colorOverride: comp.AnnouncementColor);
} }
}
private void OnCallShuttleMessage(EntityUid uid, CommunicationsConsoleComponent comp, CommunicationsConsoleCallEmergencyShuttleMessage message) private void OnCallShuttleMessage(EntityUid uid, CommunicationsConsoleComponent comp, CommunicationsConsoleCallEmergencyShuttleMessage message)
{ {

View File

@@ -305,6 +305,12 @@ public sealed class StationSystem : EntitySystem
if (!Resolve(entity, ref xform)) if (!Resolve(entity, ref xform))
throw new ArgumentException("Tried to use an abstract entity!", nameof(entity)); throw new ArgumentException("Tried to use an abstract entity!", nameof(entity));
if (TryComp<StationDataComponent>(entity, out _))
{
// We are the station, just return ourselves.
return entity;
}
if (TryComp<IMapGridComponent>(entity, out _)) if (TryComp<IMapGridComponent>(entity, out _))
{ {
// We are the station, just check ourselves. // We are the station, just check ourselves.

View File

@@ -63,8 +63,9 @@ public sealed class DiseaseOutbreak : StationEvent
return; return;
var diseaseSystem = EntitySystem.Get<DiseaseSystem>(); var diseaseSystem = EntitySystem.Get<DiseaseSystem>();
var stationSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<StationSystem>(); var entSysMgr = IoCManager.Resolve<IEntitySystemManager>();
var chatSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ChatSystem>(); var stationSystem = entSysMgr.GetEntitySystem<StationSystem>();
var chatSystem = entSysMgr.GetEntitySystem<ChatSystem>();
// Now we give it to people in the list of living disease carriers earlier // Now we give it to people in the list of living disease carriers earlier
foreach (var target in aliveList) foreach (var target in aliveList)
{ {

View File

@@ -51,8 +51,9 @@ public sealed class RandomSentience : StationEvent
var kind2 = groupList.Count > 1 ? groupList[1] : "???"; var kind2 = groupList.Count > 1 ? groupList[1] : "???";
var kind3 = groupList.Count > 2 ? groupList[2] : "???"; var kind3 = groupList.Count > 2 ? groupList[2] : "???";
var stationSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<StationSystem>(); var entSysMgr = IoCManager.Resolve<IEntitySystemManager>();
var chatSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ChatSystem>(); var stationSystem = entSysMgr.GetEntitySystem<StationSystem>();
var chatSystem = entSysMgr.GetEntitySystem<ChatSystem>();
foreach (var target in targetList) foreach (var target in targetList)
{ {
var station = stationSystem.GetOwningStation(target.Owner); var station = stationSystem.GetOwningStation(target.Owner);

View File

@@ -43,8 +43,9 @@ namespace Content.Server.StationEvents.Events
var toInfect = _random.Next(1, 3); var toInfect = _random.Next(1, 3);
// Now we give it to people in the list of dead entities earlier. // Now we give it to people in the list of dead entities earlier.
var stationSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<StationSystem>(); var entSysMgr = IoCManager.Resolve<IEntitySystemManager>();
var chatSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ChatSystem>(); var stationSystem = entSysMgr.GetEntitySystem<StationSystem>();
var chatSystem = entSysMgr.GetEntitySystem<ChatSystem>();
foreach (var target in deadList) foreach (var target in deadList)
{ {
if (toInfect-- == 0) if (toInfect-- == 0)