Skip to content

Commit

Permalink
I dont like the name of ExiledLockers but
Browse files Browse the repository at this point in the history
* Resolving ExMod-Team#77 (comment)

* Resolving ExMod-Team#77 (comment)

* Cleaning Chambers List.
  • Loading branch information
SrLicht committed Aug 28, 2024
1 parent 2a5a2e8 commit ea34058
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
3 changes: 2 additions & 1 deletion EXILED/Exiled.API/Features/Lockers/Locker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public Vector3 RandomChamberPosition
/// </summary>
/// <param name="zone">The <see cref="ZoneType"/> to filter by. If unspecified, all zones are considered.</param>
/// <param name="lockerType">The <see cref="LockerType"/> to filter by. If unspecified, all locker types are considered.</param>
/// <returns>A random <see cref="Locker"/> object, or null if no matching locker is found.</returns>
/// <returns>A random <see cref="Locker"/> object, or <see langword="null"/> if no matching locker is found.</returns>
public static Locker? Random(ZoneType zone = ZoneType.Unspecified, LockerType lockerType = LockerType.Unknow)
{
IEnumerable<Locker> filteredLockers = List;
Expand Down Expand Up @@ -224,6 +224,7 @@ public void AddItem(Pickup item)
internal static void ClearCache()
{
BaseToExiledLockers.Clear();
Chamber.Chambers.Clear();
}
}
}
36 changes: 34 additions & 2 deletions EXILED/Exiled.API/Features/Map.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,20 @@ DecontaminationController.Singleton.NetworkDecontaminationOverride is Decontamin
/// <summary>
/// Gets all <see cref="MapGeneration.Distributors.Locker"/> objects.
/// </summary>
/// <remarks>
/// This method is obsolete. Use <see cref="Map.ExiledLockers"/> instead to retrieve the <see cref="Lockers.Locker"/> objects directly.
/// </remarks>
[Obsolete("Use Map.ExiledLockers instead")]
public static ReadOnlyCollection<MapGeneration.Distributors.Locker> Lockers { get; } = Features.Lockers.Locker.BaseToExiledLockers.Keys.ToList().AsReadOnly();

/// <summary>
/// Gets all <see cref="Lockers.Locker"/> objects.
/// </summary>
/// <remarks>
/// This metod will be renamed to Lockers when <see cref="Map.Lockers"/> is discontinued.
/// </remarks>
public static IReadOnlyCollection<Lockers.Locker> ExiledLockers { get; } = Features.Lockers.Locker.List;

/// <summary>
/// Gets all <see cref="AdminToy"/> objects.
/// </summary>
Expand Down Expand Up @@ -210,8 +222,28 @@ public static void ResetLightsColor()
/// <summary>
/// Gets a random <see cref="MapGeneration.Distributors.Locker"/>.
/// </summary>
/// <returns><see cref="MapGeneration.Distributors.Locker"/> object.</returns>
public static MapGeneration.Distributors.Locker GetRandomLocker() => Lockers.GetRandomValue();
/// <remarks>
/// This method is obsolete. Use <see cref="GetRandomLocker(ZoneType, LockerType)"/> instead.
/// to specify the zone and locker type for more precise filtering.
/// </remarks>
/// <returns>A <see cref="MapGeneration.Distributors.Locker"/> object from any zone and of any type.</returns>
[Obsolete("Use GetRandomLocker(ZoneType, LockerType) instead.")]
public static MapGeneration.Distributors.Locker GetRandomLocker() => Features.Lockers.Locker.Random().Base;

/// <summary>
/// Gets a random <see cref="Lockers.Locker"/> from the specified zone and locker type.
/// </summary>
/// <param name="zone">
/// The <see cref="ZoneType"/> to filter the lockers by. If <see cref="ZoneType.Unspecified"/> is provided, lockers from all zones are considered.
/// </param>
/// <param name="lockerType">
/// The <see cref="LockerType"/> to filter the lockers by. If <see cref="LockerType.Unknow"/> is provided, lockers of any type are considered.
/// </param>
/// <returns>
/// A <see cref="Locker"/> object that matches the specified zone and locker type, or <see langword="null"/> if no matching locker is found.
/// </returns>
public static Lockers.Locker GetRandomLocker(ZoneType zone = ZoneType.Unspecified, LockerType lockerType = LockerType.Unknow) => Features.Lockers.Locker.Random(zone, lockerType);


/// <summary>
/// Gets a random <see cref="Pickup"/>.
Expand Down

0 comments on commit ea34058

Please sign in to comment.