diff --git a/NewHorizons/External/Configs/StarSystemConfig.cs b/NewHorizons/External/Configs/StarSystemConfig.cs index a5fcb088..a087587b 100644 --- a/NewHorizons/External/Configs/StarSystemConfig.cs +++ b/NewHorizons/External/Configs/StarSystemConfig.cs @@ -2,6 +2,7 @@ using System; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Linq; +using System.Xml; using NewHorizons.External.Modules; using NewHorizons.External.SerializableData; using Newtonsoft.Json; @@ -31,10 +32,29 @@ namespace NewHorizons.External.Configs public float farClipPlaneOverride; /// - /// Whether this system can be warped to via the warp drive. If you set factRequiredForWarp, this will be true. + /// Whether this system can be warped to via the warp drive. If you set `factRequiredForWarp`, this will be true. + /// Does NOT effect the base SolarSystem. For that, see `canWarpHome` and `factRequiredForWarpHome` /// [DefaultValue(true)] public bool canEnterViaWarpDrive = true; + /// + /// The FactID that must be revealed before it can be warped to. Don't set `canEnterViaWarpDrive` to `false` if + /// you're using this, because it will be overwritten. + /// + public string factRequiredForWarp; + + /// + /// Can you use the warp drive to return home to the Outer Wilds from this system? If you set `factRequiredForWarpHome` + /// this will be true. + /// + [DefaultValue(true)] public bool canWarpHome = true; + + /// + /// The FactID that must be revealed for you to warp back to the main solar system from here. Don't set `canWarpHome` + /// to `false` if you're using this, because it will be overwritten. + /// + public string factRequiredForWarpHome; + /// /// Do you want a clean slate for this star system? Or will it be a modified version of the original. /// @@ -45,12 +65,6 @@ namespace NewHorizons.External.Configs /// [DefaultValue(true)] public bool enableTimeLoop = true; - /// - /// The FactID that must be revealed before it can be warped to. Don't set `canEnterViaWarpDrive` to `false` if - /// you're using this, because it will be overwritten. - /// - public string factRequiredForWarp; - /// /// The duration of the time loop in minutes. This is the time the sun explodes. End Times plays 85 seconds before this time, and your memories get sent back about 40 seconds after this time. /// @@ -414,6 +428,10 @@ namespace NewHorizons.External.Configs Vessel.warpExit.attachToVessel = true; } } + if (!string.IsNullOrEmpty(factRequiredForWarpHome)) + { + canWarpHome = true; + } } } } \ No newline at end of file diff --git a/NewHorizons/External/NewHorizonsSystem.cs b/NewHorizons/External/NewHorizonsSystem.cs index 0724a027..08bc01a7 100644 --- a/NewHorizons/External/NewHorizonsSystem.cs +++ b/NewHorizons/External/NewHorizonsSystem.cs @@ -1,6 +1,7 @@ using NewHorizons.External.Configs; using NewHorizons.External.Modules; using OWML.Common; +using System.Linq; namespace NewHorizons.External { @@ -19,6 +20,12 @@ namespace NewHorizons.External Config = config; RelativePath = relativePath; Mod = mod; + + // Backwards compat + if (new string[] { "2walker2.OogaBooga", "2walker2.EndingIfYouWarpHereYouAreMean", "FeldsparSystem" }.Contains(uniqueID)) + { + config.canWarpHome = false; + } } } } diff --git a/NewHorizons/Handlers/StarChartHandler.cs b/NewHorizons/Handlers/StarChartHandler.cs index 3b874ee9..6cd6cf22 100644 --- a/NewHorizons/Handlers/StarChartHandler.cs +++ b/NewHorizons/Handlers/StarChartHandler.cs @@ -58,10 +58,15 @@ namespace NewHorizons.Handlers foreach (NewHorizonsSystem system in _systems) { - if (system.Config.factRequiredForWarp != default) + if (system.Config.factRequiredForWarp != default && system.UniqueID != "SolarSystem") { RegisterFactForSystem(system.Config.factRequiredForWarp, system.UniqueID); } + + if (system.UniqueID == Main.Instance.CurrentStarSystem && !string.IsNullOrEmpty(system.Config.factRequiredForWarpHome)) + { + RegisterFactForSystem(system.Config.factRequiredForWarpHome, "SolarSystem"); + } } } @@ -113,8 +118,16 @@ namespace NewHorizons.Handlers else if (system.Equals("EyeOfTheUniverse")) canWarpTo = false; else if (config.Spawn?.shipSpawn != null) canWarpTo = true; + var canEnterViaWarpDrive = Main.SystemDict[system].Config.canEnterViaWarpDrive; + + // For the base solar system, use canWarpHome instead for better mod compat + if (system.Equals("SolarSystem")) + { + canEnterViaWarpDrive = Main.SystemDict[Main.Instance.CurrentStarSystem].Config.canWarpHome; + } + return canWarpTo - && Main.SystemDict[system].Config.canEnterViaWarpDrive + && canEnterViaWarpDrive && system != Main.Instance.CurrentStarSystem && HasUnlockedSystem(system); } diff --git a/NewHorizons/manifest.json b/NewHorizons/manifest.json index ab7181ac..03b343b9 100644 --- a/NewHorizons/manifest.json +++ b/NewHorizons/manifest.json @@ -4,7 +4,7 @@ "author": "xen, Bwc9876, JohnCorby, MegaPiggy, Clay, Trifid, and friends", "name": "New Horizons", "uniqueName": "xen.NewHorizons", - "version": "1.22.5", + "version": "1.22.6", "owmlVersion": "2.12.1", "dependencies": [ "JohnCorby.VanillaFix", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ], "conflicts": [ "PacificEngine.OW_CommonResources" ],