mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Try catch detail fixes
This commit is contained in:
parent
ac188d0946
commit
6f68750117
@ -115,6 +115,9 @@ namespace NewHorizons.Builder.Props
|
||||
var existingSectors = new HashSet<Sector>(prop.GetComponentsInChildren<Sector>(true));
|
||||
|
||||
foreach (var component in prop.GetComponentsInChildren<Component>(true))
|
||||
{
|
||||
// Rather than having the entire prop not exist when a detail fails let's just try-catch and log an error
|
||||
try
|
||||
{
|
||||
// Components can come through as null here (yes, really),
|
||||
// Usually if a script was added to a prefab in an asset bundle but isn't present in the loaded mod DLLs
|
||||
@ -136,6 +139,11 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
FixComponent(component, go, detail.ignoreSun);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
NHLogger.LogError($"Failed to correct component {component?.GetType()?.Name} on {go?.name} - {e}");
|
||||
}
|
||||
}
|
||||
|
||||
if (detail.path != null)
|
||||
{
|
||||
@ -155,7 +163,7 @@ namespace NewHorizons.Builder.Props
|
||||
}
|
||||
}
|
||||
|
||||
// Items shouldn't use these else they get weird
|
||||
// Items should always be kept loaded else they will vanish in your hand as you leave the sector
|
||||
if (isItem) detail.keepLoaded = true;
|
||||
|
||||
prop.transform.localScale = detail.stretch ?? (detail.scale != 0 ? Vector3.one * detail.scale : prefab.transform.localScale);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user