Skip to content

Commit

Permalink
[Exiled::Events] (Bug fix) Scp173Gate can't be closed when using …
Browse files Browse the repository at this point in the history
…InteractingDoor event `[Exiled::API]` (`Bug fix`) Fix Scp173Gate IsFullyOpen always return false (#2492)

* fix: InteractingDoorPatch

* fix: IsFullyOpen 173Gate

* fix
  • Loading branch information
BoltonDev authored Mar 24, 2024
1 parent 1bce93c commit ad43cae
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Exiled.API/Features/Doors/Door.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ internal Door(DoorVariant door, List<Room> rooms)
/// <summary>
/// Gets a value indicating whether or not the door is currently moving.
/// </summary>
public virtual bool IsMoving => ExactState is not(0 or 1);
public virtual bool IsMoving => !(IsFullyOpen || IsFullyClosed);

/// <summary>
/// Gets a value indicating the precise state of the door, from <c>0-1</c>. A value of <c>0</c> indicates the door is fully closed, while a value of <c>1</c> indicates the door is fully open. Values in-between represent the door's animation progress.
Expand Down
2 changes: 1 addition & 1 deletion Exiled.API/Features/Doors/Gate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public Gate(PryableDoor door, List<Room> room)
/// <summary>
/// Gets a value indicating whether the door is fully open.
/// </summary>
public override bool IsFullyOpen => base.IsFullyOpen;
public override bool IsFullyOpen => base.IsFullyOpen || (Base is Timed173PryableDoor && ExactState is 0.5845918f);

/// <summary>
/// Gets a value indicating whether or not the door is currently moving.
Expand Down
9 changes: 0 additions & 9 deletions Exiled.Events/Patches/Events/Player/InteractingDoor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
0,
new CodeInstruction[]
{
new(OpCodes.Ldarg_0),
new(OpCodes.Call, Method(typeof(InteractingDoor), nameof(InteractingDoor.CanStateChange))),
new(OpCodes.Brfalse_S, retLabel),

// InteractingDoorEventArgs ev = new(Player.Get(ply), __instance, false);
new(OpCodes.Ldarg_1),
new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })),
Expand Down Expand Up @@ -115,10 +111,5 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi

ListPool<CodeInstruction>.Pool.Return(newInstructions);
}

private static bool CanStateChange(DoorVariant variant)
{
return !(variant.GetExactState() > 0f && variant.GetExactState() < 1f);
}
}
}

0 comments on commit ad43cae

Please sign in to comment.