about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--AnodyneArchipelago/ArchipelagoManager.cs7
-rw-r--r--AnodyneArchipelago/Patches/StatePatches.cs24
-rw-r--r--AnodyneArchipelago/Plugin.cs2
3 files changed, 32 insertions, 1 deletions
diff --git a/AnodyneArchipelago/ArchipelagoManager.cs b/AnodyneArchipelago/ArchipelagoManager.cs index 4570c39..8ee5584 100644 --- a/AnodyneArchipelago/ArchipelagoManager.cs +++ b/AnodyneArchipelago/ArchipelagoManager.cs
@@ -111,7 +111,12 @@ namespace AnodyneArchipelago
111 _itemIndex = _session.Items.AllItemsReceived.Count; 111 _itemIndex = _session.Items.AllItemsReceived.Count;
112 } 112 }
113 113
114 if (_itemsToCollect.Count > 0 && (GlobalState.Dialogue == null || GlobalState.Dialogue == "") && !GlobalState.ScreenTransition && Plugin.Player != null && GlobalState.black_overlay.alpha == 0f) 114 if (_itemsToCollect.Count > 0 &&
115 (GlobalState.Dialogue == null || GlobalState.Dialogue == "") &&
116 !GlobalState.ScreenTransition &&
117 Plugin.Player != null &&
118 GlobalState.black_overlay.alpha == 0f &&
119 !Plugin.IsGamePaused)
115 { 120 {
116 NetworkItem item = _itemsToCollect.Dequeue(); 121 NetworkItem item = _itemsToCollect.Dequeue();
117 HandleItem(item); 122 HandleItem(item);
diff --git a/AnodyneArchipelago/Patches/StatePatches.cs b/AnodyneArchipelago/Patches/StatePatches.cs index 40b30fe..31c0aef 100644 --- a/AnodyneArchipelago/Patches/StatePatches.cs +++ b/AnodyneArchipelago/Patches/StatePatches.cs
@@ -9,6 +9,7 @@ using AnodyneSharp.States.MainMenu;
9using static AnodyneSharp.AnodyneGame; 9using static AnodyneSharp.AnodyneGame;
10using AnodyneSharp.Drawing; 10using AnodyneSharp.Drawing;
11using System.IO; 11using System.IO;
12using System;
12 13
13namespace AnodyneArchipelago.Patches 14namespace AnodyneArchipelago.Patches
14{ 15{
@@ -83,6 +84,8 @@ namespace AnodyneArchipelago.Patches
83 { 84 {
84 static void Prefix(PlayState __instance) 85 static void Prefix(PlayState __instance)
85 { 86 {
87 Plugin.IsGamePaused = false;
88
86 // Get player for later access. 89 // Get player for later access.
87 FieldInfo playerField = typeof(PlayState).GetField("_player", BindingFlags.NonPublic | BindingFlags.Instance); 90 FieldInfo playerField = typeof(PlayState).GetField("_player", BindingFlags.NonPublic | BindingFlags.Instance);
88 Plugin.Player = (Player)playerField.GetValue(__instance); 91 Plugin.Player = (Player)playerField.GetValue(__instance);
@@ -93,4 +96,25 @@ namespace AnodyneArchipelago.Patches
93 GlobalState.events.SetEvent("red_cave_r_ss", 999); 96 GlobalState.events.SetEvent("red_cave_r_ss", 999);
94 } 97 }
95 } 98 }
99
100 [HarmonyPatch(typeof(PauseState), MethodType.Constructor, new Type[] { })]
101 class CreatePausePatch
102 {
103 static void Postfix()
104 {
105 Plugin.IsGamePaused = true;
106 }
107 }
108
109 [HarmonyPatch(typeof(PauseState), nameof(PauseState.Update))]
110 class UpdatePausePatch
111 {
112 static void Postfix(PauseState __instance)
113 {
114 if (__instance.Exit)
115 {
116 Plugin.IsGamePaused = false;
117 }
118 }
119 }
96} 120}
diff --git a/AnodyneArchipelago/Plugin.cs b/AnodyneArchipelago/Plugin.cs index 10a30b9..18f0d36 100644 --- a/AnodyneArchipelago/Plugin.cs +++ b/AnodyneArchipelago/Plugin.cs
@@ -12,8 +12,10 @@ namespace AnodyneArchipelago
12 public class Plugin : BasePlugin 12 public class Plugin : BasePlugin
13 { 13 {
14 public static Plugin Instance = null; 14 public static Plugin Instance = null;
15
15 public static Player Player = null; 16 public static Player Player = null;
16 public static ArchipelagoManager ArchipelagoManager = null; 17 public static ArchipelagoManager ArchipelagoManager = null;
18 public static bool IsGamePaused = false;
17 19
18 public static string GetVersion() 20 public static string GetVersion()
19 { 21 {