From 42bc500a77f4b29d952058aede6abfaf91bd74c8 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sun, 23 Feb 2025 16:42:22 -0500 Subject: Add support for lasers The three lasers in Blue are item locked, and the laser in Akshardham requires you to have planted all other god cubes in order to activate. --- GameData.cs | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'GameData.cs') diff --git a/GameData.cs b/GameData.cs index 6b5eddc..f8adb17 100644 --- a/GameData.cs +++ b/GameData.cs @@ -27,6 +27,7 @@ namespace ManifoldGardenArchipelago public readonly Dictionary doors = []; public readonly Dictionary smokeWalls = []; public readonly Dictionary worldGrows = []; + public readonly Dictionary lasers = []; } public class GameStateListeners @@ -35,6 +36,7 @@ namespace ManifoldGardenArchipelago public readonly Dictionary doors = []; public readonly Dictionary smokeWalls = []; public readonly Dictionary worldGrows = []; + public readonly Dictionary lasers = []; } public static class GameData @@ -419,6 +421,8 @@ namespace ManifoldGardenArchipelago Requirement req = ParseRequirement(scenePair.Key, (Dictionary)worldPair.Value); sceneDescription.worldGrows[sir.index] = req; + Plugin.Logger.LogInfo($"World {sir} requirements: {req}"); + foreach (var reqScene in req.references.scenes) { GetOrAddListeners(listenersByScene, reqScene).worldGrows[sir] = req; @@ -456,6 +460,53 @@ namespace ManifoldGardenArchipelago } } + if (sceneDetails.ContainsKey("lasers")) + { + foreach (var laserPair in (Dictionary)sceneDetails["lasers"]) + { + SceneItemReference sir = new(scenePair.Key, int.Parse((string)laserPair.Key)); + Requirement req = ParseRequirement(scenePair.Key, (Dictionary)laserPair.Value); + sceneDescription.lasers[sir.index] = req; + + Plugin.Logger.LogInfo($"Laser {sir} requirements: {req}"); + + foreach (var reqScene in req.references.scenes) + { + GetOrAddListeners(listenersByScene, reqScene).lasers[sir] = req; + } + + foreach (var button in req.references.buttons) + { + GetOrAddListeners(listenersByButton, button).lasers[sir] = req; + } + + foreach (var socket in req.references.sockets) + { + GetOrAddListeners(listenersBySocket, socket).lasers[sir] = req; + } + + foreach (var pad in req.references.pads) + { + GetOrAddListeners(listenersByPad, pad).lasers[sir] = req; + } + + foreach (var waterwheel in req.references.waterwheels) + { + GetOrAddListeners(listenersByWaterwheel, waterwheel).lasers[sir] = req; + } + + foreach (var sphere in req.references.spheres) + { + GetOrAddListeners(listenersBySphere, sphere).lasers[sir] = req; + } + + foreach (var item in req.references.items) + { + GetOrAddListeners(listenersByItem, item).lasers[sir] = req; + } + } + } + scenes[scenePair.Key] = sceneDescription; } } -- cgit 1.4.1