summary refs log tree commit diff stats
path: root/GameData.cs
diff options
context:
space:
mode:
Diffstat (limited to 'GameData.cs')
-rw-r--r--GameData.cs51
1 files changed, 51 insertions, 0 deletions
diff --git a/GameData.cs b/GameData.cs index 6b5eddc..f8adb17 100644 --- a/GameData.cs +++ b/GameData.cs
@@ -27,6 +27,7 @@ namespace ManifoldGardenArchipelago
27 public readonly Dictionary<int, Requirement> doors = []; 27 public readonly Dictionary<int, Requirement> doors = [];
28 public readonly Dictionary<int, Requirement> smokeWalls = []; 28 public readonly Dictionary<int, Requirement> smokeWalls = [];
29 public readonly Dictionary<int, Requirement> worldGrows = []; 29 public readonly Dictionary<int, Requirement> worldGrows = [];
30 public readonly Dictionary<int, Requirement> lasers = [];
30 } 31 }
31 32
32 public class GameStateListeners 33 public class GameStateListeners
@@ -35,6 +36,7 @@ namespace ManifoldGardenArchipelago
35 public readonly Dictionary<SceneItemReference, Requirement> doors = []; 36 public readonly Dictionary<SceneItemReference, Requirement> doors = [];
36 public readonly Dictionary<SceneItemReference, Requirement> smokeWalls = []; 37 public readonly Dictionary<SceneItemReference, Requirement> smokeWalls = [];
37 public readonly Dictionary<SceneItemReference, Requirement> worldGrows = []; 38 public readonly Dictionary<SceneItemReference, Requirement> worldGrows = [];
39 public readonly Dictionary<SceneItemReference, Requirement> lasers = [];
38 } 40 }
39 41
40 public static class GameData 42 public static class GameData
@@ -419,6 +421,8 @@ namespace ManifoldGardenArchipelago
419 Requirement req = ParseRequirement(scenePair.Key, (Dictionary<object, object>)worldPair.Value); 421 Requirement req = ParseRequirement(scenePair.Key, (Dictionary<object, object>)worldPair.Value);
420 sceneDescription.worldGrows[sir.index] = req; 422 sceneDescription.worldGrows[sir.index] = req;
421 423
424 Plugin.Logger.LogInfo($"World {sir} requirements: {req}");
425
422 foreach (var reqScene in req.references.scenes) 426 foreach (var reqScene in req.references.scenes)
423 { 427 {
424 GetOrAddListeners(listenersByScene, reqScene).worldGrows[sir] = req; 428 GetOrAddListeners(listenersByScene, reqScene).worldGrows[sir] = req;
@@ -456,6 +460,53 @@ namespace ManifoldGardenArchipelago
456 } 460 }
457 } 461 }
458 462
463 if (sceneDetails.ContainsKey("lasers"))
464 {
465 foreach (var laserPair in (Dictionary<object, object>)sceneDetails["lasers"])
466 {
467 SceneItemReference sir = new(scenePair.Key, int.Parse((string)laserPair.Key));
468 Requirement req = ParseRequirement(scenePair.Key, (Dictionary<object, object>)laserPair.Value);
469 sceneDescription.lasers[sir.index] = req;
470
471 Plugin.Logger.LogInfo($"Laser {sir} requirements: {req}");
472
473 foreach (var reqScene in req.references.scenes)
474 {
475 GetOrAddListeners(listenersByScene, reqScene).lasers[sir] = req;
476 }
477
478 foreach (var button in req.references.buttons)
479 {
480 GetOrAddListeners(listenersByButton, button).lasers[sir] = req;
481 }
482
483 foreach (var socket in req.references.sockets)
484 {
485 GetOrAddListeners(listenersBySocket, socket).lasers[sir] = req;
486 }
487
488 foreach (var pad in req.references.pads)
489 {
490 GetOrAddListeners(listenersByPad, pad).lasers[sir] = req;
491 }
492
493 foreach (var waterwheel in req.references.waterwheels)
494 {
495 GetOrAddListeners(listenersByWaterwheel, waterwheel).lasers[sir] = req;
496 }
497
498 foreach (var sphere in req.references.spheres)
499 {
500 GetOrAddListeners(listenersBySphere, sphere).lasers[sir] = req;
501 }
502
503 foreach (var item in req.references.items)
504 {
505 GetOrAddListeners(listenersByItem, item).lasers[sir] = req;
506 }
507 }
508 }
509
459 scenes[scenePair.Key] = sceneDescription; 510 scenes[scenePair.Key] = sceneDescription;
460 } 511 }
461 } 512 }