From b97ba018cba23ff7a494448708a0043a4319feb3 Mon Sep 17 00:00:00 2001 From: Joshua Thome Date: Sat, 19 Apr 2025 14:28:41 -0500 Subject: [PATCH 1/8] Fix general NH warnings --- NewHorizons/Builder/ShipLog/MapModeBuilder.cs | 5 ----- NewHorizons/Handlers/PlanetCreationHandler.cs | 2 -- 2 files changed, 7 deletions(-) diff --git a/NewHorizons/Builder/ShipLog/MapModeBuilder.cs b/NewHorizons/Builder/ShipLog/MapModeBuilder.cs index de4116aa..1be8cc7c 100644 --- a/NewHorizons/Builder/ShipLog/MapModeBuilder.cs +++ b/NewHorizons/Builder/ShipLog/MapModeBuilder.cs @@ -459,11 +459,6 @@ namespace NewHorizons.Builder.ShipLog private static MapModeObject ConstructPrimaryNode(List bodies) { - float DistanceFromPrimary(NewHorizonsBody body) - { - return Mathf.Max(body.Config.Orbit.semiMajorAxis, body.Config.Orbit.staticPosition?.Length() ?? 0f); - } - foreach (NewHorizonsBody body in bodies.Where(b => b.Config.Base.centerOfSolarSystem)) { bodies.Sort((b, o) => b.Config.Orbit.semiMajorAxis.CompareTo(o.Config.Orbit.semiMajorAxis)); diff --git a/NewHorizons/Handlers/PlanetCreationHandler.cs b/NewHorizons/Handlers/PlanetCreationHandler.cs index 8b0c01f2..49bfa706 100644 --- a/NewHorizons/Handlers/PlanetCreationHandler.cs +++ b/NewHorizons/Handlers/PlanetCreationHandler.cs @@ -20,8 +20,6 @@ using System; using System.Collections.Generic; using System.Linq; using UnityEngine; -using NewHorizons.Streaming; -using Newtonsoft.Json; using NewHorizons.External.Modules.VariableSize; using NewHorizons.Components; From fd6ea03f5bc8327b369d837f476bdbcfa20c0a80 Mon Sep 17 00:00:00 2001 From: Joshua Thome Date: Sat, 19 Apr 2025 14:29:06 -0500 Subject: [PATCH 2/8] Add custom repair receiver component --- .../Components/Volumes/NHRepairReceiver.cs | 103 ++++++++++++++++++ .../VolumePatches/RepairReceiverPatches.cs | 62 +++++++++++ 2 files changed, 165 insertions(+) create mode 100644 NewHorizons/Components/Volumes/NHRepairReceiver.cs create mode 100644 NewHorizons/Patches/VolumePatches/RepairReceiverPatches.cs diff --git a/NewHorizons/Components/Volumes/NHRepairReceiver.cs b/NewHorizons/Components/Volumes/NHRepairReceiver.cs new file mode 100644 index 00000000..130d8486 --- /dev/null +++ b/NewHorizons/Components/Volumes/NHRepairReceiver.cs @@ -0,0 +1,103 @@ +using NewHorizons.Handlers; +using OWML.Utils; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using UnityEngine.Events; + +namespace NewHorizons.Components.Volumes +{ + // RepairReceiver isn't set up for proper subclassing but a subclass is necessary for the first-person manipulator to detect it. + public class NHRepairReceiver : RepairReceiver + { + public static Type RepairReceiverType = EnumUtils.Create("NewHorizons"); + + public class RepairEvent : UnityEvent { } + + public RepairEvent OnRepaired = new(); + public RepairEvent OnDamaged = new(); + + public string displayName; + public float repairTime; + public string damagedCondition; + public string repairedCondition; + public string revealFact; + + float _repairFraction = 0f; + UITextType _uiTextType = UITextType.None; + + public float repairFraction + { + get => _repairFraction; + set + { + var prevValue = _repairFraction; + _repairFraction = Mathf.Clamp01(value); + if (prevValue < 1f && _repairFraction >= 1f) + { + Repair(); + } + else if (prevValue >= 1f && _repairFraction < 1f) + { + Damage(); + } + } + } + + public new virtual bool IsRepairable() => IsDamaged(); + public new virtual bool IsDamaged() => _repairFraction < 1f; + public new virtual float GetRepairFraction() => _repairFraction; + + protected new void Awake() + { + base.Awake(); + _type = RepairReceiverType; + if (IsDamaged()) Damage(); + else Repair(); + } + + public new virtual void RepairTick() + { + if (!IsRepairable()) return; + repairFraction += Time.deltaTime / repairTime; + } + + public new virtual UITextType GetRepairableName() + { + if (_uiTextType != UITextType.None) return _uiTextType; + var value = TranslationHandler.GetTranslation(displayName, TranslationHandler.TextType.UI); + _uiTextType = (UITextType)TranslationHandler.AddUI(value, false); + return _uiTextType; + } + + void Damage() + { + if (!string.IsNullOrEmpty(damagedCondition)) + { + DialogueConditionManager.SharedInstance.SetConditionState(damagedCondition, true); + } + if (!string.IsNullOrEmpty(repairedCondition)) + { + DialogueConditionManager.SharedInstance.SetConditionState(repairedCondition, false); + } + OnDamaged.Invoke(this); + } + + void Repair() + { + if (!string.IsNullOrEmpty(damagedCondition)) + { + DialogueConditionManager.SharedInstance.SetConditionState(damagedCondition, false); + } + if (!string.IsNullOrEmpty(repairedCondition)) + { + DialogueConditionManager.SharedInstance.SetConditionState(repairedCondition, true); + } + if (!string.IsNullOrEmpty(revealFact)) + { + Locator.GetShipLogManager().RevealFact(revealFact); + } + OnRepaired.Invoke(this); + } + } +} diff --git a/NewHorizons/Patches/VolumePatches/RepairReceiverPatches.cs b/NewHorizons/Patches/VolumePatches/RepairReceiverPatches.cs new file mode 100644 index 00000000..a21e6b79 --- /dev/null +++ b/NewHorizons/Patches/VolumePatches/RepairReceiverPatches.cs @@ -0,0 +1,62 @@ +using HarmonyLib; +using NewHorizons.Components.Volumes; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NewHorizons.Patches.VolumePatches +{ + + [HarmonyPatch(typeof(RepairReceiver))] + public static class RepairReceiverPatches + { + // We can't actually override these methods so we patch the base class methods to invoke the subclass methods dynamically + + [HarmonyPostfix, HarmonyPatch(nameof(RepairReceiver.IsRepairable))] + public static void IsRepairable(RepairReceiver __instance, ref bool __result) + { + if (__instance is NHRepairReceiver r) + { + __result = r.IsRepairable(); + } + } + + [HarmonyPostfix, HarmonyPatch(nameof(RepairReceiver.RepairTick))] + public static void RepairTick(RepairReceiver __instance) + { + if (__instance is NHRepairReceiver r) + { + r.RepairTick(); + } + } + + [HarmonyPostfix, HarmonyPatch(nameof(RepairReceiver.IsDamaged))] + public static void IsDamaged(RepairReceiver __instance, ref bool __result) + { + if (__instance is NHRepairReceiver r) + { + __result = r.IsDamaged(); + } + } + + [HarmonyPostfix, HarmonyPatch(nameof(RepairReceiver.GetRepairableName))] + public static void GetRepairableName(RepairReceiver __instance, ref UITextType __result) + { + if (__instance is NHRepairReceiver r) + { + __result = r.GetRepairableName(); + } + } + + [HarmonyPostfix, HarmonyPatch(nameof(RepairReceiver.GetRepairFraction))] + public static void GetRepairFraction(RepairReceiver __instance, ref float __result) + { + if (__instance is NHRepairReceiver r) + { + __result = r.GetRepairFraction(); + } + } + } +} From 4212027acafc3e5413f6292a11127b0918eb3f2f Mon Sep 17 00:00:00 2001 From: Joshua Thome Date: Sat, 19 Apr 2025 14:29:29 -0500 Subject: [PATCH 3/8] Repair volume builder and wire-up --- .../Builder/Volumes/RepairVolumeBuilder.cs | 52 +++++++++++++++++++ .../Builder/Volumes/VolumesBuildManager.cs | 7 +++ .../Volumes/VolumeInfos/RepairVolumeInfo.cs | 49 +++++++++++++++++ .../External/Modules/Volumes/VolumesModule.cs | 5 ++ 4 files changed, 113 insertions(+) create mode 100644 NewHorizons/Builder/Volumes/RepairVolumeBuilder.cs create mode 100644 NewHorizons/External/Modules/Volumes/VolumeInfos/RepairVolumeInfo.cs diff --git a/NewHorizons/Builder/Volumes/RepairVolumeBuilder.cs b/NewHorizons/Builder/Volumes/RepairVolumeBuilder.cs new file mode 100644 index 00000000..7f51dc2c --- /dev/null +++ b/NewHorizons/Builder/Volumes/RepairVolumeBuilder.cs @@ -0,0 +1,52 @@ +using NewHorizons.Builder.Props; +using NewHorizons.Components.Volumes; +using NewHorizons.External.Modules.Props; +using NewHorizons.External.Modules.Volumes.VolumeInfos; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace NewHorizons.Builder.Volumes +{ + public static class RepairVolumeBuilder + { + public static NHRepairReceiver Make(GameObject planetGO, Sector sector, RepairVolumeInfo info) + { + // Repair receivers aren't technically volumes (no OWTriggerVolume) so we don't use the VolumeBuilder + + var go = GeneralPropBuilder.MakeNew("RepairVolume", planetGO, sector, info); + + if (info.shape != null) + { + ShapeBuilder.AddCollider(go, info.shape); + } + else + { + var shapeInfo = new ShapeInfo() + { + type = ShapeType.Sphere, + useShape = false, + hasCollision = true, + radius = info.radius, + }; + ShapeBuilder.AddCollider(go, shapeInfo); + } + + var repairReceiver = go.AddComponent(); + repairReceiver.displayName = info.name ?? info.rename ?? go.name; + repairReceiver.repairFraction = info.repairFraction; + repairReceiver.repairTime = info.repairTime; + repairReceiver.repairDistance = info.repairDistance; + repairReceiver.damagedCondition = info.damagedCondition; + repairReceiver.repairedCondition = info.repairedCondition; + repairReceiver.revealFact = info.revealFact; + + go.SetActive(true); + + return repairReceiver; + } + } +} diff --git a/NewHorizons/Builder/Volumes/VolumesBuildManager.cs b/NewHorizons/Builder/Volumes/VolumesBuildManager.cs index 161f1d6a..40303a0c 100644 --- a/NewHorizons/Builder/Volumes/VolumesBuildManager.cs +++ b/NewHorizons/Builder/Volumes/VolumesBuildManager.cs @@ -222,6 +222,13 @@ namespace NewHorizons.Builder.Volumes VolumeBuilder.MakeAndEnable(go, sector, referenceFrameBlockerVolume); } } + if (config.Volumes.repairVolumes != null) + { + foreach (var repairVolume in config.Volumes.repairVolumes) + { + RepairVolumeBuilder.Make(go, sector, repairVolume); + } + } if (config.Volumes.speedTrapVolumes != null) { foreach (var speedTrapVolume in config.Volumes.speedTrapVolumes) diff --git a/NewHorizons/External/Modules/Volumes/VolumeInfos/RepairVolumeInfo.cs b/NewHorizons/External/Modules/Volumes/VolumeInfos/RepairVolumeInfo.cs new file mode 100644 index 00000000..550e2a3d --- /dev/null +++ b/NewHorizons/External/Modules/Volumes/VolumeInfos/RepairVolumeInfo.cs @@ -0,0 +1,49 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NewHorizons.External.Modules.Volumes.VolumeInfos +{ + [JsonObject] + public class RepairVolumeInfo : VolumeInfo + { + /// + /// The name displayed in the UI when the player is repairing this object. If not set, the name of the object will be used. + /// + public string name; + + /// + /// How much of the object is initially repaired. 0 = not repaired, 1 = fully repaired. + /// + [DefaultValue(0f)] public float repairFraction = 0f; + + /// + /// The time it takes to repair the object. Defaults to 3 seconds. + /// + [DefaultValue(3f)] public float repairTime = 3f; + + /// + /// The distance from the object that the player can be to repair it. Defaults to 3 meters. + /// + [DefaultValue(3f)] public float repairDistance = 3f; + + /// + /// A dialogue condition that will be set while the object is damaged. It will be unset when the object is repaired. + /// + public string damagedCondition; + + /// + /// A dialogue condition that will be set when the object is repaired. It will be unset if the object is damaged again. + /// + public string repairedCondition; + + /// + /// A ship log fact that will be revealed when the object is repaired. + /// + public string revealFact; + } +} diff --git a/NewHorizons/External/Modules/Volumes/VolumesModule.cs b/NewHorizons/External/Modules/Volumes/VolumesModule.cs index 34795d15..800e94bd 100644 --- a/NewHorizons/External/Modules/Volumes/VolumesModule.cs +++ b/NewHorizons/External/Modules/Volumes/VolumesModule.cs @@ -85,6 +85,11 @@ namespace NewHorizons.External.Modules.Volumes /// public VolumeInfo[] referenceFrameBlockerVolumes; + /// + /// Add repair volumes to this planet. + /// + public RepairVolumeInfo[] repairVolumes; + /// /// Add triggers that reveal parts of the ship log on this planet. /// From 437826d6105b81a7f6365214d1605bafaa0971ef Mon Sep 17 00:00:00 2001 From: Ben C Date: Sat, 19 Apr 2025 21:30:00 +0000 Subject: [PATCH 4/8] Updated Schemas --- NewHorizons/Schemas/body_schema.json | 84 ++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/NewHorizons/Schemas/body_schema.json b/NewHorizons/Schemas/body_schema.json index 27da29db..313f300b 100644 --- a/NewHorizons/Schemas/body_schema.json +++ b/NewHorizons/Schemas/body_schema.json @@ -5450,6 +5450,13 @@ "$ref": "#/definitions/VolumeInfo" } }, + "repairVolumes": { + "type": "array", + "description": "Add repair volumes to this planet.", + "items": { + "$ref": "#/definitions/RepairVolumeInfo" + } + }, "revealVolumes": { "type": "array", "description": "Add triggers that reveal parts of the ship log on this planet.", @@ -6722,6 +6729,83 @@ } } }, + "RepairVolumeInfo": { + "type": "object", + "additionalProperties": false, + "properties": { + "radius": { + "type": "number", + "description": "The radius of this volume, if a shape is not specified.", + "format": "float", + "default": 1.0 + }, + "shape": { + "description": "The shape of this volume. Defaults to a sphere with a radius of `radius` if not specified.", + "$ref": "#/definitions/ShapeInfo" + }, + "rotation": { + "description": "Rotation of the object", + "$ref": "#/definitions/MVector3" + }, + "alignRadial": { + "type": [ + "boolean", + "null" + ], + "description": "Do we try to automatically align this object to stand upright relative to the body's center? Stacks with rotation.\nDefaults to true for geysers, tornados, and volcanoes, and false for everything else." + }, + "position": { + "description": "Position of the object", + "$ref": "#/definitions/MVector3" + }, + "isRelativeToParent": { + "type": "boolean", + "description": "Whether the positional and rotational coordinates are relative to parent instead of the root planet object." + }, + "parentPath": { + "type": "string", + "description": "The relative path from the planet to the parent of this object. Optional (will default to the root sector)." + }, + "rename": { + "type": "string", + "description": "An optional rename of this object" + }, + "name": { + "type": "string", + "description": "The name displayed in the UI when the player is repairing this object. If not set, the name of the object will be used." + }, + "repairFraction": { + "type": "number", + "description": "How much of the object is initially repaired. 0 = not repaired, 1 = fully repaired.", + "format": "float", + "default": 0.0 + }, + "repairTime": { + "type": "number", + "description": "The time it takes to repair the object. Defaults to 3 seconds.", + "format": "float", + "default": 3.0 + }, + "repairDistance": { + "type": "number", + "description": "The distance from the object that the player can be to repair it. Defaults to 3 meters.", + "format": "float", + "default": 3.0 + }, + "damagedCondition": { + "type": "string", + "description": "A dialogue condition that will be set while the object is damaged. It will be unset when the object is repaired." + }, + "repairedCondition": { + "type": "string", + "description": "A dialogue condition that will be set when the object is repaired. It will be unset if the object is damaged again." + }, + "revealFact": { + "type": "string", + "description": "A ship log fact that will be revealed when the object is repaired." + } + } + }, "RevealVolumeInfo": { "type": "object", "additionalProperties": false, From ae5f1b7a6806e85abfe5095c41c6c1c520944088 Mon Sep 17 00:00:00 2001 From: xen-42 Date: Sun, 27 Apr 2025 11:57:36 -0400 Subject: [PATCH 5/8] Add popup recommending chinese font fix if its not installed and the language is set to chinese --- .../Assets/translations/chinese_simple.json | 1 + NewHorizons/Assets/translations/english.json | 1 + NewHorizons/External/NewHorizonsData.cs | 1 + NewHorizons/Main.cs | 7 +++++++ .../OtherMods/MenuFramework/MenuHandler.cs | 15 +++++++++++++++ 5 files changed, 25 insertions(+) diff --git a/NewHorizons/Assets/translations/chinese_simple.json b/NewHorizons/Assets/translations/chinese_simple.json index f541e484..9d7d0560 100644 --- a/NewHorizons/Assets/translations/chinese_simple.json +++ b/NewHorizons/Assets/translations/chinese_simple.json @@ -6,6 +6,7 @@ "NEW_HORIZONS_WARP_DRIVE_DIALOGUE_3": "之后只需要系好安全带并启动自动驾驶即可进行跃迁!" }, "UIDictionary": { + "INSTALL_OUTER_WILDS_CHINESE_FONT_FIX": "在享受故事之前,建议安装Outer Wilds Chinese Fix这个Mod来解决缺字问题。", "INTERSTELLAR_MODE": "恒星际模式", "FREQ_STATUE": "挪麦雕像", "FREQ_WARP_CORE": "反引力推进", diff --git a/NewHorizons/Assets/translations/english.json b/NewHorizons/Assets/translations/english.json index 6eed88c3..30857f54 100644 --- a/NewHorizons/Assets/translations/english.json +++ b/NewHorizons/Assets/translations/english.json @@ -6,6 +6,7 @@ "NEW_HORIZONS_WARP_DRIVE_DIALOGUE_3": "Then just buckle up and engage the autopilot to warp there!" }, "UIDictionary": { + "INSTALL_OUTER_WILDS_CHINESE_FONT_FIX": "What why is this message being shown when the language is not set to Chinese go report this bug!", "INTERSTELLAR_MODE": "Interstellar Mode", "FREQ_STATUE": "Nomai Statue", "FREQ_WARP_CORE": "Anti-Graviton Flux", diff --git a/NewHorizons/External/NewHorizonsData.cs b/NewHorizons/External/NewHorizonsData.cs index cedb624a..199ec3ec 100644 --- a/NewHorizons/External/NewHorizonsData.cs +++ b/NewHorizons/External/NewHorizonsData.cs @@ -191,6 +191,7 @@ namespace NewHorizons.External if (_activeProfile != null && !_activeProfile.PopupsRead.Contains(id)) { _activeProfile.PopupsRead.Add(id); + Save(); } } diff --git a/NewHorizons/Main.cs b/NewHorizons/Main.cs index f391baaf..15bb0769 100644 --- a/NewHorizons/Main.cs +++ b/NewHorizons/Main.cs @@ -35,6 +35,8 @@ using System.Reflection; using UnityEngine; using UnityEngine.Events; using UnityEngine.SceneManagement; +using static TextTranslation; +using static UnityEngine.InputSystem.InputRemoting; namespace NewHorizons { @@ -439,6 +441,11 @@ namespace NewHorizons TitleSceneHandler.Init(); } + if (isTitleScreen) + { + MenuHandler.TitleScreen(); + } + // EOTU fixes if (isEyeOfTheUniverse) { diff --git a/NewHorizons/OtherMods/MenuFramework/MenuHandler.cs b/NewHorizons/OtherMods/MenuFramework/MenuHandler.cs index 1a54fc46..4a3228ff 100644 --- a/NewHorizons/OtherMods/MenuFramework/MenuHandler.cs +++ b/NewHorizons/OtherMods/MenuFramework/MenuHandler.cs @@ -3,9 +3,11 @@ using NewHorizons.Handlers; using NewHorizons.Utility; using NewHorizons.Utility.OWML; using OWML.Common; +using OWML.ModHelper; using System.Collections.Generic; using System.Linq; using UnityEngine; +using static TextTranslation; namespace NewHorizons.OtherMods.MenuFramework { @@ -61,5 +63,18 @@ namespace NewHorizons.OtherMods.MenuFramework public static void RegisterFailedConfig(string filename) => _failedFiles.Add(filename); public static void RegisterOneTimePopup(IModBehaviour mod, string message, bool repeat) => _registeredPopups.Add((mod, message, repeat)); + + public static void TitleScreen() + { + // Custom popup for recommending the Chinese Outer Wilds Font Fix mod if they are playing in chinese + // Only shows once per profile + if (TextTranslation.Get().m_language == Language.CHINESE_SIMPLE + && !Main.Instance.ModHelper.Interaction.ModExists("nice2cu1.OuterWildFixFont") + && !NewHorizonsData.HasReadOneTimePopup("INSTALL_OUTER_WILDS_CHINESE_FONT_FIX")) + { + Main.Instance.ModHelper.MenuHelper.PopupMenuManager.RegisterStartupPopup(TranslationHandler.GetTranslation("INSTALL_OUTER_WILDS_CHINESE_FONT_FIX", TranslationHandler.TextType.UI)); + NewHorizonsData.ReadOneTimePopup("INSTALL_OUTER_WILDS_CHINESE_FONT_FIX"); + } + } } } From 3c09f84e0b71e14ce09fd08bde24d12dfc845e4e Mon Sep 17 00:00:00 2001 From: xen-42 Date: Mon, 12 May 2025 17:36:08 -0400 Subject: [PATCH 6/8] Update manifest.json --- NewHorizons/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/manifest.json b/NewHorizons/manifest.json index 39a8fea3..8e5f40cb 100644 --- a/NewHorizons/manifest.json +++ b/NewHorizons/manifest.json @@ -4,7 +4,7 @@ "author": "xen, Bwc9876, JohnCorby, MegaPiggy, and friends", "name": "New Horizons", "uniqueName": "xen.NewHorizons", - "version": "1.28.2", + "version": "1.28.3", "owmlVersion": "2.12.1", "dependencies": [ "JohnCorby.VanillaFix", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ], "conflicts": [ "PacificEngine.OW_CommonResources" ], From 20158fd94a523242d6976e251a0512191c354fa0 Mon Sep 17 00:00:00 2001 From: xen-42 Date: Sat, 24 May 2025 20:49:50 -0400 Subject: [PATCH 7/8] Update Main.cs --- NewHorizons/Main.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/NewHorizons/Main.cs b/NewHorizons/Main.cs index 15bb0769..260db13a 100644 --- a/NewHorizons/Main.cs +++ b/NewHorizons/Main.cs @@ -35,8 +35,6 @@ using System.Reflection; using UnityEngine; using UnityEngine.Events; using UnityEngine.SceneManagement; -using static TextTranslation; -using static UnityEngine.InputSystem.InputRemoting; namespace NewHorizons { From 0a058ac135ebed989d3185839303f48802bbb1b7 Mon Sep 17 00:00:00 2001 From: xen-42 Date: Sat, 24 May 2025 20:51:50 -0400 Subject: [PATCH 8/8] Add clear system api method for Nomai Sky --- NewHorizons/INewHorizons.cs | 7 +++++++ NewHorizons/NewHorizonsApi.cs | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/NewHorizons/INewHorizons.cs b/NewHorizons/INewHorizons.cs index 07512ad6..deecd0cf 100644 --- a/NewHorizons/INewHorizons.cs +++ b/NewHorizons/INewHorizons.cs @@ -255,5 +255,12 @@ namespace NewHorizons /// Persistent condition required for this title screen to appear. /// Ship log fact required for this title screen to appear. void RegisterTitleScreenBuilder(IModBehaviour mod, Action builder, bool disableNHPlanets = true, bool shareTitleScreen = false, string persistentConditionRequired = null, string factRequired = null); + + /// + /// Clears all loaded configs for the given system. + /// This exists solely for Nomai Sky to use :bleh: + /// + /// + void ClearSystem(string name); } } diff --git a/NewHorizons/NewHorizonsApi.cs b/NewHorizons/NewHorizonsApi.cs index 14a4fdcf..e62d0bdb 100644 --- a/NewHorizons/NewHorizonsApi.cs +++ b/NewHorizons/NewHorizonsApi.cs @@ -367,5 +367,17 @@ namespace NewHorizons public void RegisterTitleScreenBuilder(IModBehaviour mod, Action builder, bool disableNHPlanets = true, bool shareTitleScreen = false, string persistentConditionRequired = null, string factRequired = null) => TitleSceneHandler.RegisterBuilder(mod, builder, disableNHPlanets, shareTitleScreen, persistentConditionRequired, factRequired); + + public void ClearSystem(string name) + { + if (Main.SystemDict.ContainsKey(name)) + { + Main.SystemDict.Remove(name); + } + if (Main.BodyDict.ContainsKey(name)) + { + Main.BodyDict.Remove(name); + } + } } }