diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2025-02-22 10:43:41 -0500 |
|---|---|---|
| committer | Star Rauchenberger <fefferburbia@gmail.com> | 2025-02-22 10:43:41 -0500 |
| commit | e58b122fb00a337748df2de2451679f53b092d42 (patch) | |
| tree | 3b71d6554f10cdd5cb68ceeca4d6296abf5c434f /Plugin.cs | |
| parent | d1baf62bea385c75ad4e7612e5caa285400ffaa7 (diff) | |
| download | manifold-garden-archipelago-e58b122fb00a337748df2de2451679f53b092d42.tar.gz manifold-garden-archipelago-e58b122fb00a337748df2de2451679f53b092d42.tar.bz2 manifold-garden-archipelago-e58b122fb00a337748df2de2451679f53b092d42.zip | |
Mapped out most of the game
Diffstat (limited to 'Plugin.cs')
| -rw-r--r-- | Plugin.cs | 49 |
1 files changed, 2 insertions, 47 deletions
| diff --git a/Plugin.cs b/Plugin.cs index 50e6e2b..df53e96 100644 --- a/Plugin.cs +++ b/Plugin.cs | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | using BepInEx; | 1 | using BepInEx; |
| 2 | using BepInEx.Logging; | 2 | using BepInEx.Logging; |
| 3 | using HarmonyLib; | 3 | using HarmonyLib; |
| 4 | using System.Linq; | ||
| 5 | using System.Reflection; | 4 | using System.Reflection; |
| 6 | 5 | ||
| 7 | namespace ManifoldGardenArchipelago | 6 | namespace ManifoldGardenArchipelago |
| @@ -12,6 +11,7 @@ namespace ManifoldGardenArchipelago | |||
| 12 | internal static new ManualLogSource Logger; | 11 | internal static new ManualLogSource Logger; |
| 13 | 12 | ||
| 14 | public static ArchipelagoManager archipelagoManager = new(); | 13 | public static ArchipelagoManager archipelagoManager = new(); |
| 14 | public static SlotSave slotSave = new(); | ||
| 15 | 15 | ||
| 16 | private void Awake() | 16 | private void Awake() |
| 17 | { | 17 | { |
| @@ -21,6 +21,7 @@ namespace ManifoldGardenArchipelago | |||
| 21 | 21 | ||
| 22 | Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly()); | 22 | Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly()); |
| 23 | 23 | ||
| 24 | GameData.Load(); | ||
| 24 | archipelagoManager.Connect("localhost:38281", "Manifold", "").RunSynchronously(); | 25 | archipelagoManager.Connect("localhost:38281", "Manifold", "").RunSynchronously(); |
| 25 | } | 26 | } |
| 26 | } | 27 | } |
| @@ -34,52 +35,6 @@ namespace ManifoldGardenArchipelago | |||
| 34 | } | 35 | } |
| 35 | } | 36 | } |
| 36 | 37 | ||
| 37 | [HarmonyPatch(typeof(LineDoorController), "SetDoorOpenCloseStateAnimated")] | ||
| 38 | static class LineDoorControllerSetDoorOpenCloseStateAnimatedPatch | ||
| 39 | { | ||
| 40 | static bool Prefix(LineDoorController __instance, bool open) | ||
| 41 | { | ||
| 42 | if (Plugin.archipelagoManager.chainListenersByScene.TryGetValue(__instance.gameObject.scene.name, out var activatedChainListeners)) | ||
| 43 | { | ||
| 44 | LevelSystems levelSystem = __instance.gameObject.scene.GetRootGameObjects().Single((obj) => obj.name == "Level Systems").GetComponent<LevelSystems>(); | ||
| 45 | |||
| 46 | foreach (var listener in activatedChainListeners) | ||
| 47 | { | ||
| 48 | if (levelSystem.chainListeners[listener.Key] == __instance) | ||
| 49 | { | ||
| 50 | if (open != listener.Value) | ||
| 51 | { | ||
| 52 | return false; | ||
| 53 | } | ||
| 54 | } | ||
| 55 | } | ||
| 56 | } | ||
| 57 | |||
| 58 | return true; | ||
| 59 | } | ||
| 60 | } | ||
| 61 | |||
| 62 | [HarmonyPatch(typeof(LineDoorController), nameof(LineDoorController.OnLevelEnable))] | ||
| 63 | static class LineDoorControllerOnLevelEnablePatch | ||
| 64 | { | ||
| 65 | static void Prefix(LineDoorController __instance) | ||
| 66 | { | ||
| 67 | if (Plugin.archipelagoManager.chainListenersByScene.TryGetValue(__instance.gameObject.scene.name, out var activatedChainListeners)) | ||
| 68 | { | ||
| 69 | LevelSystems levelSystem = __instance.gameObject.scene.GetRootGameObjects().Single((obj) => obj.name == "Level Systems").GetComponent<LevelSystems>(); | ||
| 70 | |||
| 71 | foreach (var listener in activatedChainListeners) | ||
| 72 | { | ||
| 73 | if (levelSystem.chainListeners[listener.Key] == __instance) | ||
| 74 | { | ||
| 75 | FieldInfo fieldInfo = typeof(LineDoorController).GetField("doorShouldOpenImmediatelyOnEnable", BindingFlags.Instance | BindingFlags.NonPublic); | ||
| 76 | fieldInfo.SetValue(__instance, listener.Value); | ||
| 77 | } | ||
| 78 | } | ||
| 79 | } | ||
| 80 | } | ||
| 81 | } | ||
| 82 | |||
| 83 | [HarmonyPatch(typeof(ButtonLineActivator), nameof(ButtonLineActivator.OnInteract))] | 38 | [HarmonyPatch(typeof(ButtonLineActivator), nameof(ButtonLineActivator.OnInteract))] |
| 84 | static class ButtonLineActivatorOnInteractPatch | 39 | static class ButtonLineActivatorOnInteractPatch |
| 85 | { | 40 | { |
