mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Maybe fix warp bug
This commit is contained in:
parent
eff7679c78
commit
fe4f7f5919
@ -85,6 +85,8 @@ namespace NewHorizons.Builder.General
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
if (ao.GetAstroObjectName() == AstroObject.Name.CaveTwin || ao.GetAstroObjectName() == AstroObject.Name.TowerTwin)
|
if (ao.GetAstroObjectName() == AstroObject.Name.CaveTwin || ao.GetAstroObjectName() == AstroObject.Name.TowerTwin)
|
||||||
{
|
{
|
||||||
if (ao.GetAstroObjectName() == AstroObject.Name.TowerTwin)
|
if (ao.GetAstroObjectName() == AstroObject.Name.TowerTwin)
|
||||||
@ -97,7 +99,7 @@ namespace NewHorizons.Builder.General
|
|||||||
var msb = GameObject.Find("MapSatellite_Body");
|
var msb = GameObject.Find("MapSatellite_Body");
|
||||||
if (msb != null) msb.SetActive(false);
|
if (msb != null) msb.SetActive(false);
|
||||||
}
|
}
|
||||||
else if(ao.GetAstroObjectName() == AstroObject.Name.ProbeCannon)
|
else if (ao.GetAstroObjectName() == AstroObject.Name.ProbeCannon)
|
||||||
{
|
{
|
||||||
GameObject.Find("NomaiProbe_Body").SetActive(false);
|
GameObject.Find("NomaiProbe_Body").SetActive(false);
|
||||||
GameObject.Find("CannonMuzzle_Body").SetActive(false);
|
GameObject.Find("CannonMuzzle_Body").SetActive(false);
|
||||||
@ -106,11 +108,11 @@ namespace NewHorizons.Builder.General
|
|||||||
GameObject.Find("FakeCannonBarrel_Body (1)").SetActive(false);
|
GameObject.Find("FakeCannonBarrel_Body (1)").SetActive(false);
|
||||||
GameObject.Find("Debris_Body (1)").SetActive(false);
|
GameObject.Find("Debris_Body (1)").SetActive(false);
|
||||||
}
|
}
|
||||||
else if(ao.GetAstroObjectName() == AstroObject.Name.SunStation)
|
else if (ao.GetAstroObjectName() == AstroObject.Name.SunStation)
|
||||||
{
|
{
|
||||||
GameObject.Find("SS_Debris_Body").SetActive(false);
|
GameObject.Find("SS_Debris_Body").SetActive(false);
|
||||||
}
|
}
|
||||||
else if(ao.GetAstroObjectName() == AstroObject.Name.GiantsDeep)
|
else if (ao.GetAstroObjectName() == AstroObject.Name.GiantsDeep)
|
||||||
{
|
{
|
||||||
GameObject.Find("BrambleIsland_Body").SetActive(false);
|
GameObject.Find("BrambleIsland_Body").SetActive(false);
|
||||||
GameObject.Find("GabbroIsland_Body").SetActive(false);
|
GameObject.Find("GabbroIsland_Body").SetActive(false);
|
||||||
@ -118,21 +120,21 @@ namespace NewHorizons.Builder.General
|
|||||||
GameObject.Find("StatueIsland_Body").SetActive(false);
|
GameObject.Find("StatueIsland_Body").SetActive(false);
|
||||||
GameObject.Find("ConstructionYardIsland_Body").SetActive(false);
|
GameObject.Find("ConstructionYardIsland_Body").SetActive(false);
|
||||||
GameObject.Find("GabbroShip_Body").SetActive(false);
|
GameObject.Find("GabbroShip_Body").SetActive(false);
|
||||||
foreach(var jelly in GameObject.FindObjectsOfType<JellyfishController>())
|
foreach (var jelly in GameObject.FindObjectsOfType<JellyfishController>())
|
||||||
{
|
{
|
||||||
jelly.gameObject.SetActive(false);
|
jelly.gameObject.SetActive(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(ao.GetAstroObjectName() == AstroObject.Name.WhiteHole)
|
else if (ao.GetAstroObjectName() == AstroObject.Name.WhiteHole)
|
||||||
{
|
{
|
||||||
GameObject.Find("WhiteholeStation_Body").SetActive(false);
|
GameObject.Find("WhiteholeStation_Body").SetActive(false);
|
||||||
GameObject.Find("WhiteholeStationSuperstructure_Body").SetActive(false);
|
GameObject.Find("WhiteholeStationSuperstructure_Body").SetActive(false);
|
||||||
}
|
}
|
||||||
else if(ao.GetAstroObjectName() == AstroObject.Name.TimberHearth)
|
else if (ao.GetAstroObjectName() == AstroObject.Name.TimberHearth)
|
||||||
{
|
{
|
||||||
GameObject.Find("MiningRig_Body").SetActive(false);
|
GameObject.Find("MiningRig_Body").SetActive(false);
|
||||||
|
|
||||||
foreach(var obj in GameObject.FindObjectsOfType<DayNightTracker>())
|
foreach (var obj in GameObject.FindObjectsOfType<DayNightTracker>())
|
||||||
{
|
{
|
||||||
GameObject.Destroy(obj);
|
GameObject.Destroy(obj);
|
||||||
}
|
}
|
||||||
@ -141,7 +143,7 @@ namespace NewHorizons.Builder.General
|
|||||||
GameObject.Destroy(obj);
|
GameObject.Destroy(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(ao.GetAstroObjectName() == AstroObject.Name.Sun)
|
else if (ao.GetAstroObjectName() == AstroObject.Name.Sun)
|
||||||
{
|
{
|
||||||
var starController = ao.gameObject.GetComponent<StarController>();
|
var starController = ao.gameObject.GetComponent<StarController>();
|
||||||
StarLightController.RemoveStar(starController);
|
StarLightController.RemoveStar(starController);
|
||||||
@ -150,7 +152,7 @@ namespace NewHorizons.Builder.General
|
|||||||
var audio = ao.GetComponentInChildren<SunSurfaceAudioController>();
|
var audio = ao.GetComponentInChildren<SunSurfaceAudioController>();
|
||||||
GameObject.Destroy(audio);
|
GameObject.Destroy(audio);
|
||||||
|
|
||||||
foreach(var owAudioSource in ao.GetComponentsInChildren<OWAudioSource>())
|
foreach (var owAudioSource in ao.GetComponentsInChildren<OWAudioSource>())
|
||||||
{
|
{
|
||||||
owAudioSource.Stop();
|
owAudioSource.Stop();
|
||||||
GameObject.Destroy(owAudioSource);
|
GameObject.Destroy(owAudioSource);
|
||||||
@ -162,17 +164,22 @@ namespace NewHorizons.Builder.General
|
|||||||
GameObject.Destroy(audioSource);
|
GameObject.Destroy(audioSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(var sunProxy in GameObject.FindObjectsOfType<SunProxy>())
|
foreach (var sunProxy in GameObject.FindObjectsOfType<SunProxy>())
|
||||||
{
|
{
|
||||||
Logger.Log($"Destroying SunProxy {sunProxy.gameObject.name}");
|
Logger.Log($"Destroying SunProxy {sunProxy.gameObject.name}");
|
||||||
GameObject.Destroy(sunProxy.gameObject);
|
GameObject.Destroy(sunProxy.gameObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(ao.GetAstroObjectName() == AstroObject.Name.DreamWorld)
|
else if (ao.GetAstroObjectName() == AstroObject.Name.DreamWorld)
|
||||||
{
|
{
|
||||||
GameObject.Find("BackRaft_Body").SetActive(false);
|
GameObject.Find("BackRaft_Body").SetActive(false);
|
||||||
GameObject.Find("SealRaft_Body").SetActive(false);
|
GameObject.Find("SealRaft_Body").SetActive(false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
Logger.LogWarning($"Exception thrown when trying to delete bodies related to [{ao.name}]: {e.Message}, {e.StackTrace}");
|
||||||
|
}
|
||||||
|
|
||||||
// Deal with proxies
|
// Deal with proxies
|
||||||
foreach (var p in GameObject.FindObjectsOfType<ProxyOrbiter>())
|
foreach (var p in GameObject.FindObjectsOfType<ProxyOrbiter>())
|
||||||
@ -185,7 +192,8 @@ namespace NewHorizons.Builder.General
|
|||||||
}
|
}
|
||||||
RemoveProxy(ao.name.Replace("_Body", ""));
|
RemoveProxy(ao.name.Replace("_Body", ""));
|
||||||
|
|
||||||
ao.transform.root.gameObject.SetActive(false);
|
// For TH we wait until the player is fully loaded in
|
||||||
|
Main.Instance.ModHelper.Events.Unity.RunWhen(() => Main.IsSystemReady, () => ao.transform.root.gameObject.SetActive(false));
|
||||||
|
|
||||||
foreach (ProxyBody proxy in GameObject.FindObjectsOfType<ProxyBody>())
|
foreach (ProxyBody proxy in GameObject.FindObjectsOfType<ProxyBody>())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -60,7 +60,7 @@ namespace NewHorizons.Builder.General
|
|||||||
if(!Main.Instance.IsWarping && module.StartWithSuit && !suitUpQueued)
|
if(!Main.Instance.IsWarping && module.StartWithSuit && !suitUpQueued)
|
||||||
{
|
{
|
||||||
suitUpQueued = true;
|
suitUpQueued = true;
|
||||||
Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => SuitUp(), 4);
|
Main.Instance.ModHelper.Events.Unity.RunWhen(() => Main.IsSystemReady, () => SuitUp());
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Log("Made spawnpoint on [" + body.name + "]");
|
Logger.Log("Made spawnpoint on [" + body.name + "]");
|
||||||
|
|||||||
@ -81,7 +81,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
if(component is AnglerfishAnimController && component.GetComponentInParent<AnglerfishController>() == null)
|
if(component is AnglerfishAnimController && component.GetComponentInParent<AnglerfishController>() == null)
|
||||||
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => (component as AnglerfishAnimController).enabled = false);
|
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => (component as AnglerfishAnimController).enabled = false);
|
||||||
|
|
||||||
if (component is Animator) Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => (component as Animator).enabled = true, 5);
|
if (component is Animator) Main.Instance.ModHelper.Events.Unity.RunWhen(() => Main.IsSystemReady, () => (component as Animator).enabled = true);
|
||||||
if (component is Collider) Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => (component as Collider).enabled = true);
|
if (component is Collider) Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => (component as Collider).enabled = true);
|
||||||
|
|
||||||
if(component is Shape) Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => (component as Shape).enabled = true);
|
if(component is Shape) Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => (component as Shape).enabled = true);
|
||||||
|
|||||||
@ -43,6 +43,7 @@ namespace NewHorizons
|
|||||||
public static Dictionary<string, AssetBundle> AssetBundles = new Dictionary<string, AssetBundle>();
|
public static Dictionary<string, AssetBundle> AssetBundles = new Dictionary<string, AssetBundle>();
|
||||||
public static List<IModBehaviour> MountedAddons = new List<IModBehaviour>();
|
public static List<IModBehaviour> MountedAddons = new List<IModBehaviour>();
|
||||||
|
|
||||||
|
public static bool IsSystemReady { get; private set; }
|
||||||
public static float FurthestOrbit { get; set; } = 50000f;
|
public static float FurthestOrbit { get; set; } = 50000f;
|
||||||
|
|
||||||
public string CurrentStarSystem { get { return Instance._currentStarSystem; } }
|
public string CurrentStarSystem { get { return Instance._currentStarSystem; } }
|
||||||
@ -91,6 +92,7 @@ namespace NewHorizons
|
|||||||
SceneManager.sceneLoaded += OnSceneLoaded;
|
SceneManager.sceneLoaded += OnSceneLoaded;
|
||||||
Instance = this;
|
Instance = this;
|
||||||
GlobalMessenger<DeathType>.AddListener("PlayerDeath", OnDeath);
|
GlobalMessenger<DeathType>.AddListener("PlayerDeath", OnDeath);
|
||||||
|
GlobalMessenger.AddListener("WakeUp", new Callback(OnWakeUp));
|
||||||
ShaderBundle = Main.Instance.ModHelper.Assets.LoadBundle("AssetBundle/shader");
|
ShaderBundle = Main.Instance.ModHelper.Assets.LoadBundle("AssetBundle/shader");
|
||||||
BodyDict["SolarSystem"] = new List<NewHorizonsBody>();
|
BodyDict["SolarSystem"] = new List<NewHorizonsBody>();
|
||||||
SystemDict["SolarSystem"] = new NewHorizonsSystem("SolarSystem", new StarSystemConfig(null), this);
|
SystemDict["SolarSystem"] = new NewHorizonsSystem("SolarSystem", new StarSystemConfig(null), this);
|
||||||
@ -170,6 +172,12 @@ namespace NewHorizons
|
|||||||
Logger.Log($"Destroying NewHorizons");
|
Logger.Log($"Destroying NewHorizons");
|
||||||
SceneManager.sceneLoaded -= OnSceneLoaded;
|
SceneManager.sceneLoaded -= OnSceneLoaded;
|
||||||
GlobalMessenger<DeathType>.RemoveListener("PlayerDeath", OnDeath);
|
GlobalMessenger<DeathType>.RemoveListener("PlayerDeath", OnDeath);
|
||||||
|
GlobalMessenger.RemoveListener("WakeUp", new Callback(OnWakeUp));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void OnWakeUp()
|
||||||
|
{
|
||||||
|
IsSystemReady = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
||||||
@ -185,6 +193,8 @@ namespace NewHorizons
|
|||||||
|
|
||||||
if(scene.name == "SolarSystem")
|
if(scene.name == "SolarSystem")
|
||||||
{
|
{
|
||||||
|
IsSystemReady = false;
|
||||||
|
|
||||||
HeavenlyBodyBuilder.Reset();
|
HeavenlyBodyBuilder.Reset();
|
||||||
NewHorizonsData.Load();
|
NewHorizonsData.Load();
|
||||||
SignalBuilder.Init();
|
SignalBuilder.Init();
|
||||||
@ -203,8 +213,8 @@ namespace NewHorizons
|
|||||||
if (HasWarpDrive == true) EnableWarpDrive();
|
if (HasWarpDrive == true) EnableWarpDrive();
|
||||||
|
|
||||||
Logger.Log($"Is the player warping in? {IsWarping}");
|
Logger.Log($"Is the player warping in? {IsWarping}");
|
||||||
if (IsWarping && _shipWarpController) Instance.ModHelper.Events.Unity.FireInNUpdates(() => _shipWarpController.WarpIn(WearingSuit), 5);
|
if (IsWarping && _shipWarpController) Instance.ModHelper.Events.Unity.RunWhen(() => IsSystemReady, () => _shipWarpController.WarpIn(WearingSuit));
|
||||||
else Instance.ModHelper.Events.Unity.FireInNUpdates(() => GameObject.FindObjectOfType<PlayerSpawner>().DebugWarp(SystemDict[_currentStarSystem].SpawnPoint), 5);
|
else Instance.ModHelper.Events.Unity.RunWhen(() => IsSystemReady, () => FindObjectOfType<PlayerSpawner>().DebugWarp(SystemDict[_currentStarSystem].SpawnPoint));
|
||||||
IsWarping = false;
|
IsWarping = false;
|
||||||
|
|
||||||
var map = GameObject.FindObjectOfType<MapController>();
|
var map = GameObject.FindObjectOfType<MapController>();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user