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:
@@ -182,7 +182,6 @@ public sealed class AlertLevelSystem : EntitySystem
|
||||
|
||||
if (announce)
|
||||
{
|
||||
|
||||
_chatSystem.DispatchStationAnnouncement(station, announcementFull, playDefaultSound: playDefault,
|
||||
colorOverride: detail.Color, sender: stationName);
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
// you can't make a station announcement without a station
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
_chatManager.ChatMessageToManyFiltered(filter, ChatChannel.Radio, message, messageWrap, source, true, colorOverride);
|
||||
_chatManager.ChatMessageToManyFiltered(filter, ChatChannel.Radio, message, messageWrap, source, false, colorOverride);
|
||||
|
||||
if (playDefaultSound)
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -10,13 +10,12 @@ namespace Content.Server.Communications
|
||||
/// <summary>
|
||||
/// Remaining cooldown between making announcements.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float AnnouncementCooldownRemaining;
|
||||
|
||||
/// <summary>
|
||||
/// Has the UI already been refreshed after the announcement
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public bool AlreadyRefreshed = false;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -2,7 +2,6 @@ using System.Globalization;
|
||||
using Content.Server.Access.Systems;
|
||||
using Content.Server.AlertLevel;
|
||||
using Content.Server.Chat;
|
||||
using Content.Server.Chat.Managers;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.RoundEnd;
|
||||
using Content.Server.Station.Systems;
|
||||
@@ -199,12 +198,10 @@ namespace Content.Server.Communications
|
||||
if (comp.AnnounceGlobal)
|
||||
{
|
||||
_chatSystem.DispatchGlobalStationAnnouncement(msg, title, colorOverride: comp.AnnouncementColor);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
_chatSystem.DispatchStationAnnouncement(uid, msg, title, colorOverride: comp.AnnouncementColor);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCallShuttleMessage(EntityUid uid, CommunicationsConsoleComponent comp, CommunicationsConsoleCallEmergencyShuttleMessage message)
|
||||
{
|
||||
|
||||
@@ -305,6 +305,12 @@ public sealed class StationSystem : EntitySystem
|
||||
if (!Resolve(entity, ref xform))
|
||||
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 _))
|
||||
{
|
||||
// We are the station, just check ourselves.
|
||||
|
||||
@@ -63,8 +63,9 @@ public sealed class DiseaseOutbreak : StationEvent
|
||||
return;
|
||||
|
||||
var diseaseSystem = EntitySystem.Get<DiseaseSystem>();
|
||||
var stationSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<StationSystem>();
|
||||
var chatSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ChatSystem>();
|
||||
var entSysMgr = IoCManager.Resolve<IEntitySystemManager>();
|
||||
var stationSystem = entSysMgr.GetEntitySystem<StationSystem>();
|
||||
var chatSystem = entSysMgr.GetEntitySystem<ChatSystem>();
|
||||
// Now we give it to people in the list of living disease carriers earlier
|
||||
foreach (var target in aliveList)
|
||||
{
|
||||
|
||||
@@ -51,8 +51,9 @@ public sealed class RandomSentience : StationEvent
|
||||
var kind2 = groupList.Count > 1 ? groupList[1] : "???";
|
||||
var kind3 = groupList.Count > 2 ? groupList[2] : "???";
|
||||
|
||||
var stationSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<StationSystem>();
|
||||
var chatSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ChatSystem>();
|
||||
var entSysMgr = IoCManager.Resolve<IEntitySystemManager>();
|
||||
var stationSystem = entSysMgr.GetEntitySystem<StationSystem>();
|
||||
var chatSystem = entSysMgr.GetEntitySystem<ChatSystem>();
|
||||
foreach (var target in targetList)
|
||||
{
|
||||
var station = stationSystem.GetOwningStation(target.Owner);
|
||||
|
||||
@@ -43,8 +43,9 @@ namespace Content.Server.StationEvents.Events
|
||||
var toInfect = _random.Next(1, 3);
|
||||
|
||||
// Now we give it to people in the list of dead entities earlier.
|
||||
var stationSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<StationSystem>();
|
||||
var chatSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ChatSystem>();
|
||||
var entSysMgr = IoCManager.Resolve<IEntitySystemManager>();
|
||||
var stationSystem = entSysMgr.GetEntitySystem<StationSystem>();
|
||||
var chatSystem = entSysMgr.GetEntitySystem<ChatSystem>();
|
||||
foreach (var target in deadList)
|
||||
{
|
||||
if (toInfect-- == 0)
|
||||
|
||||
Reference in New Issue
Block a user