mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Fix NREs concerning sectors with proxy body details
This commit is contained in:
parent
cb020151dd
commit
f918e4bfc8
@ -84,7 +84,8 @@ namespace NewHorizons.Builder.Props
|
|||||||
{
|
{
|
||||||
if (prefab == null) return null;
|
if (prefab == null) return null;
|
||||||
|
|
||||||
GameObject prop = GameObject.Instantiate(prefab, sector.transform);
|
GameObject prop = prefab.InstantiateInactive();
|
||||||
|
prop.transform.parent = sector?.transform ?? planetGO.transform;
|
||||||
prop.SetActive(false);
|
prop.SetActive(false);
|
||||||
|
|
||||||
if (sector != null) sector.OnOccupantEnterSector += (SectorDetector sd) => OWAssetHandler.OnOccupantEnterSector(prop, sd, sector);
|
if (sector != null) sector.OnOccupantEnterSector += (SectorDetector sd) => OWAssetHandler.OnOccupantEnterSector(prop, sd, sector);
|
||||||
@ -147,9 +148,21 @@ namespace NewHorizons.Builder.Props
|
|||||||
(component as OWItemSocket)._sector = sector;
|
(component as OWItemSocket)._sector = sector;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Remove things that require sectors. Will just keep extending this as things pop up
|
||||||
|
|
||||||
|
if (component is FogLight || component is SectoredMonoBehaviour)
|
||||||
|
{
|
||||||
|
GameObject.DestroyImmediate(component);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Fix a bunch of stuff when done loading
|
// Fix a bunch of stuff when done loading
|
||||||
Main.Instance.ModHelper.Events.Unity.RunWhen(() => Main.IsSystemReady, () =>
|
Main.Instance.ModHelper.Events.Unity.RunWhen(() => Main.IsSystemReady, () =>
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (component is Animator) (component as Animator).enabled = true;
|
if (component is Animator) (component as Animator).enabled = true;
|
||||||
else if (component is Collider) (component as Collider).enabled = true;
|
else if (component is Collider) (component as Collider).enabled = true;
|
||||||
@ -171,6 +184,11 @@ namespace NewHorizons.Builder.Props
|
|||||||
angler.enabled = true;
|
angler.enabled = true;
|
||||||
angler.OnChangeAnglerState(AnglerfishController.AnglerState.Lurking);
|
angler.OnChangeAnglerState(AnglerfishController.AnglerState.Lurking);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
Logger.LogWarning($"Exception when modifying component [{component.GetType().Name}] on [{planetGO.name}] : {e.Message}, {e.StackTrace}");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user