Skip to content
This repository has been archived by the owner on Jan 19, 2025. It is now read-only.

Commit

Permalink
More patch fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
xNexusACS committed Dec 3, 2024
1 parent 052f36c commit f8409c4
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 110 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace Exiled.Events.Patches.Fixes
using static HarmonyLib.AccessTools;

/// <summary>
/// Patches <see cref="InventoryExtensions.ServerAddItem(Inventory, ItemType, ushort, ItemPickupBase)"/>.
/// Patches <see cref="InventoryExtensions.ServerAddItem"/>.
/// Fix than NW call <see cref="InventoryExtensions.OnItemRemoved"/> before <see cref="InventoryExtensions.OnItemAdded"/> for AmmoItem.
/// </summary>
[HarmonyPatch(typeof(InventoryExtensions), nameof(InventoryExtensions.ServerAddItem))]
Expand Down
2 changes: 1 addition & 1 deletion Exiled.Events/Patches/Fixes/FixPickupPreviousOwner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
index,
new CodeInstruction[]
{
new(OpCodes.Ldloc_S, 8),
new(OpCodes.Ldloc_S, 7),
new(OpCodes.Ldarg_0),
new(OpCodes.Ldfld, Field(typeof(Inventory), nameof(Inventory._hub))),
new(OpCodes.Newobj, GetDeclaredConstructors(typeof(Footprint))[0]),
Expand Down
2 changes: 1 addition & 1 deletion Exiled.Events/Patches/Fixes/NWFixDetonationTimer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ internal class NWFixDetonationTimer
private static void Postfix()
{
AlphaWarheadSyncInfo networkInfo = default;
networkInfo.ScenarioId = Array.IndexOf(AlphaWarheadController.Singleton._startScenarios, AlphaWarheadController.Singleton._startScenarios.OrderBy(d => Math.Abs(d.TimeToDetonate - ConfigFile.ServerConfig.GetInt("warhead_tminus_start_duration", 90))).First());
networkInfo.ScenarioId = (byte)Array.IndexOf(AlphaWarheadController.Singleton._startScenarios, AlphaWarheadController.Singleton._startScenarios.OrderBy(d => Math.Abs(d.TimeToDetonate - ConfigFile.ServerConfig.GetInt("warhead_tminus_start_duration", 90))).First());

AlphaWarheadController.Singleton.NetworkInfo = networkInfo;
return;
Expand Down
9 changes: 5 additions & 4 deletions Exiled.Events/Patches/Fixes/NWFixScp096BreakingDoor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace Exiled.Events.Patches.Fixes
using System.Reflection.Emit;

using API.Features.Core.Generic.Pools;
using Footprinting;
using HarmonyLib;
using Interactables.Interobjects;
using Interactables.Interobjects.DoorUtils;
Expand All @@ -20,7 +21,7 @@ namespace Exiled.Events.Patches.Fixes
using static HarmonyLib.AccessTools;

/// <summary>
/// Patches the <see cref="Scp096HitHandler.CheckDoorHit(Collider)"/> delegate.
/// Patches the <see cref="Scp096HitHandler.CheckDoorHit(Collider, Footprint)"/> delegate.
/// Fixes open doors getting easily broke.
/// Bug reported to NW (https://trello.com/c/6Nz7Isjm/4637-scp096-easily-breaking-opened-doors).
/// </summary>
Expand All @@ -32,7 +33,7 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
List<CodeInstruction> newInstructions = ListPool<CodeInstruction>.Pool.Get(instructions);

Label ret = generator.DefineLabel();
int offset = -4;
const int offset = -5;
int index = newInstructions.FindIndex(x => x.operand == (object)Method(typeof(IDamageableDoor), nameof(IDamageableDoor.ServerDamage))) + offset;

newInstructions.InsertRange(index, new[]
Expand All @@ -44,8 +45,8 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi

newInstructions[newInstructions.Count - 1].labels.Add(ret);

for (int z = 0; z < newInstructions.Count; z++)
yield return newInstructions[z];
foreach (CodeInstruction instruction in newInstructions)
yield return instruction;

ListPool<CodeInstruction>.Pool.Return(newInstructions);
}
Expand Down
102 changes: 0 additions & 102 deletions Exiled.Events/Patches/Fixes/WeaponAttachmentDesyncFix.cs

This file was deleted.

2 changes: 1 addition & 1 deletion Exiled.Events/Patches/Generic/LiftList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Exiled.Events.Patches.Generic
using Interactables.Interobjects;

/// <summary>
/// Patches <see cref="ElevatorManager.SpawnChamber"/>.
/// Patches <see cref="ElevatorManager.SpawnAllChambers"/>.
/// </summary>
[HarmonyPatch(typeof(ElevatorManager), nameof(ElevatorManager.SpawnAllChambers))]
internal class LiftList
Expand Down

0 comments on commit f8409c4

Please sign in to comment.