Skip to content

Commit

Permalink
fix: Room::NearestRooms fix (#417)
Browse files Browse the repository at this point in the history
fix: new generation
  • Loading branch information
VALERA771 authored Jan 30, 2025
1 parent 85dfde2 commit aec6506
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
12 changes: 10 additions & 2 deletions EXILED/Exiled.API/Features/Room.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,16 @@ public class Room : MonoBehaviour, IWorldSpace
/// <summary>
/// Gets a <see cref="IReadOnlyList{T}"/> of <see cref="Room"/> around the <see cref="Room"/>.
/// </summary>
public IReadOnlyList<Room> NearestRooms { get; private set; }
public IReadOnlyList<Room> NearestRooms
{
get
{
if (NearestRoomsValue.Count == 0 && Identifier.ConnectedRooms.Count > 0)
NearestRoomsValue.AddRange(Identifier.ConnectedRooms.Select(Get));

return NearestRoomsValue;
}
}

/// <summary>
/// Gets a <see cref="IEnumerable{T}"/> of <see cref="Pickup"/> in the <see cref="Room"/>.
Expand Down Expand Up @@ -438,7 +447,6 @@ internal void InternalCreate()

Windows = WindowsValue.AsReadOnly();
Doors = DoorsValue.AsReadOnly();
NearestRooms = NearestRoomsValue.AsReadOnly();
Speakers = SpeakersValue.AsReadOnly();
Cameras = CamerasValue.AsReadOnly();
}
Expand Down
1 change: 0 additions & 1 deletion EXILED/Exiled.Events/Patches/Generic/DoorList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ private static void InitDoor(DoorVariant doorVariant)
foreach (Room room in rooms)
{
room.DoorsValue.Add(door);
room.NearestRoomsValue.AddRange(rooms.Except(new List<Room>() { room }));
}

if (door.Is(out CheckpointDoor checkpoint))
Expand Down

0 comments on commit aec6506

Please sign in to comment.