Skip to content

Commit

Permalink
Fix null rooms in elevator doors (#2752)
Browse files Browse the repository at this point in the history
  • Loading branch information
ITeMbI4 authored Jul 23, 2024
1 parent e2a6705 commit ed9b58e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions Exiled.API/Features/Lift.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public class Lift : GameEntity, IWrapper<ElevatorChamber>, IWorldSpace
internal static readonly Dictionary<ElevatorChamber, Lift> ElevatorChamberToLift = new(8, new ComponentsEqualityComparer());

/// <summary>
/// Internal list that contains all ElevatorDoor for current group.
/// Internal list that contains all BaseElevatorDoor for current group.
/// </summary>
private readonly List<ElevatorDoor> internalDoorsList = ListPool<ElevatorDoor>.Pool.Get();
private readonly List<BaseElevatorDoor> internalDoorsList = ListPool<BaseElevatorDoor>.Pool.Get();

/// <summary>
/// Initializes a new instance of the <see cref="Lift"/> class.
Expand All @@ -53,13 +53,13 @@ internal Lift(ElevatorChamber elevator)
Base = elevator;
ElevatorChamberToLift.Add(elevator, this);

internalDoorsList.AddRange(BaseElevatorDoor.AllElevatorDoors[Group].Select(x => Door.Get(x).As<ElevatorDoor>()));
internalDoorsList.AddRange(BaseElevatorDoor.AllElevatorDoors[Group]);
}

/// <summary>
/// Finalizes an instance of the <see cref="Lift"/> class.
/// </summary>
~Lift() => ListPool<ElevatorDoor>.Pool.Return(internalDoorsList);
~Lift() => ListPool<BaseElevatorDoor>.Pool.Return(internalDoorsList);

/// <summary>
/// Gets a <see cref="IEnumerable{T}"/> of <see cref="Lift"/> which contains all the <see cref="Lift"/> instances.
Expand All @@ -75,7 +75,7 @@ internal Lift(ElevatorChamber elevator)
/// <summary>
/// Gets a value of the internal doors list.
/// </summary>
public IReadOnlyList<ElevatorDoor> Doors => internalDoorsList;
public IReadOnlyList<ElevatorDoor> Doors => internalDoorsList.Select(x => Door.Get(x).As<ElevatorDoor>()).ToList();

/// <summary>
/// Gets a <see cref="IEnumerable{T}"/> of <see cref="Player"/> in the <see cref="Room"/>.
Expand Down
2 changes: 1 addition & 1 deletion Exiled.API/Features/Room.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace Exiled.API.Features
/// <summary>
/// The in-game room.
/// </summary>
public sealed class Room : GameEntity
public class Room : GameEntity
{
/// <summary>
/// A <see cref="Dictionary{TKey,TValue}"/> containing all known <see cref="RoomIdentifier"/>s and their corresponding <see cref="Room"/>.
Expand Down

0 comments on commit ed9b58e

Please sign in to comment.