diff --git a/.gitignore b/.gitignore index ecdece2bb..958e3428c 100644 --- a/.gitignore +++ b/.gitignore @@ -373,4 +373,7 @@ NuGet.config _site/ # JSON Schemas -JSON/ \ No newline at end of file +JSON/ + +# Mac DS_Store +.DS_Store \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Fixes/PositionSpawnScp0492Fix.cs b/EXILED/Exiled.Events/Patches/Fixes/PositionSpawnScp0492Fix.cs index def76276e..e69de29bb 100644 --- a/EXILED/Exiled.Events/Patches/Fixes/PositionSpawnScp0492Fix.cs +++ b/EXILED/Exiled.Events/Patches/Fixes/PositionSpawnScp0492Fix.cs @@ -1,56 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright (c) ExMod Team. All rights reserved. -// Licensed under the CC BY-SA 3.0 license. -// -// ----------------------------------------------------------------------- - -namespace Exiled.Events.Patches.Fixes -{ - using System.Collections.Generic; - using System.Reflection.Emit; - - using API.Features; - using API.Features.Pools; - using Exiled.Events.EventArgs.Player; - - using HarmonyLib; - - using PlayerRoles.PlayableScps.Scp049; - - using UnityEngine; - - using static HarmonyLib.AccessTools; - - /// - /// Patches delegate. - /// Removes useless position setter for Scp0492. - /// - [HarmonyPatch(typeof(Scp049ResurrectAbility), nameof(Scp049ResurrectAbility.ServerComplete))] - internal static class PositionSpawnScp0492Fix - { - private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) - { - List newInstructions = ListPool.Pool.Get(instructions); - - Label continueLabel = generator.DefineLabel(); - - LocalBuilder player = generator.DeclareLocal(typeof(Player)); - LocalBuilder eventArgs = generator.DeclareLocal(typeof(SpawningEventArgs)); - - const int toRemove = 7; - - const int offset = -1; - int index = newInstructions.FindLastIndex(instruction => instruction.Calls(PropertyGetter(typeof(Component), nameof(Component.transform)))) + offset; - - newInstructions[index + toRemove].MoveLabelsFrom(newInstructions[index]); - - newInstructions.RemoveRange(index, toRemove); - - for (int z = 0; z < newInstructions.Count; z++) - yield return newInstructions[z]; - - ListPool.Pool.Return(newInstructions); - } - } -} diff --git a/EXILED/Exiled.Events/Patches/Fixes/Scp3114FriendlyFireFix.cs b/EXILED/Exiled.Events/Patches/Fixes/Scp3114FriendlyFireFix.cs index 79aba61f5..e69de29bb 100644 --- a/EXILED/Exiled.Events/Patches/Fixes/Scp3114FriendlyFireFix.cs +++ b/EXILED/Exiled.Events/Patches/Fixes/Scp3114FriendlyFireFix.cs @@ -1,125 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright (c) ExMod Team. All rights reserved. -// Licensed under the CC BY-SA 3.0 license. -// -// ----------------------------------------------------------------------- - -namespace Exiled.Events.Patches.Fixes -{ -#pragma warning disable SA1402 // File may only contain a single type - using System.Collections.Generic; - using System.Reflection.Emit; - - using API.Features.Pools; - - using Exiled.API.Features; - - using Footprinting; - using HarmonyLib; - using InventorySystem.Items.Pickups; - using InventorySystem.Items.ThrowableProjectiles; - using PlayerRoles; - using PlayerStatsSystem; - - using static HarmonyLib.AccessTools; - - /// - /// Patches the delegate. - /// Fix Throwing a ghostlight with Scp in the room stun 079. - /// Bug reported to NW (https://git.scpslgame.com/northwood-qa/scpsl-bug-reporting/-/issues/55). - /// - [HarmonyPatch(typeof(Scp2176Projectile), nameof(Scp2176Projectile.ServerShatter))] - internal class Scp3114FriendlyFireFix - { - private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) - { - List newInstructions = ListPool.Pool.Get(instructions); - - Label cnt = generator.DefineLabel(); - - int offset = 0; - int index = newInstructions.FindIndex(x => x.LoadsField(Field(typeof(RoomLightController), nameof(RoomLightController.Instances)))) + offset; - - Label skip = newInstructions[index].labels[0]; - - offset = -3; - index += offset; - - newInstructions.InsertRange(index, new[] - { - // if (this.PreviousOwner.Role.GetTeam() is Team.SCPs) - new CodeInstruction(OpCodes.Ldarg_0).MoveLabelsFrom(newInstructions[index]), - new(OpCodes.Ldfld, Field(typeof(Scp2176Projectile), nameof(Scp2176Projectile.PreviousOwner))), - new(OpCodes.Ldfld, Field(typeof(Footprint), nameof(Footprint.Role))), - new(OpCodes.Call, Method(typeof(PlayerRolesUtils), nameof(PlayerRolesUtils.GetTeam), new[] { typeof(RoleTypeId) })), - new(OpCodes.Ldc_I4_0), - new(OpCodes.Ceq), - - new(OpCodes.Brfalse_S, cnt), - - new(OpCodes.Pop), - new(OpCodes.Br_S, skip), - - new CodeInstruction(OpCodes.Nop).WithLabels(cnt), - }); - - for (int z = 0; z < newInstructions.Count; z++) - yield return newInstructions[z]; - - ListPool.Pool.Return(newInstructions); - } - } - - /// - /// Patches the delegate. - /// Fix Throwing a ghostlight with Scp in the room stun 079. - /// Bug reported to NW (https://git.scpslgame.com/northwood-qa/scpsl-bug-reporting/-/issues/55). - /// - [HarmonyPatch(typeof(CollisionDetectionPickup), nameof(CollisionDetectionPickup.ProcessCollision))] - internal class Scp3114FriendlyFireFix2 : AttackerDamageHandler - { -#pragma warning disable SA1600 // Elements should be documented - public Scp3114FriendlyFireFix2(Footprint attacker, float damage) - { - Attacker = attacker; - Damage = damage; - AllowSelfDamage = false; - ServerLogsText = "Scp3114 Fix"; - } - - public override Footprint Attacker { get; set; } - - public override bool AllowSelfDamage { get; } - - public override float Damage { get; set; } - - public override string ServerLogsText { get; } - -#pragma warning restore SA1600 // Elements should be documented - - private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) - { - List newInstructions = ListPool.Pool.Get(instructions); - - int offset = 0; - int index = newInstructions.FindLastIndex(x => x.opcode == OpCodes.Ldnull) + offset; - - // replace null with new Scp3114FriendlyFireFix2(this.PreviousOwner, num2) - newInstructions.RemoveAt(index); - newInstructions.InsertRange(index, new CodeInstruction[] - { - // new Scp3114FriendlyFireFix2(this.PreviousOwner, num2) - new(OpCodes.Ldarg_0), - new(OpCodes.Ldfld, Field(typeof(CollisionDetectionPickup), nameof(CollisionDetectionPickup.PreviousOwner))), - new(OpCodes.Ldloc_3), - new(OpCodes.Newobj, GetDeclaredConstructors(typeof(Scp3114FriendlyFireFix2))[0]), - }); - - for (int z = 0; z < newInstructions.Count; z++) - yield return newInstructions[z]; - - ListPool.Pool.Return(newInstructions); - } - } -}