From 8273434af598ab5bb9f5aaa416b88351a5983b6a Mon Sep 17 00:00:00 2001 From: EmoGarbage404 <98561806+EmoGarbage404@users.noreply.github.com> Date: Mon, 20 Jun 2022 16:59:04 -0400 Subject: [PATCH] death to it (#8981) --- Content.Server/Chat/ChatSystem.cs | 14 ++++++++++++++ Content.Shared/CCVar/CCVars.cs | 6 ++++++ 2 files changed, 20 insertions(+) diff --git a/Content.Server/Chat/ChatSystem.cs b/Content.Server/Chat/ChatSystem.cs index a874126cbf..9ca58abaff 100644 --- a/Content.Server/Chat/ChatSystem.cs +++ b/Content.Server/Chat/ChatSystem.cs @@ -3,6 +3,7 @@ using System.Text; using Content.Server.Administration.Logs; using Content.Server.Administration.Managers; using Content.Server.Chat.Managers; +using Content.Server.GameTicking; using Content.Server.Ghost.Components; using Content.Server.Headset; using Content.Server.Players; @@ -56,6 +57,8 @@ public sealed class ChatSystem : SharedChatSystem public override void Initialize() { _configurationManager.OnValueChanged(CCVars.LoocEnabled, OnLoocEnabledChanged, true); + + SubscribeLocalEvent(OnGameChange); } public override void Shutdown() @@ -72,6 +75,17 @@ public sealed class ChatSystem : SharedChatSystem Loc.GetString(val ? "chat-manager-looc-chat-enabled-message" : "chat-manager-looc-chat-disabled-message")); } + private void OnGameChange(GameRunLevelChangedEvent ev) + { + if (_configurationManager.GetCVar(CCVars.OocEnableDuringRound)) + return; + + if (ev.New == GameRunLevel.InRound) + _configurationManager.SetCVar(CCVars.OocEnabled, false); + else if (ev.New == GameRunLevel.PostRound) + _configurationManager.SetCVar(CCVars.OocEnabled, true); + } + // ReSharper disable once InconsistentNaming public void TrySendInGameICMessage(EntityUid source, string message, InGameICChatType desiredType, bool hideChat, IConsoleShell? shell = null, IPlayerSession? player = null) diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index 392f6bde05..1e15e71157 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -728,6 +728,12 @@ namespace Content.Shared.CCVar /// public static readonly CVarDef DisablingOOCDisablesRelay = CVarDef.Create("ooc.disabling_ooc_disables_relay", true, CVar.SERVERONLY); + /// + /// Whether or not OOC chat should be enabled during a round. + /// + public static readonly CVarDef OocEnableDuringRound = + CVarDef.Create("ooc.enable_during_round", false, CVar.NOTIFY | CVar.REPLICATED |CVar.SERVER); + /* * LOOC */