Fix Stranger cloak breaking

This commit is contained in:
Nick 2023-07-26 23:59:23 -04:00
parent 0e06df1586
commit 3b40fac5a4

View File

@ -1,6 +1,7 @@
using NewHorizons.Components.Stars; using NewHorizons.Components.Stars;
using NewHorizons.Handlers; using NewHorizons.Handlers;
using NewHorizons.Utility.OWML; using NewHorizons.Utility.OWML;
using System.Linq;
using UnityEngine; using UnityEngine;
namespace NewHorizons.Components.EOTE namespace NewHorizons.Components.EOTE
@ -11,6 +12,8 @@ namespace NewHorizons.Components.EOTE
private CloakFieldController _currentController; private CloakFieldController _currentController;
public void Start() public void Start()
{
if (CloakHandler.Cloaks.Any())
{ {
// Enable and disable all cloaks, else Stranger state is weird at the start // Enable and disable all cloaks, else Stranger state is weird at the start
foreach (var cloak in CloakHandler.Cloaks) foreach (var cloak in CloakHandler.Cloaks)
@ -18,6 +21,10 @@ namespace NewHorizons.Components.EOTE
SetCurrentCloak(cloak); SetCurrentCloak(cloak);
cloak.enabled = false; cloak.enabled = false;
} }
// Make sure a cloak is enabled
SetCurrentCloak(CloakHandler.Cloaks.First());
}
} }
// Always makes sure the Locator's cloak field controller is the one that is between the player and the sun // Always makes sure the Locator's cloak field controller is the one that is between the player and the sun