From ba91f27baf4b900751283b3c9bcf078488cbae61 Mon Sep 17 00:00:00 2001 From: Unbistrackted <112902220+Unbistrackted@users.noreply.github.com> Date: Mon, 23 Feb 2026 02:45:15 -0300 Subject: [PATCH 1/7] feat(warhead): Add ``IsOnCooldown`` property (#757) --- EXILED/Exiled.API/Features/Warhead.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/EXILED/Exiled.API/Features/Warhead.cs b/EXILED/Exiled.API/Features/Warhead.cs index f261577770..5b53082a8c 100644 --- a/EXILED/Exiled.API/Features/Warhead.cs +++ b/EXILED/Exiled.API/Features/Warhead.cs @@ -129,6 +129,11 @@ public static WarheadStatus Status /// public static bool IsInProgress => Controller.Info.InProgress; + /// + /// Gets a value indicating whether the warhead detonation is on cooldown. + /// + public static bool IsOnCooldown => Controller.CooldownEndTime > NetworkTime.time; + /// /// Gets or sets the warhead detonation timer. /// @@ -164,7 +169,7 @@ public static int Kills /// /// Gets a value indicating whether the warhead can be started. /// - public static bool CanBeStarted => !IsInProgress && !IsDetonated && Controller.CooldownEndTime <= NetworkTime.time; + public static bool CanBeStarted => !IsInProgress && !IsDetonated && !IsOnCooldown; /// /// Closes the surface blast doors. From dce184fbdafeac9c0b8e5cb681c59c34cb808df2 Mon Sep 17 00:00:00 2001 From: Unbistrackted <112902220+Unbistrackted@users.noreply.github.com> Date: Mon, 23 Feb 2026 07:04:31 -0300 Subject: [PATCH 2/7] feat(warhead): Add WarheadStatus.OnCooldown --- EXILED/Exiled.API/Enums/WarheadStatus.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/EXILED/Exiled.API/Enums/WarheadStatus.cs b/EXILED/Exiled.API/Enums/WarheadStatus.cs index e839c0b8dc..59d3619be2 100644 --- a/EXILED/Exiled.API/Enums/WarheadStatus.cs +++ b/EXILED/Exiled.API/Enums/WarheadStatus.cs @@ -32,5 +32,10 @@ public enum WarheadStatus /// The warhead has detonated. /// Detonated, + + /// + /// The warhead is on cooldown. + /// + OnCooldown, } } \ No newline at end of file From a4d80d4cff899025730f9a2cd220ffaf858da778 Mon Sep 17 00:00:00 2001 From: Unbistrackted <112902220+Unbistrackted@users.noreply.github.com> Date: Mon, 23 Feb 2026 07:06:20 -0300 Subject: [PATCH 3/7] feat(warhead): Add ``RemainingCooldown`` property Change from ternary operators for readability Add case for ``WarheadStatus.OnCooldown`` --- EXILED/Exiled.API/Features/Warhead.cs | 33 +++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/EXILED/Exiled.API/Features/Warhead.cs b/EXILED/Exiled.API/Features/Warhead.cs index 5b53082a8c..25779bb1ba 100644 --- a/EXILED/Exiled.API/Features/Warhead.cs +++ b/EXILED/Exiled.API/Features/Warhead.cs @@ -7,12 +7,12 @@ namespace Exiled.API.Features { + using System; using System.Collections.Generic; using Enums; using Interactables.Interobjects.DoorUtils; using Mirror; - using UnityEngine; /// @@ -69,6 +69,15 @@ public static bool OpenDoors set => Controller._openDoors = value; } + /// + /// Gets or sets the remaining cooldown before the nuke can be triggered again. + /// + public static double RemainingCooldown + { + get => Math.Max(0, Controller.NetworkCooldownEndTime - NetworkTime.time); + set => Controller.NetworkCooldownEndTime = NetworkTime.time + Math.Max(0, value); + } + /// /// Gets all of the warhead blast doors. /// @@ -97,7 +106,23 @@ public static bool IsKeycardActivated /// public static WarheadStatus Status { - get => IsInProgress ? IsDetonated ? WarheadStatus.Detonated : WarheadStatus.InProgress : LeverStatus ? WarheadStatus.Armed : WarheadStatus.NotArmed; + get + { + if (IsDetonated) + return WarheadStatus.Detonated; + + if (IsInProgress) + return WarheadStatus.InProgress; + + if (IsOnCooldown) + return WarheadStatus.OnCooldown; + + if (LeverStatus) + return WarheadStatus.Armed; + + return WarheadStatus.NotArmed; + } + set { switch (value) @@ -115,6 +140,10 @@ public static WarheadStatus Status case WarheadStatus.Detonated: Detonate(); break; + + case WarheadStatus.OnCooldown: + RemainingCooldown = Controller._cooldown; + break; } } } From c74c6b0fe04522a8553aab9ef7c9f5bf2fa61858 Mon Sep 17 00:00:00 2001 From: Unbistrackted <112902220+Unbistrackted@users.noreply.github.com> Date: Mon, 23 Feb 2026 07:14:12 -0300 Subject: [PATCH 4/7] fix(warhead): Use ``Warhead.RemainingCooldown`` instead --- EXILED/Exiled.API/Features/Warhead.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EXILED/Exiled.API/Features/Warhead.cs b/EXILED/Exiled.API/Features/Warhead.cs index 25779bb1ba..9ad94d1f62 100644 --- a/EXILED/Exiled.API/Features/Warhead.cs +++ b/EXILED/Exiled.API/Features/Warhead.cs @@ -161,7 +161,7 @@ public static WarheadStatus Status /// /// Gets a value indicating whether the warhead detonation is on cooldown. /// - public static bool IsOnCooldown => Controller.CooldownEndTime > NetworkTime.time; + public static bool IsOnCooldown => RemainingCooldown > 0; /// /// Gets or sets the warhead detonation timer. From fc45e833b363be5558efb9731aab3a8a57bac6a6 Mon Sep 17 00:00:00 2001 From: Unbistrackted <112902220+Unbistrackted@users.noreply.github.com> Date: Mon, 23 Feb 2026 07:32:34 -0300 Subject: [PATCH 5/7] feat(warhead): ``WarheadStatus`` as Flag As per @louis1706 recommendation --- EXILED/Exiled.API/Enums/WarheadStatus.cs | 3 +++ EXILED/Exiled.API/Features/Warhead.cs | 12 +++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/EXILED/Exiled.API/Enums/WarheadStatus.cs b/EXILED/Exiled.API/Enums/WarheadStatus.cs index 59d3619be2..22c5260385 100644 --- a/EXILED/Exiled.API/Enums/WarheadStatus.cs +++ b/EXILED/Exiled.API/Enums/WarheadStatus.cs @@ -7,10 +7,13 @@ namespace Exiled.API.Enums { + using System; + /// /// All the available warhead statuses. /// /// + [Flags] public enum WarheadStatus { /// diff --git a/EXILED/Exiled.API/Features/Warhead.cs b/EXILED/Exiled.API/Features/Warhead.cs index 9ad94d1f62..eb11a7b930 100644 --- a/EXILED/Exiled.API/Features/Warhead.cs +++ b/EXILED/Exiled.API/Features/Warhead.cs @@ -108,19 +108,21 @@ public static WarheadStatus Status { get { + WarheadStatus status = WarheadStatus.NotArmed; + if (IsDetonated) - return WarheadStatus.Detonated; + status |= WarheadStatus.Detonated; if (IsInProgress) - return WarheadStatus.InProgress; + status |= WarheadStatus.InProgress; if (IsOnCooldown) - return WarheadStatus.OnCooldown; + status |= WarheadStatus.OnCooldown; if (LeverStatus) - return WarheadStatus.Armed; + status |= WarheadStatus.Armed; - return WarheadStatus.NotArmed; + return status; } set From d38afd05c91de748df87380fb79aaf71559f1bf3 Mon Sep 17 00:00:00 2001 From: Unbistrackted <112902220+Unbistrackted@users.noreply.github.com> Date: Mon, 23 Feb 2026 07:39:05 -0300 Subject: [PATCH 6/7] fix(warhead): Add the byte values cause my visual studio didn't saved --- EXILED/Exiled.API/Enums/WarheadStatus.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/EXILED/Exiled.API/Enums/WarheadStatus.cs b/EXILED/Exiled.API/Enums/WarheadStatus.cs index 22c5260385..ed6f7d5a6d 100644 --- a/EXILED/Exiled.API/Enums/WarheadStatus.cs +++ b/EXILED/Exiled.API/Enums/WarheadStatus.cs @@ -19,26 +19,26 @@ public enum WarheadStatus /// /// The warhead is not armed. /// - NotArmed, + NotArmed = 0, /// /// The warhead is armed. /// - Armed, + Armed = 1, /// /// The warhead detonation is in progress. /// - InProgress, + InProgress = 2, /// /// The warhead has detonated. /// - Detonated, + Detonated = 4, /// /// The warhead is on cooldown. /// - OnCooldown, + OnCooldown = 8, } } \ No newline at end of file From c580a6920b64815d4d6a5d0190f197710d04e7ef Mon Sep 17 00:00:00 2001 From: Unbistrackted <112902220+Unbistrackted@users.noreply.github.com> Date: Thu, 26 Feb 2026 05:09:57 -0300 Subject: [PATCH 7/7] fix(warhead): change status setter to use flags --- EXILED/Exiled.API/Features/Warhead.cs | 33 +++++++++++---------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/EXILED/Exiled.API/Features/Warhead.cs b/EXILED/Exiled.API/Features/Warhead.cs index eb11a7b930..ac96d4f8e5 100644 --- a/EXILED/Exiled.API/Features/Warhead.cs +++ b/EXILED/Exiled.API/Features/Warhead.cs @@ -11,6 +11,7 @@ namespace Exiled.API.Features using System.Collections.Generic; using Enums; + using Exiled.API.Extensions; using Interactables.Interobjects.DoorUtils; using Mirror; using UnityEngine; @@ -127,26 +128,18 @@ public static WarheadStatus Status set { - switch (value) - { - case WarheadStatus.NotArmed: - case WarheadStatus.Armed: - Stop(); - LeverStatus = value is WarheadStatus.Armed; - break; - - case WarheadStatus.InProgress: - Start(); - break; - - case WarheadStatus.Detonated: - Detonate(); - break; - - case WarheadStatus.OnCooldown: - RemainingCooldown = Controller._cooldown; - break; - } + LeverStatus = value.HasFlagFast(WarheadStatus.Armed); + + if (value.HasFlagFast(WarheadStatus.InProgress)) + Start(); + else + Stop(); + + if (value.HasFlagFast(WarheadStatus.Detonated)) + Detonate(); + + if (value.HasFlagFast(WarheadStatus.OnCooldown)) + RemainingCooldown = Controller._cooldown; } }