summary refs log tree commit diff stats
path: root/GameplayPatches.cs
diff options
context:
space:
mode:
Diffstat (limited to 'GameplayPatches.cs')
-rw-r--r--GameplayPatches.cs56
1 files changed, 56 insertions, 0 deletions
diff --git a/GameplayPatches.cs b/GameplayPatches.cs index 03e3f13..5e551ea 100644 --- a/GameplayPatches.cs +++ b/GameplayPatches.cs
@@ -453,4 +453,60 @@ namespace ManifoldGardenArchipelago
453 return true; 453 return true;
454 } 454 }
455 } 455 }
456
457 [HarmonyPatch(typeof(LevelSystems), nameof(LevelSystems.InitializeAndLoadLevel))]
458 static class LevelSystemsInitializeAndLoadLevelPatch
459 {
460 static void Prefix(LevelSystems __instance)
461 {
462 if (Plugin.archipelagoManager.RoomShuffle)
463 {
464 if (GameData.scenes.TryGetValue(__instance.levelName, out SceneDescription sceneDescription))
465 {
466 foreach (var portal in __instance.LevelInfo.portalList)
467 {
468 if (sceneDescription.portals.TryGetValue(portal.portalName, out EntranceIdentifier exitId) &&
469 Plugin.archipelagoManager.EntranceMapping.TryGetValue(exitId, out EntranceIdentifier enterId) &&
470 GameData.portal_by_entrance.TryGetValue(enterId, out PortalDescription pairedPortalDescription))
471 {
472 SceneLink secondLink = new()
473 {
474 portalName = pairedPortalDescription.name,
475 sceneName = pairedPortalDescription.scene.Substring(0, pairedPortalDescription.scene.Length - 10),
476 gravity = GravityDirection.DownBlue,
477 targetScene = portal,
478 };
479 portal.targetScene = secondLink;
480 }
481 }
482 }
483 }
484
485 /*if (__instance.gameObject.scene.name == "World_000_Optimized")
486 {
487 // 0: Portal_W001
488 SceneLink sceneLink = __instance.LevelInfo.portalList[0];
489 SceneLink secondLink = new()
490 {
491 portalName = "Portal_W063",
492 sceneName = "Hallway_W045_W073",
493 gravity = GravityDirection.DownBlue,
494 targetScene = sceneLink
495 };
496 sceneLink.targetScene = secondLink;
497 }
498 else if (__instance.gameObject.scene.name == "Hallway_W045_W073_Optimized")
499 {
500 SceneLink sceneLink = __instance.LevelInfo.portalList[3];
501 SceneLink secondLink = new()
502 {
503 portalName = "Portal_W001",
504 sceneName = "World_000",
505 gravity = GravityDirection.DownBlue,
506 targetScene = sceneLink
507 };
508 sceneLink.targetScene = secondLink;
509 }*/
510 }
511 }
456} 512}