diff --git a/About/About.xml b/About/About.xml index 48ad6eedfe..e0f18de36c 100644 --- a/About/About.xml +++ b/About/About.xml @@ -102,6 +102,7 @@
  • DankPyon.Medieval.Overhaul
  • vanillaquestsexpanded.deadlife
  • vanillaracesexpanded.android
  • +
  • UracosVereches.bettergrenadehandling
  • \ No newline at end of file diff --git a/Source/CombatExtended/Harmony/Compatibility/Harmony_BetterGrenadeHandling.cs b/Source/CombatExtended/Harmony/Compatibility/Harmony_BetterGrenadeHandling.cs new file mode 100644 index 0000000000..7df73de1fe --- /dev/null +++ b/Source/CombatExtended/Harmony/Compatibility/Harmony_BetterGrenadeHandling.cs @@ -0,0 +1,25 @@ +using System; +using System.Reflection; +using HarmonyLib; +using Verse; + +namespace CombatExtended.HarmonyCE.Compatibility; + +public class Harmony_BetterGrenadeHandling //manually patched from HarmonyBase +{ + internal static Type TypeOfBGHUtils + { + get + { + return AccessTools.TypeByName("BetterGrenadeHandling.BGHUtils"); + } + } + + public static bool Prefix(Thing target, ref bool __result) + { + Pawn targetPawn = target as Pawn; + __result = targetPawn?.stances?.stunner?.StunFromEMP == false; + + return false; + } +} diff --git a/Source/CombatExtended/Harmony/HarmonyBase.cs b/Source/CombatExtended/Harmony/HarmonyBase.cs index 61d035697f..e440a37b4b 100755 --- a/Source/CombatExtended/Harmony/HarmonyBase.cs +++ b/Source/CombatExtended/Harmony/HarmonyBase.cs @@ -5,6 +5,7 @@ using System.Reflection.Emit; using System.Linq; using System.Collections.Generic; +using CombatExtended.HarmonyCE.Compatibility; /* Note to those unfamiliar with Reflection/Harmony (like me, ProfoundDarkness), operands have some specific types and it's useful to know these to make good patches (Transpiler). * Below I'm noting the operators and what type of operand I've observed. @@ -57,6 +58,18 @@ public static void InitPatches() Harmony_GenRadial.Patch(); PawnColumnWorkers_Resize.Patch(); PawnColumnWorkers_SwapButtons.Patch(); + + // Patches that require being ran later into loading + LongEventHandler.ExecuteWhenFinished(() => + { + if (Harmony_BetterGrenadeHandling.TypeOfBGHUtils == null) + { + return; + } + + instance.Patch(AccessTools.Method(Harmony_BetterGrenadeHandling.TypeOfBGHUtils, "ShouldBeHitByEMP"), + prefix: new HarmonyMethod(typeof(Harmony_BetterGrenadeHandling).GetMethod("Prefix"))); + }); } #region Patch helper methods diff --git a/SupportedThirdPartyMods.md b/SupportedThirdPartyMods.md index 106940893d..b3718b7b27 100644 --- a/SupportedThirdPartyMods.md +++ b/SupportedThirdPartyMods.md @@ -136,6 +136,7 @@ Beeralope Squad | Beliar Xenotype | Beta Anime Hair | Beta Girls und Panzer Hair and Apparel | +Better Grenade Handling | Better Traders Guild | Better Wool Production - C# Edition | Big and Small - Genes & More |