diff --git a/EXILED/Exiled.API/Features/Respawn.cs b/EXILED/Exiled.API/Features/Respawn.cs index 0f3449552..33d1130e8 100644 --- a/EXILED/Exiled.API/Features/Respawn.cs +++ b/EXILED/Exiled.API/Features/Respawn.cs @@ -388,10 +388,62 @@ public static void ForceWave(SpawnableWaveBase spawnableWaveBase) WaveManager.Spawn(spawnableWaveBase); } + /// + /// Forcefully pauses or resumes the timer of a time-based respawn wave for the specified faction. + /// + /// The faction associated with the respawn wave. + /// True to pause the wave timer, false to resume it. + public static void ForcePauseWave(SpawnableFaction spawnableFaction, bool isForcePause = true) + { + if (TryGetWaveBase(spawnableFaction, out SpawnableWaveBase spawnableWaveBase)) + { + if (spawnableWaveBase is TimeBasedWave timeBasedWave) + { + timeBasedWave.Timer.IsForcefullyPaused = isForcePause; + } + } + } + + /// + /// Forcefully pauses or resumes all time-based respawn waves by controlling their timers. + /// + /// + /// If true, all time-based waves will be paused. If false, their timers will resume. + /// + /// + /// Unlike ClearWaves, this does not remove waves from the system, it only controls their timer state. + /// + public static void ForcePauseWaves(bool isForcePause = true) + { + foreach (SpawnableWaveBase wave in WaveManager.Waves) + { + if (wave is TimeBasedWave timeBasedWave) + { + timeBasedWave.Timer.IsForcefullyPaused = isForcePause; + } + } + } + + /// + /// Pauses the specified list of respawn waves by iterating through each wave + /// and pausing it using the method. + /// + /// + /// A list of instances representing the waves to pause. + /// + public static void ForcePauseWaves(List spawnableFactions) + { + foreach (SpawnableFaction spawnableFaction in spawnableFactions) + { + ForcePauseWave(spawnableFaction); + } + } + /// /// Pauses a specific respawn wave by removing it from the active wave list and adding it to the paused wave list. /// /// The representing the wave to pause. + [Obsolete("Use ForcePauseWave instead. PauseWave breaks wave systems after game update.")] public static void PauseWave(SpawnableFaction spawnableFaction) { if (TryGetWaveBase(spawnableFaction, out SpawnableWaveBase spawnableWaveBase)) @@ -412,6 +464,7 @@ public static void PauseWave(SpawnableFaction spawnableFaction) /// Pauses respawn waves by removing them from WaveManager.Waves and storing them in . /// /// + [Obsolete("Use ForcePauseWaves instead. PauseWaves breaks wave systems after game update.")] public static void PauseWaves() { PausedWaves.Clear(); @@ -426,6 +479,7 @@ public static void PauseWaves() /// /// A list of instances representing the waves to pause. /// + [Obsolete("Use ForcePauseWaves instead. PauseWaves breaks wave systems after game update.")] public static void PauseWaves(List spawnableFactions) { foreach (SpawnableFaction spawnableFaction in spawnableFactions)