Skip to content

Commit d88d592

Browse files
committed
Fix
1 parent 877469e commit d88d592

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

EXILED/Exiled.Events/Patches/Fixes/Fix106RegenerationWithScp244.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
4545
{
4646
// Scp106Role scp106Role = base.Hub.roleManager.CurrentRole as Scp106Role;
4747
new CodeInstruction(OpCodes.Ldarg_0),
48-
new CodeInstruction(OpCodes.Call, PropertyGetter(typeof(StatusEffectBase), nameof(StatusEffectBase.Hub))),
48+
new CodeInstruction(OpCodes.Callvirt, PropertyGetter(typeof(StatusEffectBase), nameof(StatusEffectBase.Hub))),
4949
new CodeInstruction(OpCodes.Ldfld, Field(typeof(ReferenceHub), nameof(ReferenceHub.roleManager))),
5050
new CodeInstruction(OpCodes.Callvirt, PropertyGetter(typeof(PlayerRoleManager), nameof(PlayerRoleManager.CurrentRole))),
5151
new CodeInstruction(OpCodes.Isinst, typeof(Scp106Role)),
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// -----------------------------------------------------------------------
2+
// <copyright file="WarheadConfigLockGateFix.cs" company="Exiled Team">
3+
// Copyright (c) Exiled Team. All rights reserved.
4+
// Licensed under the CC BY-SA 3.0 license.
5+
// </copyright>
6+
// -----------------------------------------------------------------------
7+
8+
namespace Exiled.Events.Patches.Fixes
9+
{
10+
using System.Collections.Generic;
11+
using System.Reflection.Emit;
12+
13+
using API.Features.Pools;
14+
using Footprinting;
15+
using HarmonyLib;
16+
using Interactables.Interobjects.DoorUtils;
17+
using InventorySystem;
18+
using InventorySystem.Items.Firearms.Ammo;
19+
using InventorySystem.Items.Pickups;
20+
21+
using static HarmonyLib.AccessTools;
22+
23+
/// <summary>
24+
/// Patches <see cref="DoorEventOpenerExtension.Trigger"/> delegate.
25+
/// Fix than NW config "lock_gates_on_countdown"
26+
/// reported https://git.scpslgame.com/northwood-qa/scpsl-bug-reporting/-/issues/316.
27+
/// </summary>
28+
[HarmonyPatch(typeof(DoorEventOpenerExtension), nameof(DoorEventOpenerExtension.Trigger))]
29+
internal class WarheadConfigLockGateFix
30+
{
31+
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
32+
{
33+
List<CodeInstruction> newInstructions = ListPool<CodeInstruction>.Pool.Get(instructions);
34+
35+
// replace Contains with StartWith
36+
int index = newInstructions.FindIndex(x => x.operand == (object)Method(typeof(string), nameof(string.Contains)));
37+
newInstructions[index].operand = Method(typeof(string), nameof(string.StartsWith), new System.Type[] { typeof(string) });
38+
39+
for (int z = 0; z < newInstructions.Count; z++)
40+
yield return newInstructions[z];
41+
42+
ListPool<CodeInstruction>.Pool.Return(newInstructions);
43+
}
44+
}
45+
}

0 commit comments

Comments
 (0)