From 7a7204b0e0f12e1228f25361adc2ce19136d97ee Mon Sep 17 00:00:00 2001 From: ang-xd Date: Tue, 22 Apr 2025 18:14:45 -0400 Subject: [PATCH] Fix minigame crashes --- MiraAPI/Patches/MinigameBeginErrorPatch.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/MiraAPI/Patches/MinigameBeginErrorPatch.cs b/MiraAPI/Patches/MinigameBeginErrorPatch.cs index 9c44c3c..863be42 100644 --- a/MiraAPI/Patches/MinigameBeginErrorPatch.cs +++ b/MiraAPI/Patches/MinigameBeginErrorPatch.cs @@ -2,11 +2,18 @@ namespace MiraAPI.Patches; -[HarmonyPatch(typeof(Minigame), nameof(Minigame.Begin))] -internal static class MinigameBeginErrorPatch +/// +/// Used to fix the Minigame crash errors (credits Submerged/PH Gaming for the fix) +/// +[HarmonyPatch] +public static class MinigameBeginErrorPatch { + private static readonly Logger _logger = new(Logger.Category.Gameplay, "Minigame"); + + [HarmonyPatch(typeof(Minigame), nameof(Minigame.Begin))] + [HarmonyPrefix] public static void Prefix(Minigame __instance) { - __instance.logger ??= new Logger(Logger.Category.Gameplay, "Minigame"); + __instance.logger ??= _logger; } }