From 8d5873fd503e37ae7bf91a29230d49a66cc53c68 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EB=B0=95=EA=B2=BD=ED=98=84?=
<78902671+GoldenPig1205@users.noreply.github.com>
Date: Tue, 20 May 2025 14:09:56 +0900
Subject: [PATCH] Add Wave related functions to Respawn
---
EXILED/Exiled.API/Features/Respawn.cs | 73 +++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
diff --git a/EXILED/Exiled.API/Features/Respawn.cs b/EXILED/Exiled.API/Features/Respawn.cs
index 2430d5bd9b..0f34495520 100644
--- a/EXILED/Exiled.API/Features/Respawn.cs
+++ b/EXILED/Exiled.API/Features/Respawn.cs
@@ -388,6 +388,26 @@ public static void ForceWave(SpawnableWaveBase spawnableWaveBase)
WaveManager.Spawn(spawnableWaveBase);
}
+ ///
+ /// 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.
+ public static void PauseWave(SpawnableFaction spawnableFaction)
+ {
+ if (TryGetWaveBase(spawnableFaction, out SpawnableWaveBase spawnableWaveBase))
+ {
+ if (!PausedWaves.Contains(spawnableWaveBase))
+ {
+ PausedWaves.Add(spawnableWaveBase);
+ }
+
+ if (WaveManager.Waves.Contains(spawnableWaveBase))
+ {
+ WaveManager.Waves.Remove(spawnableWaveBase);
+ }
+ }
+ }
+
///
/// Pauses respawn waves by removing them from WaveManager.Waves and storing them in .
///
@@ -399,6 +419,21 @@ public static void PauseWaves()
WaveManager.Waves.Clear();
}
+ ///
+ /// 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 PauseWaves(List spawnableFactions)
+ {
+ foreach (SpawnableFaction spawnableFaction in spawnableFactions)
+ {
+ PauseWave(spawnableFaction);
+ }
+ }
+
///
/// Resumes respawn waves by filling WaveManager.Waves with values stored in .
///
@@ -411,6 +446,29 @@ public static void ResumeWaves()
PausedWaves.Clear();
}
+ ///
+ /// Restarts a specific respawn wave by adding it back to the active wave list
+ /// and removing it from the paused wave list if necessary.
+ ///
+ ///
+ /// The representing the wave to restart.
+ ///
+ public static void RestartWave(SpawnableFaction spawnableFaction)
+ {
+ if (TryGetWaveBase(spawnableFaction, out SpawnableWaveBase spawnableWaveBase))
+ {
+ if (!WaveManager.Waves.Contains(spawnableWaveBase))
+ {
+ WaveManager.Waves.Add(spawnableWaveBase);
+ }
+
+ if (PausedWaves.Contains(spawnableWaveBase))
+ {
+ PausedWaves.Remove(spawnableWaveBase);
+ }
+ }
+ }
+
///
/// Restarts respawn waves by clearing WaveManager.Waves and filling it with new values..
///
@@ -423,6 +481,21 @@ public static void RestartWaves()
PausedWaves.Clear();
}
+ ///
+ /// Restarts the specified respawn waves by iterating through each wave
+ /// and restarting it using the method.
+ ///
+ ///
+ /// A list of instances representing the waves to restart.
+ ///
+ public static void RestartWaves(List spawnableFactions)
+ {
+ foreach (SpawnableFaction spawnableFaction in spawnableFactions)
+ {
+ RestartWave(spawnableFaction);
+ }
+ }
+
///
/// Tries to get the influence value of a given .
///