diff --git a/Source/Mods/RimFridge.cs b/Source/Mods/RimFridge.cs index 3c20a65..e77023a 100644 --- a/Source/Mods/RimFridge.cs +++ b/Source/Mods/RimFridge.cs @@ -28,7 +28,7 @@ public RimFridgeCompat(ModContentPack mod) // Current map usage // Not needed for the fork made by "Not Harry" (at the moment, the only 1.5 fork), but other forks may need this. { - PatchingUtilities.ReplaceCurrentMapUsage("RimFridge.Patch_ReachabilityUtility_CanReach:Prefix", false); + PatchingUtilities.ReplaceCurrentMapUsage("RimFridge.Patch_ReachabilityUtility_CanReach:Prefix", false, false); } } } diff --git a/Source/PatchingUtilities.cs b/Source/PatchingUtilities.cs index 736c367..f1e05dc 100644 --- a/Source/PatchingUtilities.cs +++ b/Source/PatchingUtilities.cs @@ -369,7 +369,7 @@ public static void ReplaceCurrentMapUsage(Type type, string methodName) } } - public static void ReplaceCurrentMapUsage(string typeColonName, bool logIfNothingPatched = true) + public static void ReplaceCurrentMapUsage(string typeColonName, bool logIfNothingPatched = true, bool logIfMissingMethod = true) { if (typeColonName.NullOrEmpty()) { @@ -379,12 +379,12 @@ public static void ReplaceCurrentMapUsage(string typeColonName, bool logIfNothin var method = AccessTools.DeclaredMethod(typeColonName) ?? AccessTools.Method(typeColonName); if (method != null) - ReplaceCurrentMapUsage(method, logIfNothingPatched); - else + ReplaceCurrentMapUsage(method, logIfNothingPatched, logIfMissingMethod); + else if (logIfMissingMethod) Log.Warning($"Trying to patch current map usage for null method ({typeColonName}). Was the method removed or renamed?"); } - public static void ReplaceCurrentMapUsage(MethodBase method, bool logIfNothingPatched = true) + public static void ReplaceCurrentMapUsage(MethodBase method, bool logIfNothingPatched = true, bool logIfMissingMethod = true) { if (method != null) { @@ -394,7 +394,7 @@ public static void ReplaceCurrentMapUsage(MethodBase method, bool logIfNothingPa MpCompat.harmony.Patch(method, transpiler: transpiler); } - else + else if (logIfMissingMethod) Log.Warning("Trying to patch current map usage for null method. Was the method removed or renamed?"); }