From dca563648001d34c5007901587f19de9d796f571 Mon Sep 17 00:00:00 2001 From: TerrificTrifid <99054745+TerrificTrifid@users.noreply.github.com> Date: Sun, 1 Jan 2023 20:05:32 -0600 Subject: [PATCH] Manual recursion fix --- NewHorizons/Builder/Props/BrambleNodeBuilder.cs | 9 +++++++++ NewHorizons/External/Modules/BrambleModule.cs | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/NewHorizons/Builder/Props/BrambleNodeBuilder.cs b/NewHorizons/Builder/Props/BrambleNodeBuilder.cs index f3980776..4d2d32ce 100644 --- a/NewHorizons/Builder/Props/BrambleNodeBuilder.cs +++ b/NewHorizons/Builder/Props/BrambleNodeBuilder.cs @@ -365,6 +365,15 @@ namespace NewHorizons.Builder.Props var success = PairEntrance(innerFogWarpVolume, config.linksTo); if (!success) RecordUnpairedNode(innerFogWarpVolume, config.linksTo); + if (config.preventRecursionCrash) + { + Delay.FireOnNextUpdate(() => + { + var destination = GetOuterFogWarpVolumeFromAstroObject(AstroObjectLocator.GetAstroObject(config.linksTo).gameObject); + if (destination != null) destination._senderWarps.Remove(innerFogWarpVolume); + }); + } + // Cleanup for dimension exits if (config.name != null) { diff --git a/NewHorizons/External/Modules/BrambleModule.cs b/NewHorizons/External/Modules/BrambleModule.cs index c3405e37..9b98c0de 100644 --- a/NewHorizons/External/Modules/BrambleModule.cs +++ b/NewHorizons/External/Modules/BrambleModule.cs @@ -134,6 +134,12 @@ namespace NewHorizons.External.Modules /// public int[] possibleExits; + /// + /// If your game hard crashes upon entering bramble, it's most likely because you have indirectly recursive dimensions, i.e. one leads to another that leads back to the first one. + /// Set this to true for one of the nodes in the recursion to fix this, at the cost of it no longer showing markers for the scout, ship, etc. + /// + [DefaultValue(false)] public bool preventRecursionCrash = false; + #region Obsolete [Obsolete("farFogTint is deprecated, please use fogTint instead")]