test both remove children methods

This commit is contained in:
JohnCorby 2025-02-14 21:15:53 -08:00
parent 2543d8b94d
commit 0fa7cfe2c5
2 changed files with 24 additions and 14 deletions

View File

@ -1,3 +1,4 @@
using HarmonyLib;
using NewHorizons.Builder.General;
using NewHorizons.Components;
using NewHorizons.Components.Orbital;
@ -228,12 +229,16 @@ namespace NewHorizons.Builder.Props
var path = $"{detailPath}/{childPath}";
var flag = true;
foreach (var childObj in transforms.Where(x => x.GetPath() == path))
var childObjs = transforms.Where(x => x.GetPath() == path).ToList();
var childObjs2 = go.transform.FindAll(childPath);
foreach (var childObj in childObjs)
{
flag = false;
childObj.gameObject.SetActive(false);
}
Main.Instance.ModHelper.Console.WriteLine($"remove children detail\n{prop.transform.GetPath()}\n{childPath}\n\n{childObjs.Join()}\n{childObjs2.Join()}");
if (flag) NHLogger.LogWarning($"Couldn't find \"{childPath}\".");
}
}

View File

@ -1,3 +1,4 @@
using HarmonyLib;
using NewHorizons.Builder.Atmosphere;
using NewHorizons.Builder.Body;
using NewHorizons.Builder.General;
@ -1008,7 +1009,9 @@ namespace NewHorizons.Handlers
var path = $"{goPath}/{childPath}";
var flag = true;
foreach (var childObj in transforms.Where(x => x.GetPath() == path))
var childObjs = transforms.Where(x => x.GetPath() == path).ToList();
var childObjs2 = go.transform.FindAll(childPath);
foreach (var childObj in childObjs)
{
flag = false;
// idk why we wait here but we do
@ -1021,6 +1024,8 @@ namespace NewHorizons.Handlers
}, 2);
}
Main.Instance.ModHelper.Console.WriteLine($"remove children planet\n{go.transform.GetPath()}\n{childPath}\n\n{childObjs.Join()}\n{childObjs2.Join()}");
if (flag) NHLogger.LogWarning($"Couldn't find \"{childPath}\".");
}
}