Merge remote-tracking branch 'origin/fix-proxy-shadows' into fix-proxy-shadows

This commit is contained in:
JohnCorby 2023-08-07 19:24:25 -07:00
commit 3f3c75d6b8

View File

@ -81,6 +81,9 @@ namespace NewHorizons.Handlers
// force call update here to make it switch to an active star. idk why we didnt have to do this before // force call update here to make it switch to an active star. idk why we didnt have to do this before
SunLightEffectsController.Instance.Update(); SunLightEffectsController.Instance.Update();
// Since we didn't call RemoveBody on the Stranger have to call this here
StrangerRemoved();
}, 2); // Have to wait or shit goes wild }, 2); // Have to wait or shit goes wild
foreach (var streamingAssetBundle in StreamingManager.s_activeBundles) foreach (var streamingAssetBundle in StreamingManager.s_activeBundles)
@ -99,14 +102,23 @@ namespace NewHorizons.Handlers
} }
} }
public static void StrangerRemoved()
{
CloakHandler.FlagStrangerDisabled = true;
if (Locator._cloakFieldController?.GetComponentInParent<AstroObject>()?.GetAstroObjectName() == AstroObject.Name.RingWorld)
{
Locator._cloakFieldController = null;
}
}
public static void RemoveBody(AstroObject ao, bool delete = false, List<AstroObject> toDestroy = null) public static void RemoveBody(AstroObject ao, bool delete = false, List<AstroObject> toDestroy = null)
{ {
NHLogger.LogVerbose($"Removing [{ao.name}]"); NHLogger.LogVerbose($"Removing [{ao.name}]");
if (ao.GetAstroObjectName() == AstroObject.Name.RingWorld) if (ao.GetAstroObjectName() == AstroObject.Name.RingWorld)
{ {
CloakHandler.FlagStrangerDisabled = true; StrangerRemoved();
if (Locator._cloakFieldController?.GetComponentInParent<AstroObject>() == ao) Locator._cloakFieldController = null;
} }
if (ao.gameObject == null || !ao.gameObject.activeInHierarchy) if (ao.gameObject == null || !ao.gameObject.activeInHierarchy)