]> git.deb.at Git - rhonda/theotherroles.git/commitdiff
Fix Files being in the wrong location
authorEoF-1141 <61620805+EoF-1141@users.noreply.github.com>
Fri, 16 Apr 2021 22:53:05 +0000 (00:53 +0200)
committerGitHub <noreply@github.com>
Fri, 16 Apr 2021 22:53:05 +0000 (00:53 +0200)
Source Code/EndGamePatch.cs
Source Code/FreePlayFix.cs [new file with mode: 0644]

index dc1da147c16e3f6a541d7567a3fa71032e653c0c..72cfff88a2617ebcb92d49d9d775c2e3fc94129b 100644 (file)
@@ -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 (file)
index 0000000..816f762
--- /dev/null
@@ -0,0 +1,20 @@
+using System;\r
+using System.Linq;\r
+using HarmonyLib;\r
+using UnityEngine;\r
+\r
+namespace TheOtherRoles {\r
+    [HarmonyPatch]\r
+    public static class FreePlayFix {\r
+        public static bool isInFreePlay = false;\r
+\r
+        [HarmonyPatch(typeof(ShipStatus), nameof(ShipStatus.Begin))]\r
+        public static class ShipStatusBeginPatch { \r
+            public static void Prefix(ShipStatus __instance) {\r
+                System.Console.WriteLine("Begin");\r
+                isInFreePlay = UnityEngine.Object.FindObjectsOfType<SystemConsole>().ToList()\r
+                                .Find(console => console.name == "TaskAddConsole");\r
+            }   \r
+        }\r
+    }\r
+}
\ No newline at end of file