Skip to content

Commit cc624de

Browse files
authored
fix: few fixes (ExMod-Team#514)
* fix: keycard interacting * fix: EscapingEvent IsAllowed
1 parent 7e15573 commit cc624de

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

EXILED/Exiled.Events/Config.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ public sealed class Config : IConfig
7777
/// <summary>
7878
/// Gets or sets a value indicating whether keycard throw can affect basic doors.
7979
/// </summary>
80+
/// TODO: Make a poll about removing this config. (unimplemented since 9.6.0-beta7)
8081
[Description("Indicates whether thrown keycards can affect doors that don't require any permissions")]
8182
public bool CanKeycardThrowAffectDoors { get; set; } = false;
8283

EXILED/Exiled.Events/EventArgs/Player/EscapingEventArgs.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public EscapingEventArgs(ReferenceHub referenceHub, RoleTypeId newRole, EscapeSc
3939
Player = Player.Get(referenceHub);
4040
NewRole = newRole;
4141
EscapeScenario = escapeScenario;
42-
IsAllowed = escapeScenario is not EscapeScenario.CustomEscape;
42+
IsAllowed = escapeScenario is not EscapeScenario.None and not EscapeScenario.CustomEscape;
4343
}
4444

4545
/// <summary>

EXILED/Exiled.Events/Patches/Events/Item/KeycardInteracting.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,13 @@ namespace Exiled.Events.Patches.Events.Item
1414
using API.Features.Pickups;
1515
using API.Features.Pools;
1616
using Attributes;
17-
using Exiled.Events;
1817
using Exiled.Events.EventArgs.Item;
1918

2019
using Footprinting;
2120

2221
using HarmonyLib;
2322

2423
using Interactables.Interobjects.DoorUtils;
25-
26-
using InventorySystem.Items;
27-
2824
using UnityEngine;
2925

3026
using static HarmonyLib.AccessTools;
@@ -35,6 +31,7 @@ namespace Exiled.Events.Patches.Events.Item
3531
/// Patches <see cref="BaseKeycardPickup.ProcessCollision(Collision)"/> and adds <see cref="KeycardPickup.Permissions"/> implementation.
3632
/// Adds the <see cref="Handlers.Player.InteractingDoor"/> event.
3733
/// </summary>
34+
[EventPatch(typeof(Handlers.Item), nameof(Handlers.Item.KeycardInteracting))]
3835
[HarmonyPatch(typeof(BaseKeycardPickup), nameof(BaseKeycardPickup.ProcessCollision))]
3936
internal static class KeycardInteracting
4037
{
@@ -90,14 +87,10 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
9087
// door
9188
new(OpCodes.Ldloc_1),
9289

93-
// isAllowed = isUnlocked && hasPermission && Events.Instance.Config.CanKeycardThrowAffectDoors
90+
// isAllowed = isUnlocked && hasPermission
9491
new(OpCodes.Ldloc_S, isUnlocked.LocalIndex),
9592
new(OpCodes.Ldloc_S, hasPermission.LocalIndex),
9693
new(OpCodes.And),
97-
new(OpCodes.Call, PropertyGetter(typeof(Events), nameof(Events.Instance))),
98-
new(OpCodes.Callvirt, PropertyGetter(typeof(Events), nameof(Events.Config))),
99-
new(OpCodes.Callvirt, PropertyGetter(typeof(Config), nameof(Config.CanKeycardThrowAffectDoors))),
100-
new(OpCodes.And),
10194

10295
// ev = new KeycardInteractingEventArgs(pickup, player, door, isAllowed)
10396
new(OpCodes.Newobj, GetDeclaredConstructors(typeof(KeycardInteractingEventArgs))[0]),

0 commit comments

Comments
 (0)