diff --git a/MiraAPI/Utilities/Extensions.cs b/MiraAPI/Utilities/Extensions.cs
index 57887d8..5fbc671 100644
--- a/MiraAPI/Utilities/Extensions.cs
+++ b/MiraAPI/Utilities/Extensions.cs
@@ -513,6 +513,7 @@ public static class Extensions
/// Whether impostors should be included in the search.
/// The radius to search within.
/// Whether colliders should be ignored when searching.
+ /// Determines if Ghosts are included
/// Optional predicate to test if the object is valid.
/// The closest player if there is one, false otherwise.
public static PlayerControl? GetClosestPlayer(
@@ -520,16 +521,16 @@ public static class Extensions
bool includeImpostors,
float distance,
bool ignoreColliders = false,
+ bool includeGhosts = false,
Predicate? predicate = null)
{
var filteredPlayers = Helpers.GetClosestPlayers(playerControl, distance, ignoreColliders)
.Where(
playerInfo => !playerInfo.Data.Disconnected &&
playerInfo.PlayerId != playerControl.PlayerId &&
- !playerInfo.Data.IsDead &&
+ (includeGhosts || !playerInfo.Data.IsDead) &&
(includeImpostors || !playerInfo.Data.Role.IsImpostor))
.ToList();
-
return predicate != null ? filteredPlayers.Find(predicate) : filteredPlayers.FirstOrDefault();
}