Clean up supernova NRE, fix no-DLC related issues

This commit is contained in:
Nick 2023-10-18 02:13:17 -04:00
parent 467876f327
commit 58fca35df6
4 changed files with 28 additions and 11 deletions

View File

@ -184,7 +184,7 @@ namespace NewHorizons.Components.Props
{ {
float collapseProgress = SunController.GetCollapseProgress(); float collapseProgress = SunController.GetCollapseProgress();
if (_ambientLight != null) if (_ambientLight != null && _ambientLightOrigIntensity != null)
{ {
for (int i = 0; i < _ambientLight.Length; i++) for (int i = 0; i < _ambientLight.Length; i++)
{ {
@ -221,13 +221,16 @@ namespace NewHorizons.Components.Props
{ {
if (_shockLayer != null) _shockLayer.enabled = false; if (_shockLayer != null) _shockLayer.enabled = false;
if (_ambientLight != null) if (_ambientLight != null && _ambientLightOrigIntensity != null)
{ {
for (int i = 0; i < _ambientLight.Length; i++) for (int i = 0; i < _ambientLight.Length; i++)
{
if (_ambientLight[i] != null)
{ {
_ambientLight[i].intensity = _ambientLightOrigIntensity[i]; _ambientLight[i].intensity = _ambientLightOrigIntensity[i];
} }
} }
}
if (_fog != null) _fog.fogTint = _fogOrigTint; if (_fog != null) _fog.fogTint = _fogOrigTint;

View File

@ -1,12 +1,12 @@
using NewHorizons.Components;
using NewHorizons.Components.Stars; using NewHorizons.Components.Stars;
using NewHorizons.Utility; using NewHorizons.Utility;
using NewHorizons.Utility.OWML;
using NewHorizons.Utility.OuterWilds; using NewHorizons.Utility.OuterWilds;
using NewHorizons.Utility.OWML;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using UnityEngine; using UnityEngine;
using NewHorizons.Components;
namespace NewHorizons.Handlers namespace NewHorizons.Handlers
{ {
@ -40,7 +40,14 @@ namespace NewHorizons.Handlers
{ {
foreach (var gameObject in toDisable) foreach (var gameObject in toDisable)
{ {
gameObject.SetActive(false); // Somehow SetActive can NRE
// Seems to only happen if they don't have the DLC installed
// Even with the null check it's complaining so I don't understand at all
try
{
gameObject?.SetActive(false);
}
catch { }
} }
// Kill all non nh proxies // Kill all non nh proxies
foreach (var proxy in GameObject.FindObjectsOfType<ProxyBody>()) foreach (var proxy in GameObject.FindObjectsOfType<ProxyBody>())
@ -55,10 +62,14 @@ namespace NewHorizons.Handlers
if (Main.Instance.CurrentStarSystem != "EyeOfTheUniverse") if (Main.Instance.CurrentStarSystem != "EyeOfTheUniverse")
{ {
// Since we didn't call RemoveBody on the all planets there are some we have to call here // Since we didn't call RemoveBody on the all planets there are some we have to call here
StrangerRemoved();
TimberHearthRemoved(); TimberHearthRemoved();
GiantsDeepRemoved(); GiantsDeepRemoved();
SunRemoved(); SunRemoved();
if (Main.HasDLC)
{
StrangerRemoved();
}
} }
}, 2); // Have to wait or shit goes wild }, 2); // Have to wait or shit goes wild

View File

@ -350,9 +350,12 @@ namespace NewHorizons
GravityCannonBuilder.InitPrefab(); GravityCannonBuilder.InitPrefab();
ShuttleBuilder.InitPrefab(); ShuttleBuilder.InitPrefab();
if (HasDLC)
{
ProjectionBuilder.InitPrefabs(); ProjectionBuilder.InitPrefabs();
CloakBuilder.InitPrefab(); CloakBuilder.InitPrefab();
RaftBuilder.InitPrefab(); RaftBuilder.InitPrefab();
}
WarpPadBuilder.InitPrefabs(); WarpPadBuilder.InitPrefabs();
} }

View File

@ -4,7 +4,7 @@
"author": "xen, Bwc9876, clay, MegaPiggy, John, Trifid, Hawkbar, Book", "author": "xen, Bwc9876, clay, MegaPiggy, John, Trifid, Hawkbar, Book",
"name": "New Horizons", "name": "New Horizons",
"uniqueName": "xen.NewHorizons", "uniqueName": "xen.NewHorizons",
"version": "1.17.1", "version": "1.17.2",
"owmlVersion": "2.9.8", "owmlVersion": "2.9.8",
"dependencies": [ "JohnCorby.VanillaFix", "_nebula.MenuFramework", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ], "dependencies": [ "JohnCorby.VanillaFix", "_nebula.MenuFramework", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ],
"conflicts": [ "Raicuparta.QuantumSpaceBuddies", "PacificEngine.OW_CommonResources" ], "conflicts": [ "Raicuparta.QuantumSpaceBuddies", "PacificEngine.OW_CommonResources" ],