From e336721091edbdaaba0474e3b589baddf231f263 Mon Sep 17 00:00:00 2001 From: EoF-1141 <61620805+EoF-1141@users.noreply.github.com> Date: Sat, 17 Apr 2021 00:53:05 +0200 Subject: [PATCH] Fix Files being in the wrong location --- Source Code/EndGamePatch.cs | 5 +++-- Source Code/FreePlayFix.cs | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 Source Code/FreePlayFix.cs diff --git a/Source Code/EndGamePatch.cs b/Source Code/EndGamePatch.cs index dc1da14..72cfff8 100644 --- a/Source Code/EndGamePatch.cs +++ b/Source Code/EndGamePatch.cs @@ -199,10 +199,11 @@ namespace TheOtherRoles { } [HarmonyPatch(typeof(ShipStatus), nameof(ShipStatus.KMPKPPGPNIH))] - class CheckEndCriteriaPatch{ - + class CheckEndCriteriaPatch { public static bool Prefix(ShipStatus __instance) { if (!GameData.Instance) return false; + if (FreePlayFix.isInFreePlay) // if (__instance.DummyLocations != null && __instance.DummyLocations.Count > 0) + return true; // I don't know how to get from ShipStatus GameModes.FreePlay var statistics = new PlayerStatistics(__instance); if (CheckAndEndGameForChildLose(__instance)) return false; if (CheckAndEndGameForJesterWin(__instance)) return false; diff --git a/Source Code/FreePlayFix.cs b/Source Code/FreePlayFix.cs new file mode 100644 index 0000000..816f762 --- /dev/null +++ b/Source Code/FreePlayFix.cs @@ -0,0 +1,20 @@ +using System; +using System.Linq; +using HarmonyLib; +using UnityEngine; + +namespace TheOtherRoles { + [HarmonyPatch] + public static class FreePlayFix { + public static bool isInFreePlay = false; + + [HarmonyPatch(typeof(ShipStatus), nameof(ShipStatus.Begin))] + public static class ShipStatusBeginPatch { + public static void Prefix(ShipStatus __instance) { + System.Console.WriteLine("Begin"); + isInFreePlay = UnityEngine.Object.FindObjectsOfType().ToList() + .Find(console => console.name == "TaskAddConsole"); + } + } + } +} \ No newline at end of file -- 2.39.5