diff options
Diffstat (limited to 'AnodyneArchipelago/Patches/StatePatches.cs')
| -rw-r--r-- | AnodyneArchipelago/Patches/StatePatches.cs | 39 |
1 files changed, 39 insertions, 0 deletions
| diff --git a/AnodyneArchipelago/Patches/StatePatches.cs b/AnodyneArchipelago/Patches/StatePatches.cs new file mode 100644 index 0000000..f6acc62 --- /dev/null +++ b/AnodyneArchipelago/Patches/StatePatches.cs | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | using AnodyneSharp.Entities; | ||
| 2 | using AnodyneSharp.Registry; | ||
| 3 | using AnodyneSharp.States; | ||
| 4 | using AnodyneSharp; | ||
| 5 | using HarmonyLib; | ||
| 6 | using System.Reflection; | ||
| 7 | |||
| 8 | namespace AnodyneArchipelago.Patches | ||
| 9 | { | ||
| 10 | [HarmonyPatch(typeof(AnodyneGame), "Update")] | ||
| 11 | class GameUpdatePatch | ||
| 12 | { | ||
| 13 | static void Postfix() | ||
| 14 | { | ||
| 15 | ArchipelagoManager.Update(); | ||
| 16 | } | ||
| 17 | } | ||
| 18 | |||
| 19 | [HarmonyPatch(typeof(PlayState), nameof(PlayState.Create))] | ||
| 20 | class PlayStateCreatePatch | ||
| 21 | { | ||
| 22 | static void Prefix(PlayState __instance) | ||
| 23 | { | ||
| 24 | // Get player for later access. | ||
| 25 | FieldInfo playerField = typeof(PlayState).GetField("_player", BindingFlags.NonPublic | BindingFlags.Instance); | ||
| 26 | Plugin.Player = (Player)playerField.GetValue(__instance); | ||
| 27 | |||
| 28 | // Handle Red Grotto stuff. | ||
| 29 | GlobalState.events.SetEvent("red_cave_l_ss", 999); | ||
| 30 | GlobalState.events.SetEvent("red_cave_n_ss", 999); | ||
| 31 | GlobalState.events.SetEvent("red_cave_r_ss", 999); | ||
| 32 | |||
| 33 | // Connect to archipelago. | ||
| 34 | Plugin.Instance.Log.LogInfo("Connecting to Archipelago!"); | ||
| 35 | |||
| 36 | ArchipelagoManager.Connect("localhost:38281", "Anodyne", ""); | ||
| 37 | } | ||
| 38 | } | ||
| 39 | } | ||
