about summary refs log tree commit diff stats
path: root/AnodyneArchipelago/Patches
diff options
context:
space:
mode:
Diffstat (limited to 'AnodyneArchipelago/Patches')
-rw-r--r--AnodyneArchipelago/Patches/StatePatches.cs24
1 files changed, 24 insertions, 0 deletions
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}