diff --git a/EXILED/Exiled.API/Features/Waves/TimedWave.cs b/EXILED/Exiled.API/Features/Waves/TimedWave.cs index ca668ca848..346bcd6c11 100644 --- a/EXILED/Exiled.API/Features/Waves/TimedWave.cs +++ b/EXILED/Exiled.API/Features/Waves/TimedWave.cs @@ -21,40 +21,43 @@ namespace Exiled.API.Features.Waves /// public class TimedWave { - private readonly TimeBasedWave timedWave; - /// /// Initializes a new instance of the class. /// /// /// The that this class should be based off of. /// - public TimedWave(TimeBasedWave wave) => timedWave = wave; + public TimedWave(TimeBasedWave wave) => Base = wave; + + /// + /// Gets the base . + /// + public TimeBasedWave Base { get; } /// /// Gets the name of the wave timer. /// - public string Name => timedWave.GetType().Name; + public string Name => Base.GetType().Name; /// /// Gets a value indicating whether the wave is a mini wave. /// - public bool IsMiniWave => timedWave is IMiniWave; + public bool IsMiniWave => Base is IMiniWave; /// /// Gets the wave timer instance. /// - public WaveTimer Timer => new(timedWave.Timer); + public WaveTimer Timer => new(Base.Timer); /// /// Gets the faction of this wave. /// - public Faction Faction => timedWave.TargetFaction; + public Faction Faction => Base.TargetFaction; /// /// Gets the team of this wave. /// - public Team Team => timedWave.TargetFaction.GetSpawnableTeam(); + public Team Team => Base.TargetFaction.GetSpawnableTeam(); /// /// Gets the spawnable faction for this wave. @@ -70,13 +73,13 @@ public class TimedWave /// /// Gets the maximum amount of people that can spawn in this wave. /// - public int MaxAmount => timedWave.MaxWaveSize; + public int MaxAmount => Base.MaxWaveSize; /// /// Gets the for this wave. /// /// Wave must implement . - public WaveAnnouncementBase Announcement => timedWave is IAnnouncedWave announcedWave ? announcedWave.Announcement : null; + public WaveAnnouncementBase Announcement => Base is IAnnouncedWave announcedWave ? announcedWave.Announcement : null; /// /// Get the timed waves for the specified faction. @@ -142,7 +145,7 @@ public static bool TryGetTimedWave(out TimedWave wave) if (waveBase is not TimeBasedWave timeWave || timeWave.GetType() != typeof(T)) continue; - wave = new(timeWave); + wave = new TimedWave(timeWave); return true; } @@ -163,7 +166,7 @@ public static List GetTimedWaves() { if (wave is TimeBasedWave timeBasedWave) { - waves.Add(new (timeBasedWave)); + waves.Add(new TimedWave(timeBasedWave)); } } @@ -173,7 +176,7 @@ public static List GetTimedWaves() /// /// Destroys this wave. /// - public void Destroy() => timedWave.Destroy(); + public void Destroy() => Base.Destroy(); /// /// Populates this wave with the specified amount of roles. @@ -184,7 +187,7 @@ public static List GetTimedWaves() /// /// The amount of people to populate. /// - public void PopulateQueue(Queue queue, int amount) => timedWave.PopulateQueue(queue, amount); + public void PopulateQueue(Queue queue, int amount) => Base.PopulateQueue(queue, amount); /// /// Plays the announcement for this wave. diff --git a/EXILED/Exiled.API/Features/Waves/WaveTimer.cs b/EXILED/Exiled.API/Features/Waves/WaveTimer.cs index 3f20b34479..b99f2cf2bf 100644 --- a/EXILED/Exiled.API/Features/Waves/WaveTimer.cs +++ b/EXILED/Exiled.API/Features/Waves/WaveTimer.cs @@ -25,70 +25,70 @@ namespace Exiled.API.Features.Waves public class WaveTimer { /// - /// Get the native . + /// Initializes a new instance of the class. /// - private readonly Respawning.Waves.WaveTimer waveTimer; + /// The that this class should be based off of. + public WaveTimer(Respawning.Waves.WaveTimer wave) => Base = wave; /// - /// Initializes a new instance of the class. + /// Gets the base . /// - /// The that this class should be based off of. - public WaveTimer(Respawning.Waves.WaveTimer wave) => waveTimer = wave; + public Respawning.Waves.WaveTimer Base { get; } /// /// Gets the name of the wave timer. /// - public string Name => waveTimer._wave.GetType().Name; + public string Name => Base._wave.GetType().Name; /// /// Gets a value indicating whether the wave is a mini wave. /// - public bool IsMiniWave => waveTimer._wave is IMiniWave; + public bool IsMiniWave => Base._wave is IMiniWave; /// /// Gets the amount of time left before the wave spawns. /// - public TimeSpan TimeLeft => TimeSpan.FromSeconds(waveTimer.TimeLeft); + public TimeSpan TimeLeft => TimeSpan.FromSeconds(Base.TimeLeft); /// /// Gets the amount of time passed since the last wave spawned. /// - public TimeSpan TimePassed => TimeSpan.FromSeconds(waveTimer.TimePassed); + public TimeSpan TimePassed => TimeSpan.FromSeconds(Base.TimePassed); /// /// Gets the amount of time left before this wave unpause. /// - public TimeSpan PauseTimeLeft => TimeSpan.FromSeconds(waveTimer.PauseTimeLeft); + public TimeSpan PauseTimeLeft => TimeSpan.FromSeconds(Base.PauseTimeLeft); /// /// Gets the amount of time this wave has been paused for. /// - public TimeSpan PausedFor => TimeSpan.FromSeconds(waveTimer._pauseTimer); + public TimeSpan PausedFor => TimeSpan.FromSeconds(Base._pauseTimer); /// /// Gets a value indicating whether this wave is paused. /// - public bool IsPaused => waveTimer.IsPaused; + public bool IsPaused => Base.IsPaused; /// /// Gets a value indicating whether this wave is ready to spawn. /// - public bool IsReady => waveTimer.IsReadyToSpawn; + public bool IsReady => Base.IsReadyToSpawn; /// /// Gets a value indicating whether this wave is out of respawns. /// - public bool IsRespawnable => !waveTimer.IsOutOfRespawns; + public bool IsRespawnable => !Base.IsOutOfRespawns; /// /// Gets the default amount of time between a respawn of this wave. /// - public float DefaultSpawnInterval => waveTimer.DefaultSpawnInterval; + public float DefaultSpawnInterval => Base.DefaultSpawnInterval; /// /// Gets the actual amount of time between a respawn of this wave. /// - public float SpawnInterval => waveTimer.SpawnIntervalSeconds; + public float SpawnInterval => Base.SpawnIntervalSeconds; /// /// Get the wave timers for the specified faction. @@ -138,7 +138,7 @@ public static List GetWaveTimers() /// /// Destroys this wave timer. /// - public void Destroy() => waveTimer.Destroy(); + public void Destroy() => Base.Destroy(); /// /// Pauses this wave timer. @@ -146,12 +146,12 @@ public static List GetWaveTimers() /// /// The amount of time to pause this wave timer for. /// - public void Pause(float seconds) => waveTimer.Pause(seconds); + public void Pause(float seconds) => Base.Pause(seconds); /// /// Unpauses this wave timer. /// - public void Unpause() => waveTimer.Pause(0); + public void Unpause() => Base.Pause(0); /// /// Resets this wave timer. @@ -159,12 +159,12 @@ public static List GetWaveTimers() /// /// A value indicating whether the should be reset. /// - public void Reset(bool resetInterval = true) => waveTimer.Reset(resetInterval); + public void Reset(bool resetInterval = true) => Base.Reset(resetInterval); /// /// Update the timer. /// - public void Update() => waveTimer.Update(); + public void Update() => Base.Update(); /// /// Add time to the wave timer. @@ -172,7 +172,7 @@ public static List GetWaveTimers() /// /// The amount of time to add in seconds. /// - public void AddTime(float seconds) => waveTimer.AddTime(seconds); + public void AddTime(float seconds) => Base.AddTime(seconds); /// /// Set the amount of time before the wave spawns. @@ -188,6 +188,6 @@ public static List GetWaveTimers() /// /// The amount of time before the wave spawns, in seconds. /// - public void SetTime(float seconds) => waveTimer.SetTime(seconds); + public void SetTime(float seconds) => Base.SetTime(seconds); } } \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Server/SelectingRespawnTeamEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Server/SelectingRespawnTeamEventArgs.cs index f2b5311942..dd62947778 100644 --- a/EXILED/Exiled.Events/EventArgs/Server/SelectingRespawnTeamEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Server/SelectingRespawnTeamEventArgs.cs @@ -37,6 +37,6 @@ public SelectingRespawnTeamEventArgs(SpawnableWaveBase wave) public TimedWave Wave { get; set; } /// - public bool IsAllowed { get; set; } + public bool IsAllowed { get; set; } = true; } } \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Server/RespawningTeam.cs b/EXILED/Exiled.Events/Patches/Events/Server/RespawningTeam.cs index d6829b8c6c..76afb884d7 100644 --- a/EXILED/Exiled.Events/Patches/Events/Server/RespawningTeam.cs +++ b/EXILED/Exiled.Events/Patches/Events/Server/RespawningTeam.cs @@ -13,7 +13,7 @@ namespace Exiled.Events.Patches.Events.Server using System.Reflection.Emit; using API.Features.Pools; - + using Exiled.API.Features.Waves; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Server; using Exiled.Events.Handlers; @@ -93,8 +93,9 @@ private static IEnumerable Transpiler(IEnumerable newQueue) WaveSpawner.SpawnQueue.Enqueue(role); } } -} \ No newline at end of file +} diff --git a/EXILED/Exiled.Events/Patches/Events/Server/SelectingRespawnTeam.cs b/EXILED/Exiled.Events/Patches/Events/Server/SelectingRespawnTeam.cs index 78bca78914..92c126e460 100644 --- a/EXILED/Exiled.Events/Patches/Events/Server/SelectingRespawnTeam.cs +++ b/EXILED/Exiled.Events/Patches/Events/Server/SelectingRespawnTeam.cs @@ -7,18 +7,14 @@ namespace Exiled.Events.Patches.Events.Server { - using System; using System.Collections.Generic; - using System.Reflection; using System.Reflection.Emit; - using Exiled.API.Features; using Exiled.API.Features.Pools; + using Exiled.API.Features.Waves; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Server; - using HarmonyLib; - using Respawning; using static HarmonyLib.AccessTools; @@ -56,9 +52,10 @@ private static IEnumerable Transpiler(IEnumerable