Before You Report
Version
1.1.7 on master (verified against the current Door.cs on GitHub).
Description
Door.Get(Room room) delegates to Door.Get(room.Base). The latter filters doors using:
List.Where(x => x.Rooms.First().Equals(roomId));
However, x.Rooms is a Room[], while roomId is a RoomIdentifier. Room does not override Equals, so this comparison is between distinct wrapper and base-object types. Consequently, normal doors do not match and the overload returns an empty sequence.
Additionally, the First() call is unsafe for door variants whose Rooms property is empty (the wrapper explicitly documents this for checkpoint subdoors).
To Reproduce
On a generated map, run the following from a plugin after room and door wrappers are initialized:
Room room = Room.List.First();
Door[] expected = room.Doors.ToArray();
Door[] actual = Door.Get(room).ToArray();
Log.Debug($"Expected at least one door: {expected.Length}; Door.Get(room): {actual.Length}");
For a room with doors, expected is non-empty while actual is empty. Depending on enumeration order and registered checkpoint subdoors, the lookup can also fail with an InvalidOperationException from First().
Expected Behavior
Door.Get(Room) and Door.Get(RoomIdentifier) should return the doors connected to the requested room without relying on a first room entry.
Proposed Fix
Compare the base room identity and handle all associated rooms, for example:
public static IEnumerable<Door> Get(RoomIdentifier roomId) =>
List.Where(door => door.Rooms.Any(room => room.Base == roomId));
This also handles multi-room doors correctly and excludes empty-room variants safely.
Before You Report
Version
1.1.7 on
master(verified against the currentDoor.cson GitHub).Description
Door.Get(Room room)delegates toDoor.Get(room.Base). The latter filters doors using:However,
x.Roomsis aRoom[], whileroomIdis aRoomIdentifier.Roomdoes not overrideEquals, so this comparison is between distinct wrapper and base-object types. Consequently, normal doors do not match and the overload returns an empty sequence.Additionally, the
First()call is unsafe for door variants whoseRoomsproperty is empty (the wrapper explicitly documents this for checkpoint subdoors).To Reproduce
On a generated map, run the following from a plugin after room and door wrappers are initialized:
For a room with doors,
expectedis non-empty whileactualis empty. Depending on enumeration order and registered checkpoint subdoors, the lookup can also fail with anInvalidOperationExceptionfromFirst().Expected Behavior
Door.Get(Room)andDoor.Get(RoomIdentifier)should return the doors connected to the requested room without relying on a first room entry.Proposed Fix
Compare the base room identity and handle all associated rooms, for example:
This also handles multi-room doors correctly and excludes empty-room variants safely.