Skip to content

Commit cca4cef

Browse files
committed
fix: interacting door (bolton issue)
1 parent 4c5231a commit cca4cef

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

EXILED/Exiled.Events/Patches/Events/Player/InteractingDoor.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ namespace Exiled.Events.Patches.Events.Player
1414
using API.Features.Pools;
1515
using Attributes;
1616
using EventArgs.Player;
17-
using Handlers;
1817
using HarmonyLib;
1918
using Interactables.Interobjects.DoorUtils;
2019
using LabApi.Events.Arguments.PlayerEvents;
@@ -26,7 +25,7 @@ namespace Exiled.Events.Patches.Events.Player
2625
/// Patches <see cref="DoorVariant.ServerInteract(ReferenceHub, byte)" />.
2726
/// Adds the <see cref="Handlers.Player.InteractingDoor" /> event.
2827
/// </summary>
29-
[EventPatch(typeof(Player), nameof(Player.InteractingDoor))]
28+
[EventPatch(typeof(Handlers.Player), nameof(Player.InteractingDoor))]
3029
[HarmonyPatch(typeof(DoorVariant), nameof(DoorVariant.ServerInteract), typeof(ReferenceHub), typeof(byte))]
3130
internal static class InteractingDoor
3231
{
@@ -101,7 +100,7 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
101100
// canOpen
102101
new(OpCodes.Ldloc_0),
103102

104-
// labEvent = PlayerInteractingDoorEventArgs(ReferenceHub, DoorVariant, bool)
103+
// labEvent = new PlayerInteractingDoorEventArgs(ReferenceHub, DoorVariant, bool)
105104
new(OpCodes.Newobj, GetDeclaredConstructors(typeof(PlayerInteractingDoorEventArgs))[0]),
106105
new(OpCodes.Dup),
107106
new(OpCodes.Dup),
@@ -122,7 +121,7 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
122121
});
123122

124123
offset = -3;
125-
index = newInstructions.FindIndex(i => i.opcode == OpCodes.Newobj && (ConstructorInfo)i.operand == GetDeclaredConstructors(typeof(LabApi.Events.Arguments.PlayerEvents.PlayerInteractingDoorEventArgs))[0]) + offset;
124+
index = newInstructions.FindLastIndex(i => i.opcode == OpCodes.Newobj && (ConstructorInfo)i.operand == GetDeclaredConstructors(typeof(LabApi.Events.Arguments.PlayerEvents.PlayerInteractingDoorEventArgs))[0]) + offset;
126125

127126
newInstructions.InsertRange(
128127
index,
@@ -171,7 +170,7 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
171170
/// <summary>
172171
/// Patches <see cref="DoorVariant.TryResolveLock" />.
173172
/// </summary>
174-
[EventPatch(typeof(Player), nameof(Player.InteractingDoor))]
173+
[EventPatch(typeof(Handlers.Player), nameof(Player.InteractingDoor))]
175174
[HarmonyPatch(typeof(DoorVariant), nameof(DoorVariant.TryResolveLock))]
176175
#pragma warning disable SA1402
177176
internal static class ChangeNWLogic

0 commit comments

Comments
 (0)