From 29ccf772bf5c9176b6ca08b4d3aed79eeab3fc74 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Mon, 5 Sep 2022 01:09:11 -0400 Subject: [PATCH 01/10] Add screen prompts for debug stuff --- NewHorizons/Assets/translations/english.json | 7 ++++- .../DebugUtilities/DebugNomaiTextPlacer.cs | 19 +++++++++++- .../Utility/DebugUtilities/DebugPropPlacer.cs | 31 +++++++++++++++++++ .../Utility/DebugUtilities/DebugRaycaster.cs | 19 ++++++++++-- NewHorizons/Utility/ImageUtilities.cs | 11 ++++++- 5 files changed, 82 insertions(+), 5 deletions(-) diff --git a/NewHorizons/Assets/translations/english.json b/NewHorizons/Assets/translations/english.json index b7aae651..3c3d3126 100644 --- a/NewHorizons/Assets/translations/english.json +++ b/NewHorizons/Assets/translations/english.json @@ -14,7 +14,12 @@ "WARP_LOCKED": "AUTOPILOT LOCKED TO:\n{0}", "LOCK_AUTOPILOT_WARP": "Lock Autopilot to Star System", "RICH_PRESENCE_EXPLORING": "Exploring {0}.", - "RICH_PRESENCE_WARPING": "Warping to {0}." + "RICH_PRESENCE_WARPING": "Warping to {0}.", + "DEBUG_RAYCAST": "Raycast", + "DEBUG_PLACE": "Place Object", + "DEBUG_PLACE_TEXT": "Place Nomai Text", + "DEBUG_UNDO": "Undo", + "DEBUG_REDO": "Redo" }, "AchievementTranslations": { "NH_EATEN_OUTSIDE_BRAMBLE": { diff --git a/NewHorizons/Utility/DebugUtilities/DebugNomaiTextPlacer.cs b/NewHorizons/Utility/DebugUtilities/DebugNomaiTextPlacer.cs index d26815e8..13bf0523 100644 --- a/NewHorizons/Utility/DebugUtilities/DebugNomaiTextPlacer.cs +++ b/NewHorizons/Utility/DebugUtilities/DebugNomaiTextPlacer.cs @@ -1,3 +1,4 @@ +using NewHorizons.Handlers; using System; using System.Collections.Generic; using System.Linq; @@ -15,13 +16,24 @@ namespace NewHorizons.Utility.DebugUtilities private DebugRaycaster _rc; + private ScreenPrompt _placePrompt; + private void Awake() { _rc = this.GetComponent(); + + _placePrompt = new ScreenPrompt(TranslationHandler.GetTranslation("DEBUG_PLACE_TEXT", TranslationHandler.TextType.UI) + " ", ImageUtilities.GetButtonSprite(KeyCode.G)); + Locator.GetPromptManager().AddScreenPrompt(_placePrompt, PromptPosition.UpperRight, false); } - void Update() + private void OnDestroy() { + Locator.GetPromptManager()?.RemoveScreenPrompt(_placePrompt, PromptPosition.UpperRight); + } + + private void Update() + { + UpdatePromptVisibility(); if (!Main.Debug) return; if (!active) return; @@ -31,5 +43,10 @@ namespace NewHorizons.Utility.DebugUtilities if (onRaycast != null) onRaycast.Invoke(data); } } + + public void UpdatePromptVisibility() + { + _placePrompt.SetVisibility(!OWTime.IsPaused() && Main.Debug && active); + } } } diff --git a/NewHorizons/Utility/DebugUtilities/DebugPropPlacer.cs b/NewHorizons/Utility/DebugUtilities/DebugPropPlacer.cs index c3bb644c..70e85fcc 100644 --- a/NewHorizons/Utility/DebugUtilities/DebugPropPlacer.cs +++ b/NewHorizons/Utility/DebugUtilities/DebugPropPlacer.cs @@ -1,6 +1,7 @@ using NewHorizons.Builder.Props; using NewHorizons.External.Configs; using NewHorizons.External.Modules; +using NewHorizons.Handlers; using System.Collections.Generic; using System.Linq; using UnityEngine; @@ -39,14 +40,36 @@ namespace NewHorizons.Utility.DebugUtilities public GameObject mostRecentlyPlacedPropGO { get { return props.Count() <= 0 ? null : props[props.Count() - 1].gameObject; } } public string mostRecentlyPlacedPropPath { get { return props.Count() <= 0 ? "" : props[props.Count() - 1].detailInfo.path; } } + private ScreenPrompt _placePrompt; + private ScreenPrompt _undoPrompt; + private ScreenPrompt _redoPrompt; + private void Awake() { _rc = this.GetRequiredComponent(); currentObject = DEFAULT_OBJECT; + + _placePrompt = new ScreenPrompt(TranslationHandler.GetTranslation("DEBUG_PLACE", TranslationHandler.TextType.UI) + " ", ImageUtilities.GetButtonSprite(KeyCode.G)); + _undoPrompt = new ScreenPrompt(TranslationHandler.GetTranslation("DEBUG_UNDO", TranslationHandler.TextType.UI) + " ", ImageUtilities.GetButtonSprite(KeyCode.Minus)); + _redoPrompt = new ScreenPrompt(TranslationHandler.GetTranslation("DEBUG_REDO", TranslationHandler.TextType.UI) + " ", ImageUtilities.GetButtonSprite(KeyCode.Equals)); + + Locator.GetPromptManager().AddScreenPrompt(_placePrompt, PromptPosition.UpperRight, false); + Locator.GetPromptManager().AddScreenPrompt(_undoPrompt, PromptPosition.UpperRight, false); + Locator.GetPromptManager().AddScreenPrompt(_redoPrompt, PromptPosition.UpperRight, false); + } + + private void OnDestroy() + { + var promptManager = Locator.GetPromptManager(); + if (promptManager == null) return; + promptManager.RemoveScreenPrompt(_placePrompt, PromptPosition.UpperRight); + promptManager.RemoveScreenPrompt(_undoPrompt, PromptPosition.UpperRight); + promptManager.RemoveScreenPrompt(_redoPrompt, PromptPosition.UpperRight); } private void Update() { + UpdatePromptVisibility(); if (!Main.Debug) return; if (!active) return; @@ -66,6 +89,14 @@ namespace NewHorizons.Utility.DebugUtilities } } + public void UpdatePromptVisibility() + { + var visible = !OWTime.IsPaused() && Main.Debug && active; + _placePrompt.SetVisibility(visible); + _undoPrompt.SetVisibility(visible && props.Count > 0); + _redoPrompt.SetVisibility(visible && deletedProps.Count > 0); + } + public void SetCurrentObject(string s) { currentObject = s; diff --git a/NewHorizons/Utility/DebugUtilities/DebugRaycaster.cs b/NewHorizons/Utility/DebugUtilities/DebugRaycaster.cs index b01e68e5..16f502e8 100644 --- a/NewHorizons/Utility/DebugUtilities/DebugRaycaster.cs +++ b/NewHorizons/Utility/DebugUtilities/DebugRaycaster.cs @@ -1,4 +1,4 @@ -using NewHorizons.Components.Orbital; +using NewHorizons.Handlers; using UnityEngine; using UnityEngine.InputSystem; @@ -17,15 +17,25 @@ namespace NewHorizons.Utility.DebugUtilities private GameObject _planeDownRightSphere; private GameObject _planeDownLeftSphere; + private ScreenPrompt _raycastPrompt; private void Awake() { _rb = this.GetRequiredComponent(); + + _raycastPrompt = new ScreenPrompt(TranslationHandler.GetTranslation("DEBUG_RAYCAST", TranslationHandler.TextType.UI) + " ", ImageUtilities.GetButtonSprite(KeyCode.P)); + + Locator.GetPromptManager().AddScreenPrompt(_raycastPrompt, PromptPosition.UpperRight, false); } + private void OnDestroy() + { + Locator.GetPromptManager()?.RemoveScreenPrompt(_raycastPrompt, PromptPosition.UpperRight); + } private void Update() { + UpdatePromptVisibility(); if (!Main.Debug) return; if (Keyboard.current == null) return; @@ -35,7 +45,12 @@ namespace NewHorizons.Utility.DebugUtilities } } - + + public void UpdatePromptVisibility() + { + _raycastPrompt.SetVisibility(!OWTime.IsPaused() && Main.Debug); + } + internal void PrintRaycast() { diff --git a/NewHorizons/Utility/ImageUtilities.cs b/NewHorizons/Utility/ImageUtilities.cs index 37bc267b..e875341f 100644 --- a/NewHorizons/Utility/ImageUtilities.cs +++ b/NewHorizons/Utility/ImageUtilities.cs @@ -351,7 +351,16 @@ namespace NewHorizons.Utility newTexture.Apply(); return newTexture; } - + + public static Sprite GetButtonSprite(JoystickButton button) => GetButtonSprite(ButtonPromptLibrary.SharedInstance.GetButtonTexture(button)); + public static Sprite GetButtonSprite(KeyCode key) => GetButtonSprite(ButtonPromptLibrary.SharedInstance.GetButtonTexture(key)); + private static Sprite GetButtonSprite(Texture2D texture) + { + var sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f), 100, 0, SpriteMeshType.FullRect, Vector4.zero, false); + sprite.name = texture.name; + return sprite; + } + // Modified from https://stackoverflow.com/a/69141085/9643841 public class AsyncImageLoader : MonoBehaviour { From e450a2b4593e6b25d9cb43bd3522a3cce1b81ab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dami=C3=A1n=20Garro?= Date: Fri, 9 Sep 2022 18:48:31 -0300 Subject: [PATCH 02/10] Fix dialog text not trimmed in translation table key --- NewHorizons/Builder/Props/DialogueBuilder.cs | 6 ++++-- NewHorizons/Handlers/TranslationHandler.cs | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/NewHorizons/Builder/Props/DialogueBuilder.cs b/NewHorizons/Builder/Props/DialogueBuilder.cs index f917c973..7d1beb0c 100644 --- a/NewHorizons/Builder/Props/DialogueBuilder.cs +++ b/NewHorizons/Builder/Props/DialogueBuilder.cs @@ -211,7 +211,8 @@ namespace NewHorizons.Builder.Props { XmlNode pageData = (XmlNode)Page; var text = pageData.InnerText; - TranslationHandler.AddDialogue(text, name); + // The text is trimmed in CharacterDialogueTree.LoadXml, so we also need to trim it for the key + TranslationHandler.AddDialogue(text, true, name); } xmlText = xmlNode2.SelectNodes("DialogueOptionsList/DialogueOption/Text"); @@ -219,7 +220,8 @@ namespace NewHorizons.Builder.Props { XmlNode pageData = (XmlNode)Page; var text = pageData.InnerText; - TranslationHandler.AddDialogue(text, characterName, name); + // The text is trimmed in DialogueText constructor (_listTextBlocks), so we also need to trim it for the key + TranslationHandler.AddDialogue(text, true, characterName, name); } } } diff --git a/NewHorizons/Handlers/TranslationHandler.cs b/NewHorizons/Handlers/TranslationHandler.cs index 03910e2b..38c6e76e 100644 --- a/NewHorizons/Handlers/TranslationHandler.cs +++ b/NewHorizons/Handlers/TranslationHandler.cs @@ -100,9 +100,9 @@ namespace NewHorizons.Handlers } } - public static void AddDialogue(string rawText, params string[] rawPreText) + public static void AddDialogue(string rawText, bool trimRawTextForKey = false, params string[] rawPreText) { - var key = string.Join(string.Empty, rawPreText) + rawText; + var key = string.Join(string.Empty, rawPreText) + (trimRawTextForKey? rawText.Trim() : rawText); var text = GetTranslation(rawText, TextType.DIALOGUE); From 79b842cc24ea2c8c52a234c0d92e6a112a51d1a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dami=C3=A1n=20Garro?= Date: Fri, 9 Sep 2022 18:53:28 -0300 Subject: [PATCH 03/10] Swap comments --- NewHorizons/Builder/Props/DialogueBuilder.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NewHorizons/Builder/Props/DialogueBuilder.cs b/NewHorizons/Builder/Props/DialogueBuilder.cs index 7d1beb0c..74918287 100644 --- a/NewHorizons/Builder/Props/DialogueBuilder.cs +++ b/NewHorizons/Builder/Props/DialogueBuilder.cs @@ -211,7 +211,7 @@ namespace NewHorizons.Builder.Props { XmlNode pageData = (XmlNode)Page; var text = pageData.InnerText; - // The text is trimmed in CharacterDialogueTree.LoadXml, so we also need to trim it for the key + // The text is trimmed in DialogueText constructor (_listTextBlocks), so we also need to trim it for the key TranslationHandler.AddDialogue(text, true, name); } @@ -220,7 +220,7 @@ namespace NewHorizons.Builder.Props { XmlNode pageData = (XmlNode)Page; var text = pageData.InnerText; - // The text is trimmed in DialogueText constructor (_listTextBlocks), so we also need to trim it for the key + // The text is trimmed in CharacterDialogueTree.LoadXml, so we also need to trim it for the key TranslationHandler.AddDialogue(text, true, characterName, name); } } From 867c180ae99ffba471e5235469a84d369ff379cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dami=C3=A1n=20Garro?= Date: Fri, 9 Sep 2022 18:55:21 -0300 Subject: [PATCH 04/10] Rename variables --- NewHorizons/Builder/Props/DialogueBuilder.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/NewHorizons/Builder/Props/DialogueBuilder.cs b/NewHorizons/Builder/Props/DialogueBuilder.cs index 74918287..39712108 100644 --- a/NewHorizons/Builder/Props/DialogueBuilder.cs +++ b/NewHorizons/Builder/Props/DialogueBuilder.cs @@ -207,19 +207,19 @@ namespace NewHorizons.Builder.Props var name = xmlNode2.SelectSingleNode("Name").InnerText; XmlNodeList xmlText = xmlNode2.SelectNodes("Dialogue/Page"); - foreach (object Page in xmlText) + foreach (object page in xmlText) { - XmlNode pageData = (XmlNode)Page; + XmlNode pageData = (XmlNode)page; var text = pageData.InnerText; // The text is trimmed in DialogueText constructor (_listTextBlocks), so we also need to trim it for the key TranslationHandler.AddDialogue(text, true, name); } xmlText = xmlNode2.SelectNodes("DialogueOptionsList/DialogueOption/Text"); - foreach (object Page in xmlText) + foreach (object option in xmlText) { - XmlNode pageData = (XmlNode)Page; - var text = pageData.InnerText; + XmlNode optionData = (XmlNode)option; + var text = optionData.InnerText; // The text is trimmed in CharacterDialogueTree.LoadXml, so we also need to trim it for the key TranslationHandler.AddDialogue(text, true, characterName, name); } From 44cf3d3fdcf5e150e563057afb064c789e3780c9 Mon Sep 17 00:00:00 2001 From: Nick Date: Sat, 10 Sep 2022 10:07:26 -0400 Subject: [PATCH 05/10] Remove parentheses --- NewHorizons/Patches/CharacterDialogueTreePatches.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NewHorizons/Patches/CharacterDialogueTreePatches.cs b/NewHorizons/Patches/CharacterDialogueTreePatches.cs index 6493eba1..20bcaa3a 100644 --- a/NewHorizons/Patches/CharacterDialogueTreePatches.cs +++ b/NewHorizons/Patches/CharacterDialogueTreePatches.cs @@ -9,13 +9,13 @@ internal class CharacterDialogueTreePatches [HarmonyPatch(typeof(CharacterDialogueTree), nameof(CharacterDialogueTree.Awake))] private static void CharacterDialogueTree_Awake(CharacterDialogueTree __instance) { - GlobalMessenger.AddListener("AttachPlayerToPoint", (_) => __instance.EndConversation()); + GlobalMessenger.AddListener("AttachPlayerToPoint", _ => __instance.EndConversation()); } [HarmonyPrefix] [HarmonyPatch(typeof(CharacterDialogueTree), nameof(CharacterDialogueTree.OnDestroy))] private static void CharacterDialogueTree_OnDestroy(CharacterDialogueTree __instance) { - GlobalMessenger.RemoveListener("AttachPlayerToPoint", (_) => __instance.EndConversation()); + GlobalMessenger.RemoveListener("AttachPlayerToPoint", _ => __instance.EndConversation()); } } From eb3dd9a827f375d68ca63809db68a227e4be1ac8 Mon Sep 17 00:00:00 2001 From: Ben C Date: Sat, 10 Sep 2022 10:51:54 -0400 Subject: [PATCH 06/10] Update faq.jinja2 --- docs/content/pages/faq.jinja2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/content/pages/faq.jinja2 b/docs/content/pages/faq.jinja2 index c5b95209..717f0d4a 100644 --- a/docs/content/pages/faq.jinja2 +++ b/docs/content/pages/faq.jinja2 @@ -46,14 +46,14 @@ faq( "ui-program", "Will you make a UI program to generate json files in the future?", - "Maybe! Will have to wait until New Horizons gets to version 1.0.0." + "Yes! It's available [on GitHub](https://github.com/Outer-Wilds-New-Horizons/nh-config-editor){ target='_blank' }." ) }} {{ faq( "when-version-1", "When will New Horizons get to version 1.0.0.", - "Soon/eventually/never/yesterday." + "It already did **BOZO**!!!!!" ) }} {{ From 5ab727384b59f2336283b1093f011d4ce3d2824a Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Sat, 10 Sep 2022 12:11:29 -0400 Subject: [PATCH 07/10] Allow more than one ring --- NewHorizons/Builder/Body/ProxyBuilder.cs | 9 ++++++--- NewHorizons/Builder/Body/RingBuilder.cs | 2 +- NewHorizons/External/Configs/PlanetConfig.cs | 8 ++++++-- NewHorizons/External/Modules/RingModule.cs | 5 +++++ NewHorizons/Handlers/PlanetCreationHandler.cs | 7 +++++-- NewHorizons/Handlers/TitleSceneHandler.cs | 15 +++++++++------ 6 files changed, 32 insertions(+), 14 deletions(-) diff --git a/NewHorizons/Builder/Body/ProxyBuilder.cs b/NewHorizons/Builder/Body/ProxyBuilder.cs index 32f7d355..89820072 100644 --- a/NewHorizons/Builder/Body/ProxyBuilder.cs +++ b/NewHorizons/Builder/Body/ProxyBuilder.cs @@ -120,10 +120,13 @@ namespace NewHorizons.Builder.Body } } - if (body.Config.Ring != null) + if (body.Config.Rings != null) { - RingBuilder.MakeRingGraphics(proxy, null, body.Config.Ring, body.Mod); - if (realSize < body.Config.Ring.outerRadius) realSize = body.Config.Ring.outerRadius; + foreach (var ring in body.Config.Rings) + { + RingBuilder.MakeRingGraphics(proxy, null, ring, body.Mod); + if (realSize < ring.outerRadius) realSize = ring.outerRadius; + } } Renderer starAtmosphere = null; diff --git a/NewHorizons/Builder/Body/RingBuilder.cs b/NewHorizons/Builder/Body/RingBuilder.cs index 9d2e6b05..a0918a56 100644 --- a/NewHorizons/Builder/Body/RingBuilder.cs +++ b/NewHorizons/Builder/Body/RingBuilder.cs @@ -73,7 +73,7 @@ namespace NewHorizons.Builder.Body return null; } - var ringGO = new GameObject("Ring"); + var ringGO = new GameObject(!string.IsNullOrEmpty(ring.rename) ? ring.rename : "Ring"); ringGO.transform.parent = sector?.transform ?? rootObject.transform; ringGO.transform.position = rootObject.transform.position; ringGO.transform.rotation = rootObject.transform.rotation; diff --git a/NewHorizons/External/Configs/PlanetConfig.cs b/NewHorizons/External/Configs/PlanetConfig.cs index 4ea8a886..d429d405 100644 --- a/NewHorizons/External/Configs/PlanetConfig.cs +++ b/NewHorizons/External/Configs/PlanetConfig.cs @@ -67,6 +67,10 @@ namespace NewHorizons.External.Configs [Obsolete("Signal is deprecated, please use Props->signals")] public SignalModule Signal; + + [Obsolete("Ring is deprecated, please use Rings")] + public RingModule Ring; + #endregion Obsolete /// @@ -135,9 +139,9 @@ namespace NewHorizons.External.Configs public string[] removeChildren; /// - /// Creates a ring around the planet + /// Create rings around the planet /// - public RingModule Ring; + public RingModule[] Rings; /// /// Add sand to this planet diff --git a/NewHorizons/External/Modules/RingModule.cs b/NewHorizons/External/Modules/RingModule.cs index 5f21a8a6..a5c93c4c 100644 --- a/NewHorizons/External/Modules/RingModule.cs +++ b/NewHorizons/External/Modules/RingModule.cs @@ -62,5 +62,10 @@ namespace NewHorizons.External.Modules /// Fade rings in/out over time. Optional. Value between 0-1, time is in minutes. /// public TimeValuePair[] opacityCurve; + + /// + /// An optional rename of this object + /// + public string rename; } } \ No newline at end of file diff --git a/NewHorizons/Handlers/PlanetCreationHandler.cs b/NewHorizons/Handlers/PlanetCreationHandler.cs index ec75a23c..4e4bab9b 100644 --- a/NewHorizons/Handlers/PlanetCreationHandler.cs +++ b/NewHorizons/Handlers/PlanetCreationHandler.cs @@ -547,9 +547,12 @@ namespace NewHorizons.Handlers } } - if (body.Config.Ring != null) + if (body.Config.Rings != null) { - RingBuilder.Make(go, sector, body.Config.Ring, body.Mod); + foreach (var ring in body.Config.Rings) + { + RingBuilder.Make(go, sector, ring, body.Mod); + } } if (body.Config.AsteroidBelt != null) diff --git a/NewHorizons/Handlers/TitleSceneHandler.cs b/NewHorizons/Handlers/TitleSceneHandler.cs index ea435305..9faee29c 100644 --- a/NewHorizons/Handlers/TitleSceneHandler.cs +++ b/NewHorizons/Handlers/TitleSceneHandler.cs @@ -107,13 +107,16 @@ namespace NewHorizons.Handlers } pivot.name = "Pivot"; - if (body.Config.Ring != null) + if (body.Config.Rings != null && body.Config.Rings.Length > 0) { - RingModule newRing = new RingModule(); - newRing.innerRadius = size * 1.2f; - newRing.outerRadius = size * 2f; - newRing.texture = body.Config.Ring.texture; - var ring = RingBuilder.Make(titleScreenGO, null, newRing, body.Mod); + foreach (var ring in body.Config.Rings) + { + RingModule newRing = new RingModule(); + newRing.innerRadius = size * 1.2f; + newRing.outerRadius = size * 2f; + newRing.texture = ring.texture; + RingBuilder.Make(titleScreenGO, null, newRing, body.Mod); + } titleScreenGO.transform.localScale = Vector3.one * 0.8f; } From a4dc54712a754d6ae92596e8afc692bcd6458f16 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 10 Sep 2022 16:13:41 +0000 Subject: [PATCH 08/10] Updated Schemas --- NewHorizons/Schemas/body_schema.json | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/NewHorizons/Schemas/body_schema.json b/NewHorizons/Schemas/body_schema.json index 9a5b05f9..5d000e07 100644 --- a/NewHorizons/Schemas/body_schema.json +++ b/NewHorizons/Schemas/body_schema.json @@ -100,9 +100,12 @@ "type": "string" } }, - "Ring": { - "description": "Creates a ring around the planet", - "$ref": "#/definitions/RingModule" + "Rings": { + "type": "array", + "description": "Create rings around the planet", + "items": { + "$ref": "#/definitions/RingModule" + } }, "Sand": { "description": "Add sand to this planet", @@ -2062,6 +2065,10 @@ "items": { "$ref": "#/definitions/TimeValuePair" } + }, + "rename": { + "type": "string", + "description": "An optional rename of this object" } } }, From 8705bd54b641be7994d03255ddeb208db3b9eabd Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Sat, 10 Sep 2022 12:15:21 -0400 Subject: [PATCH 09/10] Migrate --- NewHorizons/External/Configs/PlanetConfig.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/NewHorizons/External/Configs/PlanetConfig.cs b/NewHorizons/External/Configs/PlanetConfig.cs index d429d405..55c59231 100644 --- a/NewHorizons/External/Configs/PlanetConfig.cs +++ b/NewHorizons/External/Configs/PlanetConfig.cs @@ -405,10 +405,20 @@ namespace NewHorizons.External.Configs if (!string.IsNullOrEmpty(Cloak.audioFilePath)) Cloak.audio = Cloak.audioFilePath; } - // Rings are no longer variable size module + // Ring is now a list so you can have many per planet if (Ring != null) { - if (Ring.curve != null) Ring.scaleCurve = Ring.curve; + if (Rings == null) Rings = new RingModule[0]; + Rings = Rings.Append(Ring).ToArray(); + } + + // Rings are no longer variable size module + if (Rings != null) + { + foreach (var ring in Rings) + { + if (ring.curve != null) ring.scaleCurve = ring.curve; + } } } } From 53e8b281a0f21aee8fb36e6c77554f571cbae93f Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Sat, 10 Sep 2022 13:24:33 -0400 Subject: [PATCH 10/10] Me when --- NewHorizons/Patches/CharacterDialogueTreePatches.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/NewHorizons/Patches/CharacterDialogueTreePatches.cs b/NewHorizons/Patches/CharacterDialogueTreePatches.cs index 20bcaa3a..2d4a8831 100644 --- a/NewHorizons/Patches/CharacterDialogueTreePatches.cs +++ b/NewHorizons/Patches/CharacterDialogueTreePatches.cs @@ -3,19 +3,24 @@ using HarmonyLib; namespace NewHorizons.Patches; [HarmonyPatch] -internal class CharacterDialogueTreePatches +internal static class CharacterDialogueTreePatches { [HarmonyPrefix] [HarmonyPatch(typeof(CharacterDialogueTree), nameof(CharacterDialogueTree.Awake))] private static void CharacterDialogueTree_Awake(CharacterDialogueTree __instance) { - GlobalMessenger.AddListener("AttachPlayerToPoint", _ => __instance.EndConversation()); + GlobalMessenger.AddListener("AttachPlayerToPoint", __instance.OnAttachPlayerToPoint); } [HarmonyPrefix] [HarmonyPatch(typeof(CharacterDialogueTree), nameof(CharacterDialogueTree.OnDestroy))] private static void CharacterDialogueTree_OnDestroy(CharacterDialogueTree __instance) { - GlobalMessenger.RemoveListener("AttachPlayerToPoint", _ => __instance.EndConversation()); + GlobalMessenger.RemoveListener("AttachPlayerToPoint", __instance.OnAttachPlayerToPoint); + } + + private static void OnAttachPlayerToPoint(this CharacterDialogueTree characterDialogueTree, OWRigidbody rigidbody) + { + characterDialogueTree.EndConversation(); } }