Skip to content

Commit

Permalink
[Exiled::API] Add ParentCheckpointDoor (Exiled-Team#2651)
Browse files Browse the repository at this point in the history
* Add `ParentCheckpointDoor`

* ParentCheckpointDoor in ctor
  • Loading branch information
IkaOverride authored Jul 1, 2024
1 parent d340a59 commit dcb3c93
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Exiled.API/Features/Doors/Door.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ internal Door(DoorVariant door, List<Room> rooms)
if (Type is DoorType.Unknown)
Log.Error($"[DOORTYPE UNKNOWN] {this}");
#endif

ParentCheckpointDoor = Get(Base.GetComponentInParent<Interactables.Interobjects.CheckpointDoor>());
}

/// <summary>
Expand Down Expand Up @@ -159,7 +161,12 @@ public bool IsClosed
/// <summary>
/// Gets a value indicating whether or not this door is subdoor belonging to a checkpoint.
/// </summary>
public bool IsPartOfCheckpoint => List.Any(x => x is Checkpoint checkpoint && checkpoint.Subdoors.Contains(this));
public bool IsPartOfCheckpoint => ParentCheckpointDoor is not null;

/// <summary>
/// Gets the checkpoint door the door is belonging to, or null if the door doesn't belong to a checkpoint.
/// </summary>
public Door ParentCheckpointDoor { get; }

/// <summary>
/// Gets a value indicating whether or not this door requires a keycard to open.
Expand Down

0 comments on commit dcb3c93

Please sign in to comment.