diff --git a/EXILED/Exiled.API/Features/Map.cs b/EXILED/Exiled.API/Features/Map.cs index d3950db22a..3448910b8f 100644 --- a/EXILED/Exiled.API/Features/Map.cs +++ b/EXILED/Exiled.API/Features/Map.cs @@ -7,6 +7,7 @@ namespace Exiled.API.Features { +#pragma warning disable SA1401 using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -43,6 +44,11 @@ namespace Exiled.API.Features /// public static class Map { + /// + /// Gets a list of s on the map. + /// + internal static List TeleportsValue = new(); + private static AmbientSoundPlayer ambientSoundPlayer; private static SqueakSpawner squeakSpawner; @@ -114,11 +120,6 @@ public static bool IsDecontaminationEnabled /// public static SqueakSpawner SqueakSpawner => squeakSpawner ??= Object.FindObjectOfType(); - /// - /// Gets a list of s on the map. - /// - internal static List TeleportsValue { get; } = new(); - /// /// Broadcasts a message to all players. /// diff --git a/EXILED/Exiled.API/Features/Roles/Scp106Role.cs b/EXILED/Exiled.API/Features/Roles/Scp106Role.cs index 48f3f04a00..067ee69647 100644 --- a/EXILED/Exiled.API/Features/Roles/Scp106Role.cs +++ b/EXILED/Exiled.API/Features/Roles/Scp106Role.cs @@ -168,7 +168,7 @@ public bool IsSubmerged public bool SinkholeState { get => StalkAbility.StalkActive; - set => StalkAbility.StalkActive = value; + set => StalkAbility.ServerSetStalk(value); } /// diff --git a/EXILED/Exiled.API/Features/Window.cs b/EXILED/Exiled.API/Features/Window.cs index 79a7f5acf9..f0765b732c 100644 --- a/EXILED/Exiled.API/Features/Window.cs +++ b/EXILED/Exiled.API/Features/Window.cs @@ -220,7 +220,9 @@ public void DamageWindow(float amount, DamageHandlerBase handler) RoomType.LczGlassBox => GlassType.GR18, RoomType.LczPlants => GlassType.Plants, RoomType.Hcz049 => GlassType.Scp049, - RoomType.Hcz079 => Recontainer.Base._activatorGlass == Base ? GlassType.Scp079Trigger : GlassType.Scp079, + + // TODO: Recontainer.Base._activatorGlass == Base ? GlassType.Scp079Trigger : GlassType.Scp079 + RoomType.Hcz079 => GlassType.Scp079, RoomType.HczHid => GlassType.MicroHid, RoomType.HczTestRoom => GlassType.TestRoom, RoomType.HczEzCheckpointA => GlassType.HczEzCheckpointA, diff --git a/EXILED/Exiled.Events/EventArgs/Player/SpawningEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/SpawningEventArgs.cs index 21221d8cd4..bc543dc586 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/SpawningEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/SpawningEventArgs.cs @@ -8,7 +8,6 @@ namespace Exiled.Events.EventArgs.Player { using System; - using System.Runtime.CompilerServices; using Exiled.API.Features; using Exiled.API.Features.Roles; @@ -76,4 +75,4 @@ public SpawningEventArgs(Player player, Vector3 position, float rotation, Player /// public Role NewRole { get; } } -} \ No newline at end of file +} diff --git a/EXILED/Exiled.Events/EventArgs/Scp914/UpgradingPlayerEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp914/UpgradingPlayerEventArgs.cs index 9dedafb5af..cf4487eccc 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp914/UpgradingPlayerEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp914/UpgradingPlayerEventArgs.cs @@ -31,16 +31,16 @@ public class UpgradingPlayerEventArgs : IPlayerEvent, IDeniableEvent /// /// /// - /// - /// + /// + /// /// - public UpgradingPlayerEventArgs(Player player, bool upgradeItems, bool heldOnly, Scp914KnobSetting setting, Vector3 moveVector) + public UpgradingPlayerEventArgs(Player player, bool upgradeItems, bool heldOnly, Scp914KnobSetting setting, Vector3 outputPos) { Player = player; UpgradeItems = upgradeItems; HeldOnly = heldOnly; KnobSetting = setting; - OutputPosition = player.Position + moveVector; + OutputPosition = outputPos; } /// diff --git a/EXILED/Exiled.Events/EventArgs/Server/RespawningTeamEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Server/RespawningTeamEventArgs.cs index f475591a6f..963d06351f 100644 --- a/EXILED/Exiled.Events/EventArgs/Server/RespawningTeamEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Server/RespawningTeamEventArgs.cs @@ -29,25 +29,19 @@ public class RespawningTeamEventArgs : IDeniableEvent /// /// /// - /// - /// - /// /// /// /// - /// + /// /// /// - /// - /// - /// - public RespawningTeamEventArgs(List players, Queue queue, int maxRespawn, SpawnableWaveBase nextKnownTeam, bool isAllowed = true) + public RespawningTeamEventArgs(List players, int maxRespawn, SpawnableWaveBase wave) { Players = players; MaximumRespawnAmount = maxRespawn; - SpawnQueue = queue; - NextKnownTeam = nextKnownTeam; - IsAllowed = isAllowed; + SpawnQueue = WaveSpawner.SpawnQueue; + Wave = wave; + IsAllowed = true; } /// @@ -74,9 +68,14 @@ public int MaximumRespawnAmount } /// - /// Gets or sets a value indicating what the next respawnable team is. + /// Gets or sets a value indicating what the next wave is. + /// + public SpawnableWaveBase Wave { get; set; } + + /// + /// Gets a value indicating what the next respawnable team is. /// - public SpawnableWaveBase NextKnownTeam { get; set; } + public SpawnableTeamType NextKnownTeam => Wave.TargetFaction.GetSpawnableTeam(); /// /// Gets or sets a value indicating whether the spawn can occur. diff --git a/EXILED/Exiled.Events/Handlers/Internal/MapGenerated.cs b/EXILED/Exiled.Events/Handlers/Internal/MapGenerated.cs index ef323edb7d..6c71d3a83e 100644 --- a/EXILED/Exiled.Events/Handlers/Internal/MapGenerated.cs +++ b/EXILED/Exiled.Events/Handlers/Internal/MapGenerated.cs @@ -54,52 +54,7 @@ public static void OnMapGenerated() PlayerRoles.RoleAssign.HumanSpawner.Handlers[PlayerRoles.Team.OtherAlive] = new PlayerRoles.RoleAssign.OneRoleHumanSpawner(PlayerRoles.RoleTypeId.Tutorial); PlayerRoles.RoleAssign.HumanSpawner.Handlers[PlayerRoles.Team.Dead] = new PlayerRoles.RoleAssign.OneRoleHumanSpawner(PlayerRoles.RoleTypeId.Spectator); - GenerateAttachments(); - Timing.CallDelayed(1, GenerateCache); - } - - private static void GenerateCache() - { - Handlers.Map.OnGenerated(); - - Timing.CallDelayed(0.1f, Handlers.Server.OnWaitingForPlayers); - } - - private static void GenerateAttachments() - { - foreach (FirearmType firearmType in EnumUtils.Values) - { - if (firearmType == FirearmType.None) - continue; - - if (Item.Create(firearmType.GetItemType()) is not Firearm firearm) - continue; - - Firearm.ItemTypeToFirearmInstance.Add(firearmType, firearm); - - List attachmentIdentifiers = ListPool.Pool.Get(); - HashSet attachmentsSlots = HashSetPool.Pool.Get(); - - uint code = 1; - - foreach (Attachment attachment in firearm.Attachments) - { - attachmentsSlots.Add(attachment.Slot); - attachmentIdentifiers.Add(new(code, attachment.Name, attachment.Slot)); - code *= 2U; - } - - uint baseCode = 0; - attachmentsSlots.ForEach(slot => baseCode += attachmentIdentifiers - .Where(attachment => attachment.Slot == slot) - .Min(slot => slot.Code)); - - Firearm.BaseCodesValue.Add(firearmType, baseCode); - Firearm.AvailableAttachmentsValue.Add(firearmType, attachmentIdentifiers.ToArray()); - - ListPool.Pool.Return(attachmentIdentifiers); - HashSetPool.Pool.Return(attachmentsSlots); - } + Timing.CallDelayed(1, Handlers.Map.OnGenerated); } } } \ No newline at end of file diff --git a/EXILED/Exiled.Events/Handlers/Internal/Round.cs b/EXILED/Exiled.Events/Handlers/Internal/Round.cs index 5c9ff4c5fa..f1cad19a77 100644 --- a/EXILED/Exiled.Events/Handlers/Internal/Round.cs +++ b/EXILED/Exiled.Events/Handlers/Internal/Round.cs @@ -7,21 +7,31 @@ namespace Exiled.Events.Handlers.Internal { + using System.Collections.Generic; using System.Linq; using CentralAuth; + + using Exiled.API.Enums; using Exiled.API.Extensions; using Exiled.API.Features; + using Exiled.API.Features.Items; + using Exiled.API.Features.Pools; using Exiled.API.Features.Roles; + using Exiled.API.Structs; using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Scp049; using Exiled.Loader; using Exiled.Loader.Features; using InventorySystem; + using InventorySystem.Items.Firearms.Attachments; + using InventorySystem.Items.Firearms.Attachments.Components; using InventorySystem.Items.Usables; using PlayerRoles; using PlayerRoles.RoleAssign; + using Utils.NonAllocLINQ; + /// /// Handles some round clean-up events and some others related to players. /// @@ -33,6 +43,7 @@ internal static class Round /// public static void OnWaitingForPlayers() { + GenerateAttachments(); MultiAdminFeatures.CallEvent(MultiAdminFeatures.EventType.WAITING_FOR_PLAYERS); if (Events.Instance.Config.ShouldReloadConfigsAtRoundRestart) @@ -93,5 +104,45 @@ public static void OnVerified(VerifiedEventArgs ev) ev.Player.SendFakeSyncVar(room.RoomLightControllerNetIdentity, typeof(RoomLightController), nameof(RoomLightController.NetworkLightsEnabled), false); } } + + private static void GenerateAttachments() + { + foreach (FirearmType firearmType in EnumUtils.Values) + { + if (firearmType == FirearmType.None) + continue; + + Log.Warn(firearmType.GetItemType()); + Log.Warn(Server.Host == null); + + if (Item.Create(firearmType.GetItemType()) is not Firearm firearm) + continue; + + Firearm.ItemTypeToFirearmInstance.Add(firearmType, firearm); + + List attachmentIdentifiers = ListPool.Pool.Get(); + HashSet attachmentsSlots = HashSetPool.Pool.Get(); + + uint code = 1; + + foreach (Attachment attachment in firearm.Attachments) + { + attachmentsSlots.Add(attachment.Slot); + attachmentIdentifiers.Add(new(code, attachment.Name, attachment.Slot)); + code *= 2U; + } + + uint baseCode = 0; + attachmentsSlots.ForEach(slot => baseCode += attachmentIdentifiers + .Where(attachment => attachment.Slot == slot) + .Min(slot => slot.Code)); + + Firearm.BaseCodesValue.Add(firearmType, baseCode); + Firearm.AvailableAttachmentsValue.Add(firearmType, attachmentIdentifiers.ToArray()); + + ListPool.Pool.Return(attachmentIdentifiers); + HashSetPool.Pool.Return(attachmentsSlots); + } + } } } diff --git a/EXILED/Exiled.Events/Patches/Events/Map/FillingLocker.cs b/EXILED/Exiled.Events/Patches/Events/Map/FillingLocker.cs index 2ec49178ac..a884b6c887 100644 --- a/EXILED/Exiled.Events/Patches/Events/Map/FillingLocker.cs +++ b/EXILED/Exiled.Events/Patches/Events/Map/FillingLocker.cs @@ -44,7 +44,7 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable list = new(); + List list = new List(); if (inventory.TryGetBodyArmor(out BodyArmor bodyArmor)) + { bodyArmor.DontRemoveExcessOnDrop = true; + } - while (inventory.UserInventory.Items.Count > 0) + HashSet hashSet = HashSetPool.Pool.Get(); + foreach (KeyValuePair item2 in inventory.UserInventory.Items) { - int startCount = inventory.UserInventory.Items.Count; - ushort key = inventory.UserInventory.Items.ElementAt(0).Key; - ItemPickupBase item = inventory.ServerDropItem(key); - - // If the list wasn't changed, we need to manually remove the item to avoid a softlock. - if (startCount == inventory.UserInventory.Items.Count) - inventory.UserInventory.Items.Remove(key); + if (item2.Value is Scp1344Item scp1344Item) + { + scp1344Item.Status = Scp1344Status.Idle; + } else - list.Add(item); + { + hashSet.Add(item2.Key); + } } + foreach (ushort item3 in hashSet) + { + list.Add(inventory.ServerDropItem(item3)); + } + + HashSetPool.Pool.Return(hashSet); InventoryItemProvider.PreviousInventoryPickups[ev.Player.ReferenceHub] = list; } - else + + if (!flag) { while (inventory.UserInventory.Items.Count > 0) { - int startCount = inventory.UserInventory.Items.Count; - ushort key = inventory.UserInventory.Items.ElementAt(0).Key; - inventory.ServerRemoveItem(key, null); - - // If the list wasn't changed, we need to manually remove the item to avoid a softlock. - if (startCount == inventory.UserInventory.Items.Count) - inventory.UserInventory.Items.Remove(key); + inventory.ServerRemoveItem(inventory.UserInventory.Items.ElementAt(0).Key, null); } inventory.UserInventory.ReserveAmmo.Clear(); inventory.SendAmmoNextFrame = true; } - foreach (ItemType item in ev.Items) - inventory.ServerAddItem(item, ItemAddReason.StartingItem); + if (!StartingInventories.DefinedInventories.TryGetValue(ev.NewRole, out InventoryRoleInfo value)) + { + return; + } - foreach (KeyValuePair keyValuePair in ev.Ammo) - inventory.ServerAddAmmo(keyValuePair.Key, keyValuePair.Value); + foreach (KeyValuePair item in value.Ammo) + { + inventory.ServerAddAmmo(item.Key, item.Value); + } - foreach (KeyValuePair item in inventory.UserInventory.Items) - InventoryItemProvider.OnItemProvided?.Invoke(ev.Player.ReferenceHub, item.Value); + for (int i = 0; i < value.Items.Length; i++) + { + ItemBase arg = inventory.ServerAddItem(value.Items[i], ItemAddReason.StartingItem, 0); + InventoryItemProvider.OnItemProvided?.Invoke(ev.Player.ReferenceHub, arg); + } - InventoryItemProvider.SpawnPreviousInventoryPickups(ev.Player.ReferenceHub); + InventoryItemProvider.InventoriesToReplenish.Enqueue(ev.Player.ReferenceHub); } catch (Exception exception) { @@ -251,4 +258,4 @@ private static void ChangeInventory(ChangingRoleEventArgs ev) } } } -} \ No newline at end of file +} diff --git a/EXILED/Exiled.Events/Patches/Events/Player/Joined.cs b/EXILED/Exiled.Events/Patches/Events/Player/Joined.cs index 75fc346a87..18421e5044 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/Joined.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/Joined.cs @@ -39,11 +39,7 @@ internal static void CallEvent(ReferenceHub hub, out Player player) #endif Player.UnverifiedPlayers.Add(hub.gameObject, player); - if (ReferenceHub._hostHub == null) - { - Server.Host = player; - } - else + if (ReferenceHub._hostHub != null) { Handlers.Player.OnJoined(new JoinedEventArgs(player)); } diff --git a/EXILED/Exiled.Events/Patches/Events/Player/Shooting.cs b/EXILED/Exiled.Events/Patches/Events/Player/Shooting.cs index 3c779e7043..fc1265b8e1 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/Shooting.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/Shooting.cs @@ -18,8 +18,10 @@ namespace Exiled.Events.Patches.Events.Player using HarmonyLib; + using InventorySystem.Items.Firearms; using InventorySystem.Items.Firearms.BasicMessages; using InventorySystem.Items.Firearms.Modules; + using InventorySystem.Items.Firearms.Modules.Misc; using static HarmonyLib.AccessTools; @@ -29,41 +31,33 @@ namespace Exiled.Events.Patches.Events.Player /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.Shooting))] - // [HarmonyPatch(typeof(FirearmBasicMessagesHandler), nameof(FirearmBasicMessagesHandler.ServerShotReceived))] + [HarmonyPatch(typeof(ShotBacktrackData), nameof(ShotBacktrackData.ProcessShot))] internal static class Shooting { - /* private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) { List newInstructions = ListPool.Pool.Get(instructions); - Label isAllowedLabel = generator.DefineLabel(); Label returnLabel = generator.DefineLabel(); - LocalBuilder ev = generator.DeclareLocal(typeof(ShootingEventArgs)); - - int offset = -2; - int index = newInstructions.FindIndex(instruction => instruction.Calls(Method(typeof(IActionModule), nameof(IActionModule.ServerAuthorizeShot)))) + offset; + int offset = 1; + int index = newInstructions.FindIndex(instruction => instruction.opcode == OpCodes.Stloc_2) + offset; newInstructions.InsertRange( index, new[] { - // Player.Get(referenceHub) - new CodeInstruction(OpCodes.Ldloc_0).MoveLabelsFrom(newInstructions[index]), + // Player.Get(firearm.Owner) + new(OpCodes.Ldarg_1), + new(OpCodes.Callvirt, PropertyGetter(typeof(Firearm), nameof(Firearm.Owner))), new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), // firearm - new(OpCodes.Ldloc_1), - - // msg - new(OpCodes.Ldarg_1), + new CodeInstruction(OpCodes.Ldarg_1).MoveLabelsFrom(newInstructions[index]), - // ShootingEventArgs ev = new(Player, firearm, ShotMessage) + // ShootingEventArgs ev = new(Player, firearm) new(OpCodes.Newobj, GetDeclaredConstructors(typeof(ShootingEventArgs))[0]), new(OpCodes.Dup), - new(OpCodes.Dup), - new(OpCodes.Stloc, ev.LocalIndex), // Handlers.Player.OnShooting(ev) new(OpCodes.Call, Method(typeof(Handlers.Player), nameof(Handlers.Player.OnShooting))), @@ -72,12 +66,6 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } - */ } } \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/Spawning.cs b/EXILED/Exiled.Events/Patches/Events/Player/Spawning.cs index f740e1637b..af8b3a6c20 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/Spawning.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/Spawning.cs @@ -15,7 +15,6 @@ namespace Exiled.Events.Patches.Events.Player using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; - using Exiled.Events.EventArgs.Server; using HarmonyLib; using PlayerRoles.FirstPersonControl.Spawnpoints; @@ -39,9 +38,7 @@ private static IEnumerable Transpiler(IEnumerable - instr.opcode == OpCodes.Callvirt && instr.operand as MethodInfo == setPositionMethod) + offset; + int index = newInstructions.FindIndex(instr => instr.Calls(PropertySetter(typeof(Transform), nameof(Transform.position)))) + offset; // Declare the `SpawningEventArgs` local variable. LocalBuilder ev = generator.DeclareLocal(typeof(SpawningEventArgs)); @@ -90,4 +87,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} \ No newline at end of file +} diff --git a/EXILED/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs b/EXILED/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs index 2f9651160f..d38f915959 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs @@ -45,17 +45,19 @@ private static IEnumerable Transpiler(IEnumerable instruction.Calls(PropertySetter(typeof(BasicRagdoll), nameof(BasicRagdoll.NetworkInfo)))) + offset; newInstructions.InsertRange(index, new CodeInstruction[] { - // RagdollInfo loads into stack before il inject + // ragdoll.NetworkInfo + new(OpCodes.Ldloc_1), + new(OpCodes.Callvirt, PropertyGetter(typeof(BasicRagdoll), nameof(BasicRagdoll.NetworkInfo))), // true new(OpCodes.Ldc_I4_1), - // SpawningRagdollEventArgs ev = new(RagdollInfo, bool) + // SpawningRagdollEventArgs ev = new(ragdoll, RagdollInfo, bool) new(OpCodes.Newobj, GetDeclaredConstructors(typeof(SpawningRagdollEventArgs))[0]), new(OpCodes.Dup), new(OpCodes.Dup), @@ -71,7 +73,7 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable event. /// [EventPatch(typeof(Handlers.Scp106), nameof(Handlers.Scp106.ExitStalking))] - [HarmonyPatch(typeof(Scp106StalkAbility), nameof(Scp106StalkAbility.StalkActive), MethodType.Setter)] + [HarmonyPatch(typeof(Scp106StalkAbility), nameof(Scp106StalkAbility.ServerSetStalk))] public class ExitStalking { private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) @@ -36,20 +36,22 @@ private static IEnumerable Transpiler(IEnumerable instruction.opcode == OpCodes.Newobj) + offset; + + int offset = -2; + int index = newInstructions.FindIndex(instruction => instruction.Calls(PropertySetter(typeof(Scp106StalkAbility), nameof(Scp106StalkAbility.StalkActive)))) + offset; + newInstructions.InsertRange( index, new CodeInstruction[] { // if (value is false) continue; new CodeInstruction(OpCodes.Ldarg_1).MoveLabelsFrom(newInstructions[index]), - new(OpCodes.Ldc_I4_0), + new(OpCodes.Ldc_I4_1), new(OpCodes.Beq_S, continueLabel), // Player.Get(this.Owner); new(OpCodes.Ldarg_0), - new(OpCodes.Callvirt, PropertyGetter(typeof(Scp106HuntersAtlasAbility), nameof(Scp106HuntersAtlasAbility.Owner))), + new(OpCodes.Callvirt, PropertyGetter(typeof(Scp106StalkAbility), nameof(Scp106StalkAbility.Owner))), new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), // true @@ -58,8 +60,6 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable instruction.opcode == OpCodes.Newobj) + offset; - newInstructions[index].labels.Add(continueLabel); + new CodeInstruction(OpCodes.Nop).WithLabels(continueLabel), + }); newInstructions[newInstructions.Count - 1].labels.Add(returnLabel); diff --git a/EXILED/Exiled.Events/Patches/Events/Scp914/UpgradingPlayer.cs b/EXILED/Exiled.Events/Patches/Events/Scp914/UpgradingPlayer.cs index 79fdb2a4ea..18394fda42 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp914/UpgradingPlayer.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp914/UpgradingPlayer.cs @@ -36,27 +36,21 @@ private static IEnumerable Transpiler(IEnumerable newInstructions = ListPool.Pool.Get(instructions); - // Find override position - const int offset = -3; - int index = newInstructions.FindIndex(instruction => instruction.Calls(Method(typeof(FpcExtensionMethods), nameof(FpcExtensionMethods.TryOverridePosition)))) + offset; - Label returnLabel = generator.DefineLabel(); LocalBuilder curSetting = generator.DeclareLocal(typeof(Scp914KnobSetting)); LocalBuilder ev = generator.DeclareLocal(typeof(UpgradingPlayerEventArgs)); - // Move labels from override - 3 position (Right after a branch) - List