From 36fe294bcc8b1f4ed0063ff28eda5abbcfbe443f Mon Sep 17 00:00:00 2001 From: Justin Pfeifler Date: Mon, 8 Jan 2024 06:28:06 -0600 Subject: [PATCH] Add Initial Cooldown To Communications Computers (#21681) * Add initial delay variable * Add cooldown to console on spawn * shock --------- Co-authored-by: metalgearsloth --- .../Communications/CommunicationsConsoleComponent.cs | 8 ++++++++ .../Communications/CommunicationsConsoleSystem.cs | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/Content.Server/Communications/CommunicationsConsoleComponent.cs b/Content.Server/Communications/CommunicationsConsoleComponent.cs index e2aa0d7620..52f3087b65 100644 --- a/Content.Server/Communications/CommunicationsConsoleComponent.cs +++ b/Content.Server/Communications/CommunicationsConsoleComponent.cs @@ -13,6 +13,7 @@ namespace Content.Server.Communications /// Remaining cooldown between making announcements. /// [ViewVariables(VVAccess.ReadWrite)] + [DataField] public float AnnouncementCooldownRemaining; /// @@ -37,6 +38,13 @@ namespace Content.Server.Communications [DataField] public int Delay = 90; + /// + /// Time in seconds of announcement cooldown when a new console is created on a per-console basis + /// + [ViewVariables(VVAccess.ReadWrite)] + [DataField] + public int InitialDelay = 30; + /// /// Can call or recall the shuttle /// diff --git a/Content.Server/Communications/CommunicationsConsoleSystem.cs b/Content.Server/Communications/CommunicationsConsoleSystem.cs index b2945c2a11..ea27450956 100644 --- a/Content.Server/Communications/CommunicationsConsoleSystem.cs +++ b/Content.Server/Communications/CommunicationsConsoleSystem.cs @@ -52,6 +52,9 @@ namespace Content.Server.Communications SubscribeLocalEvent(OnAnnounceMessage); SubscribeLocalEvent(OnCallShuttleMessage); SubscribeLocalEvent(OnRecallShuttleMessage); + + // On console init, set cooldown + SubscribeLocalEvent(OnCommunicationsConsoleMapInit); } public override void Update(float frameTime) @@ -79,6 +82,11 @@ namespace Content.Server.Communications base.Update(frameTime); } + public void OnCommunicationsConsoleMapInit(EntityUid uid, CommunicationsConsoleComponent comp, MapInitEvent args) + { + comp.AnnouncementCooldownRemaining = comp.InitialDelay; + } + /// /// Update the UI of every comms console. ///