Skip to content
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/Exiled.Events/EventArgs/Player/EscapingEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public EscapingEventArgs(ReferenceHub referenceHub, RoleTypeId newRole, EscapeSc
Player = Player.Get(referenceHub);
NewRole = newRole;
EscapeScenario = escapeScenario;
IsAllowed = true;
IsAllowed = escapeScenario is not EscapeScenario.None;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ namespace Exiled.Events.Patches.Events.Player
using System.Collections.Generic;
using System.Reflection.Emit;

using API.Enums;
using API.Features;
using API.Features.Pools;
using EventArgs.Player;
using Exiled.API.Features.Roles;
using Exiled.Events.Attributes;
using HarmonyLib;
using PlayerRoles.FirstPersonControl;
using LabApi.Events.Arguments.PlayerEvents;

using static HarmonyLib.AccessTools;

Expand All @@ -41,8 +40,8 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
LocalBuilder ev = generator.DeclareLocal(typeof(EscapingEventArgs));
LocalBuilder role = generator.DeclareLocal(typeof(Role));

int offset = -3;
int index = newInstructions.FindIndex(instruction => instruction.opcode == OpCodes.Newobj) + offset;
int offset = 2;
int index = newInstructions.FindIndex(i => i.opcode == OpCodes.Callvirt && i.operand == (object)PropertyGetter(typeof(PlayerEscapingEventArgs), nameof(PlayerEscapingEventArgs.EscapeScenario))) + offset;

newInstructions.InsertRange(
index,
Expand Down