From f26ece5b32d7e3e7c371f7383c676b0dc40c24f1 Mon Sep 17 00:00:00 2001 From: soul Date: Thu, 26 Nov 2026 02:47:25 +0100 Subject: [PATCH] IFL scenario handoff: Die's relaunch fires only if no launch has begun and the manager lives MainMenu.Launching is true from Launch or EnterGame until a refusal; Die's fade completion checks it and the subscription ends with the manager. Co-Authored-By: Claude Sonnet 5.5 --- Assets/Scripts/Gameplay/ActionGameManager.cs | 6 ++++-- Assets/Scripts/UI/MainMenu.cs | 11 ++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/Gameplay/ActionGameManager.cs b/Assets/Scripts/Gameplay/ActionGameManager.cs index 2ecbde487..b610e17ba 100644 --- a/Assets/Scripts/Gameplay/ActionGameManager.cs +++ b/Assets/Scripts/Gameplay/ActionGameManager.cs @@ -1404,8 +1404,10 @@ public class ActionGameManager : MonoBehaviour SevereHypothermiaPost.weight = 0; DeathPost.weight = 1; // Every run begins in the simulation (ruling terminus-boots-into-ifl), so death anywhere returns to it. - MainMenu.Launch(Scenarios.Simulation); - }); + // A New Game or Continue click during the fade has already launched; the scene reload ends the subscription. + if (!MainMenu.Launching) MainMenu.Launch(Scenarios.Simulation); + }) + .AddTo(this); } // public void ToggleEditMode() diff --git a/Assets/Scripts/UI/MainMenu.cs b/Assets/Scripts/UI/MainMenu.cs index 1b57b14c9..0b333e83b 100644 --- a/Assets/Scripts/UI/MainMenu.cs +++ b/Assets/Scripts/UI/MainMenu.cs @@ -29,6 +29,8 @@ public class MainMenu : MonoBehaviour private bool _fadeFromRight; private float _fadeLerp; private bool _fading; + // True from the moment a run is being generated or entered until it fails; the scene reload ends it. + public bool Launching { get; private set; } private Vector3 _panelPosition; //private Task _databaseLoad; @@ -241,6 +243,7 @@ public class MainMenu : MonoBehaviour { var generatorState = "Loading Database Contents"; + Launching = true; Fade(true); _nextMenu.panel.gameObject.SetActive(false); Dialog.Clear(); @@ -261,6 +264,7 @@ public class MainMenu : MonoBehaviour if (generation.IsFaulted) { Debug.LogException(generation.Exception); + Launching = false; ShowMain(); Fade(false); Refuse($"{scenario.Name} could not generate its galaxy", generation.Exception.GetBaseException().Message); @@ -274,7 +278,11 @@ public class MainMenu : MonoBehaviour // The one way into the game scene. Mod ship prototypes import asynchronously at boot, so the scene waits for them, // and a preload that could not run at all stops here with its reason rather than in the first zone. - private void EnterGame() => StartCoroutine(EnterGameWhenModShipsAreReady()); + private void EnterGame() + { + Launching = true; + StartCoroutine(EnterGameWhenModShipsAreReady()); + } private IEnumerator EnterGameWhenModShipsAreReady() { @@ -282,6 +290,7 @@ public class MainMenu : MonoBehaviour while (!loading.IsCompleted) yield return null; if (loading.IsFaulted) { + Launching = false; if (loading.Exception.GetBaseException() is ShipModShips.ImportFault fault) RefuseMods("Mod ships failed to load", fault.Faults); else Refuse("Mod ships failed to load", loading.Exception.GetBaseException().Message); yield break;