From cd85d485584ffb469f141db84334b60551f60c33 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 22 May 2024 18:23:49 -0400 Subject: Added statue items --- AnodyneArchipelago/ArchipelagoManager.cs | 14 +++++++++++++ AnodyneArchipelago/Plugin.cs | 36 ++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/AnodyneArchipelago/ArchipelagoManager.cs b/AnodyneArchipelago/ArchipelagoManager.cs index c10d6ee..83e2d8d 100644 --- a/AnodyneArchipelago/ArchipelagoManager.cs +++ b/AnodyneArchipelago/ArchipelagoManager.cs @@ -1,4 +1,5 @@ using AnodyneSharp.Entities; +using AnodyneSharp.Entities.Enemy.Redcave; using AnodyneSharp.Registry; using Archipelago.MultiClient.Net; using Archipelago.MultiClient.Net.Enums; @@ -157,6 +158,19 @@ namespace AnodyneArchipelago { GlobalState.inventory.HasTransformer = true; } + else if (itemName == "Temple of the Seeing One Statue") + { + // TODO: This and the other two: move while on the same map. + GlobalState.events.SetEvent("StatueMoved_Temple", 1); + } + else if (itemName == "Mountain Cavern Statue") + { + GlobalState.events.SetEvent("StatueMoved_Mountain", 1); + } + else if (itemName == "Red Grotto Statue") + { + GlobalState.events.SetEvent("StatueMoved_Grotto", 1); + } } } } diff --git a/AnodyneArchipelago/Plugin.cs b/AnodyneArchipelago/Plugin.cs index d40da7c..e89595a 100644 --- a/AnodyneArchipelago/Plugin.cs +++ b/AnodyneArchipelago/Plugin.cs @@ -9,6 +9,7 @@ using BepInEx; using BepInEx.NET.Common; using HarmonyLib; using HarmonyLib.Tools; +using Microsoft.Xna.Framework; using System; using System.Collections; using System.Collections.Generic; @@ -193,4 +194,39 @@ namespace AnodyneArchipelago } } } + + [HarmonyPatch(typeof(EntityPreset), nameof(EntityPreset.Create))] + class EntityPresetCreatePatch + { + static void Postfix(EntityPreset __instance, Entity __result) + { + if (__instance.Type.FullName == "AnodyneSharp.Entities.Interactive.DungeonStatue") + { + __result.Position = __instance.Position; + + string eventName = "StatueMoved_"; + Facing moveDir = Facing.RIGHT; + if (__instance.Frame == 0) + { + eventName += "Temple"; + moveDir = Facing.UP; + } + else if (__instance.Frame == 1) + { + eventName += "Grotto"; + } + else if (__instance.Frame == 2) + { + eventName += "Mountain"; + } + + if (GlobalState.events.GetEvent(eventName) == 0) + { + return; + } + + __result.Position += Entity.FacingDirection(moveDir) * 32f; + } + } + } } -- cgit 1.4.1