Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
5 changes: 5 additions & 0 deletions EXILED/Exiled.API/Enums/SpawnableFaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ namespace Exiled.API.Enums
/// </summary>
public enum SpawnableFaction
{
/// <summary>
/// Represents no wave.
/// </summary>
None,

/// <summary>
/// Normal NTF wave.
/// </summary>
Expand Down
52 changes: 51 additions & 1 deletion EXILED/Exiled.API/Extensions/RoleExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ namespace Exiled.API.Extensions
using InventorySystem.Configs;
using PlayerRoles;
using PlayerRoles.FirstPersonControl;
using Respawning;
using Respawning.Waves;
using UnityEngine;

Expand Down Expand Up @@ -216,12 +217,61 @@ public static Dictionary<AmmoType, ushort> GetStartingAmmo(this RoleTypeId roleT
/// </summary>
/// <param name="waveBase">A <see cref="SpawnableWaveBase"/> instance.</param>
/// <returns><see cref="SpawnableFaction"/> associated with the wave.</returns>
public static SpawnableFaction GetFaction(this SpawnableWaveBase waveBase) => waveBase switch
public static SpawnableFaction GetSpawnableFaction(this SpawnableWaveBase waveBase) => waveBase switch
{
NtfSpawnWave => SpawnableFaction.NtfWave,
NtfMiniWave => SpawnableFaction.NtfMiniWave,
ChaosSpawnWave => SpawnableFaction.ChaosWave,
_ => SpawnableFaction.ChaosMiniWave
};

/// <summary>
/// Docs1.
/// </summary>
/// <param name="spawnableFaction">Docs1..</param>
/// <returns>Docs2.</returns>
public static Faction GetFaction(this SpawnableFaction spawnableFaction) => spawnableFaction switch
{
SpawnableFaction.ChaosWave => Faction.FoundationEnemy,
SpawnableFaction.ChaosMiniWave => Faction.FoundationEnemy,
SpawnableFaction.NtfWave => Faction.FoundationStaff,
_ => Faction.FoundationStaff
Comment thread
Mikihero marked this conversation as resolved.
Outdated
};

/// <summary>
/// Docs1.
/// </summary>
/// <param name="spawnableTeamType">Docs2.</param>
/// <returns>Docs3.</returns>
public static Faction GetFaction(this SpawnableTeamType spawnableTeamType) => spawnableTeamType switch
{
SpawnableTeamType.ChaosInsurgency => Faction.FoundationEnemy,
_ => Faction.FoundationStaff
Comment thread
Mikihero marked this conversation as resolved.
Outdated
};

/// <summary>
/// Docs1.
/// </summary>
/// <param name="faction">Docs2.</param>
/// <param name="spawnableFaction">Docs5.</param>
/// <param name="mini">Docs3.</param>
/// <returns>Docs4.</returns>
public static bool GetSpawnableFaction(this Faction faction, out SpawnableFaction spawnableFaction, bool mini = false)
{
switch (faction)
{
case Faction.FoundationStaff:
spawnableFaction = mini ? SpawnableFaction.NtfMiniWave : SpawnableFaction.NtfWave;
break;
case Faction.FoundationEnemy:
spawnableFaction = mini ? SpawnableFaction.ChaosMiniWave : SpawnableFaction.ChaosWave;
break;
default:
spawnableFaction = SpawnableFaction.None;
return false;
}

return true;
}
}
}
Loading