Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions EXILED/Exiled.API/Features/Respawn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -409,16 +409,39 @@ public static void PauseWave(SpawnableFaction spawnableFaction)
}

/// <summary>
/// Pauses respawn waves by removing them from <see cref="WaveManager.Waves">WaveManager.Waves</see> and storing them in <see cref="PausedWaves"/>.
/// Clears all active respawn waves from <see cref="WaveManager.Waves"/>.
/// and stores them in <see cref="PausedWaves"/> for later restoration.
/// </summary>
/// <!--Beryl said this should work fine but it requires testing-->
public static void PauseWaves()
/// <remarks>
/// This completely removes waves from the active wave list.
/// </remarks>
public static void ClaerWaves()
{
PausedWaves.Clear();
PausedWaves.AddRange(WaveManager.Waves);
WaveManager.Waves.Clear();
}

/// <summary>
/// Forcefully pauses or resumes all time-based respawn waves by controlling their timers.
/// </summary>
/// <param name="isForcePause">
/// If true, all time-based waves will be paused. If false, their timers will resume.
/// </param>
/// <remarks>
/// Unlike ClearWaves, this does not remove waves from the system, it only controls their timer state.
/// </remarks>
public static void PauseWaves(bool isForcePause = true)
{
foreach (SpawnableWaveBase wave in WaveManager.Waves)
{
if (wave is TimeBasedWave timeBasedWave)
{
timeBasedWave.Timer.IsForcefullyPaused = isForcePause;
}
}
}

/// <summary>
/// Pauses the specified list of respawn waves by iterating through each wave
/// and pausing it using the <see cref="PauseWave(SpawnableFaction)"/> method.
Expand Down
Loading