mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2025-12-10 08:03:28 +08:00
crash fix
This commit is contained in:
@@ -167,11 +167,11 @@ public static class FactoryPatch
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_sail.enabled)
|
if (_sail && _sail.enabled)
|
||||||
{
|
{
|
||||||
_mechaOnEarth = false;
|
_mechaOnEarth = false;
|
||||||
Enabled = false;
|
Enabled = false;
|
||||||
if (_sunlight == null) return;
|
if (!_sunlight || !_sunlight.transform) return;
|
||||||
_sunlight.transform.localEulerAngles = new Vector3(0f, 180f);
|
_sunlight.transform.localEulerAngles = new Vector3(0f, 180f);
|
||||||
_sunlight = null;
|
_sunlight = null;
|
||||||
return;
|
return;
|
||||||
@@ -179,19 +179,19 @@ public static class FactoryPatch
|
|||||||
|
|
||||||
if (!_mechaOnEarth)
|
if (!_mechaOnEarth)
|
||||||
{
|
{
|
||||||
if (_sunlight == null)
|
if (!_sunlight)
|
||||||
{
|
{
|
||||||
var simu = GameMain.universeSimulator;
|
var simu = GameMain.universeSimulator;
|
||||||
if (simu)
|
if (simu)
|
||||||
_sunlight = simu.LocalStarSimulator()?.sunLight;
|
_sunlight = simu.LocalStarSimulator()?.sunLight;
|
||||||
if (_sunlight == null) return;
|
if (!_sunlight) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_mechaOnEarth = true;
|
_mechaOnEarth = true;
|
||||||
Enabled = NightLightEnabled.Value;
|
Enabled = NightLightEnabled.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Enabled)
|
if (Enabled && _sunlight)
|
||||||
{
|
{
|
||||||
_sunlight.transform.rotation =
|
_sunlight.transform.rotation =
|
||||||
Quaternion.LookRotation(-GameMain.mainPlayer.transform.up + GameMain.mainPlayer.transform.forward * NightLightAngleX / 10f +
|
Quaternion.LookRotation(-GameMain.mainPlayer.transform.up + GameMain.mainPlayer.transform.forward * NightLightAngleX / 10f +
|
||||||
|
|||||||
Reference in New Issue
Block a user