Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Exiled::Events] (Bug fix) Scp173Gate can't be closed when using InteractingDoor event [Exiled::API] (Bug fix) Fix Scp173Gate IsFullyOpen always return false #2492

Merged
merged 5 commits into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}
}
Loading