From 899e66e7ed6c497051e1a00084b84257c72c59e9 Mon Sep 17 00:00:00 2001 From: xen-42 Date: Sun, 16 Feb 2025 17:40:41 -0500 Subject: [PATCH] Comment what SimplifiedDetailInfo is and change title scene handler remove children to use findall --- NewHorizons/Builder/Body/ProxyBuilder.cs | 1 + NewHorizons/External/Modules/Props/DetailInfo.cs | 3 +++ NewHorizons/Handlers/TitleSceneHandler.cs | 7 +------ 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/NewHorizons/Builder/Body/ProxyBuilder.cs b/NewHorizons/Builder/Body/ProxyBuilder.cs index 3520008d..0b4cafc3 100644 --- a/NewHorizons/Builder/Body/ProxyBuilder.cs +++ b/NewHorizons/Builder/Body/ProxyBuilder.cs @@ -210,6 +210,7 @@ namespace NewHorizons.Builder.Body { foreach (var detailInfo in body.Config.Props.proxyDetails) { + // Thought about switching these to SimplifiedDetailInfo but we use AlignRadial with these so we can't DetailBuilder.Make(proxy, null, body.Mod, detailInfo); } } diff --git a/NewHorizons/External/Modules/Props/DetailInfo.cs b/NewHorizons/External/Modules/Props/DetailInfo.cs index 6662586d..f7399e2b 100644 --- a/NewHorizons/External/Modules/Props/DetailInfo.cs +++ b/NewHorizons/External/Modules/Props/DetailInfo.cs @@ -6,6 +6,9 @@ using System.ComponentModel; namespace NewHorizons.External.Modules.Props { + /// + /// A lesser form of DetailInfo used for the title screen since that supports fewer features + /// [JsonObject] public class SimplifiedDetailInfo : GeneralPropInfo { diff --git a/NewHorizons/Handlers/TitleSceneHandler.cs b/NewHorizons/Handlers/TitleSceneHandler.cs index 65031fb0..66799f7d 100644 --- a/NewHorizons/Handlers/TitleSceneHandler.cs +++ b/NewHorizons/Handlers/TitleSceneHandler.cs @@ -202,15 +202,10 @@ namespace NewHorizons.Handlers private static void RemoveChildren(GameObject go, string[] paths) { - var goPath = go.transform.GetPath(); - var transforms = go.GetComponentsInChildren(true); foreach (var childPath in paths) { - // Multiple children can have the same path so we delete all that match - var path = $"{goPath}/{childPath}"; - var flag = true; - foreach (var childObj in transforms.Where(x => x.GetPath() == path)) + foreach (var childObj in go.transform.FindAll(childPath)) { flag = false; // idk why we wait here but we do