diff --git a/EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs b/EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs index 8bb058bf7c..8518b601f4 100755 --- a/EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs @@ -7,15 +7,20 @@ namespace Exiled.Events.Patches.Events.Scp173 { + using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Reflection.Emit; + using API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp173; using HarmonyLib; + + using PlayerRoles.PlayableScps; using PlayerRoles.PlayableScps.Scp173; using PlayerRoles.Subroutines; @@ -35,13 +40,12 @@ private static IEnumerable Transpiler(IEnumerable x.opcode == OpCodes.Brtrue_S) + offset; - + int offset = 4; + int index = newInstructions.FindIndex(x =>x.Calls(PropertyGetter(typeof(VisionInformation), nameof(VisionInformation.IsLooking)))) + offset; newInstructions.InsertRange(index, new CodeInstruction[] { // Player.Get(target) - new(OpCodes.Ldarg_1), + new CodeInstruction(OpCodes.Ldarg_1).MoveLabelsFrom(newInstructions[index]), new(OpCodes.Call, Method(typeof(API.Features.Player), nameof(API.Features.Player.Get), new[] { typeof(ReferenceHub) })), // Player.Get(base.Owner)