From 21ab007efd19f79c0597ea4ebf4e2d4b596323ef Mon Sep 17 00:00:00 2001 From: Nick Date: Thu, 5 May 2022 22:46:19 -0400 Subject: [PATCH] Allow making copies of the stock system --- NewHorizons/External/Configs/StarSystemConfig.cs | 1 + NewHorizons/Handlers/PlanetCreationHandler.cs | 2 +- NewHorizons/Main.cs | 3 +++ NewHorizons/star_system_schema.json | 4 ++++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/NewHorizons/External/Configs/StarSystemConfig.cs b/NewHorizons/External/Configs/StarSystemConfig.cs index 76e43702..29f117ce 100644 --- a/NewHorizons/External/Configs/StarSystemConfig.cs +++ b/NewHorizons/External/Configs/StarSystemConfig.cs @@ -11,6 +11,7 @@ namespace NewHorizons.External.Configs { public bool canEnterViaWarpDrive = true; public bool startHere = false; + public bool destroyStockPlanets = true; public string factRequiredForWarp; public NomaiCoordinates coords; diff --git a/NewHorizons/Handlers/PlanetCreationHandler.cs b/NewHorizons/Handlers/PlanetCreationHandler.cs index 8a362255..a79cee0b 100644 --- a/NewHorizons/Handlers/PlanetCreationHandler.cs +++ b/NewHorizons/Handlers/PlanetCreationHandler.cs @@ -104,7 +104,7 @@ namespace NewHorizons.Handlers // I don't know what these do but they look really weird from a distance Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(PlanetDestroyer.RemoveAllProxies); - if (Main.Instance.CurrentStarSystem != "SolarSystem") PlanetDestroyer.RemoveSolarSystem(); + if (Main.SystemDict[Main.Instance.CurrentStarSystem].Config.destroyStockPlanets) PlanetDestroyer.RemoveSolarSystem(); } public static bool LoadBody(NewHorizonsBody body, bool defaultPrimaryToSun = false) diff --git a/NewHorizons/Main.cs b/NewHorizons/Main.cs index 5c4a3b73..30367959 100644 --- a/NewHorizons/Main.cs +++ b/NewHorizons/Main.cs @@ -110,9 +110,12 @@ namespace NewHorizons GlobalMessenger.AddListener("PlayerDeath", OnDeath); GlobalMessenger.AddListener("WakeUp", new Callback(OnWakeUp)); ShaderBundle = Main.Instance.ModHelper.Assets.LoadBundle("AssetBundle/shader"); + BodyDict["SolarSystem"] = new List(); BodyDict["EyeOfTheUniverse"] = new List(); // Keep this empty tho fr + SystemDict["SolarSystem"] = new NewHorizonsSystem("SolarSystem", new StarSystemConfig(null), this); + SystemDict["SolarSystem"].Config.destroyStockPlanets = false; Logger.Log("Begin load of config files...", Logger.LogType.Log); diff --git a/NewHorizons/star_system_schema.json b/NewHorizons/star_system_schema.json index a10d191a..b31179ed 100644 --- a/NewHorizons/star_system_schema.json +++ b/NewHorizons/star_system_schema.json @@ -15,6 +15,10 @@ "factRequiredForWarp": { "type": "string", "description": "Set to the FactID that must be revealed before it can be warped to. Don't set `CanEnterViaWarpDrive` to false if you're using this, that would make no sense." + }, + "destroyStockPlanets": { + "type": "bool", + "description": "Do you want a clean slate for this star system? Or will it be a modified version of the original." } } }