mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
1.14.7 (#707)
## Minor features - Can change the distance that orbit lines are shown at now using `orbitLineFadeStartDistance` and `orbitLineFadeEndDistance`. ## Bug fixes - Fixed spawning inside cloaks. Fixes #671 - Fixed default system override logging errors on load - Fixed star size in shader params - Fixed water inside of cloaks. Was a bug affecting Tesseract's Secret, although they have their own workaround so this won't change anything. - Fixed missing null check in detail builder orb fix (solves an issue in Intervention). Fixes #708
This commit is contained in:
commit
3ed6ba8a77
@ -5,6 +5,9 @@ using NewHorizons.External.Modules.VariableSize;
|
|||||||
using Tessellation;
|
using Tessellation;
|
||||||
using NewHorizons.Utility.OWML;
|
using NewHorizons.Utility.OWML;
|
||||||
using NewHorizons.Utility.OuterWilds;
|
using NewHorizons.Utility.OuterWilds;
|
||||||
|
using NewHorizons.External.Configs;
|
||||||
|
using NewHorizons.Components.Volumes;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace NewHorizons.Builder.Body
|
namespace NewHorizons.Builder.Body
|
||||||
{
|
{
|
||||||
@ -41,10 +44,12 @@ namespace NewHorizons.Builder.Body
|
|||||||
if (_oceanAmbientLight == null) _oceanAmbientLight = SearchUtilities.Find("Ocean_GD").GetComponent<OceanLODController>()._ambientLight.gameObject.InstantiateInactive().Rename("OceanAmbientLight").DontDestroyOnLoad();
|
if (_oceanAmbientLight == null) _oceanAmbientLight = SearchUtilities.Find("Ocean_GD").GetComponent<OceanLODController>()._ambientLight.gameObject.InstantiateInactive().Rename("OceanAmbientLight").DontDestroyOnLoad();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RadialFluidVolume Make(GameObject planetGO, Sector sector, OWRigidbody rb, WaterModule module)
|
public static RadialFluidVolume Make(GameObject planetGO, Sector sector, OWRigidbody rb, PlanetConfig config)
|
||||||
{
|
{
|
||||||
InitPrefabs();
|
InitPrefabs();
|
||||||
|
|
||||||
|
var module = config.Water;
|
||||||
|
|
||||||
var waterSize = module.size;
|
var waterSize = module.size;
|
||||||
|
|
||||||
GameObject waterGO = new GameObject("Water");
|
GameObject waterGO = new GameObject("Water");
|
||||||
@ -154,6 +159,11 @@ namespace NewHorizons.Builder.Body
|
|||||||
fogGO.GetComponent<MeshRenderer>().material.SetFloat("_Radius2", 0);
|
fogGO.GetComponent<MeshRenderer>().material.SetFloat("_Radius2", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config.Cloak != null)
|
||||||
|
{
|
||||||
|
fluidVolume.gameObject.AddComponent<WaterCloakFixerVolume>().material = TSR.sharedMaterials.First(x => x.name == "Ocean_GD_Surface_mat");
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: fix ruleset making the sand bubble pop up
|
// TODO: fix ruleset making the sand bubble pop up
|
||||||
|
|
||||||
waterGO.transform.position = planetGO.transform.position;
|
waterGO.transform.position = planetGO.transform.position;
|
||||||
|
|||||||
@ -61,15 +61,17 @@ namespace NewHorizons.Builder.Orbital
|
|||||||
|
|
||||||
var fade = isMoon;
|
var fade = isMoon;
|
||||||
|
|
||||||
/*
|
if (config.Orbit.orbitLineFadeStartDistance >= 0)
|
||||||
if (config.Base.IsSatellite)
|
|
||||||
{
|
{
|
||||||
if (config.Orbit.Tint != null) color = new Color(0.4082f, 0.516f, 0.4469f, 1f);
|
|
||||||
fade = true;
|
fade = true;
|
||||||
orbitLine._fadeEndDist = 5000;
|
orbitLine._fadeStartDist = config.Orbit.orbitLineFadeStartDistance;
|
||||||
orbitLine._fadeStartDist = 3000;
|
}
|
||||||
|
|
||||||
|
if (config.Orbit.orbitLineFadeEndDistance >= 0)
|
||||||
|
{
|
||||||
|
fade = true;
|
||||||
|
orbitLine._fadeEndDist = config.Orbit.orbitLineFadeEndDistance;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
orbitLine._color = color;
|
orbitLine._color = color;
|
||||||
lineRenderer.endColor = new Color(color.r, color.g, color.b, 0f);
|
lineRenderer.endColor = new Color(color.r, color.g, color.b, 0f);
|
||||||
|
|||||||
@ -257,7 +257,9 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
// Seed fog works differently, so it doesn't need to be fixed
|
// Seed fog works differently, so it doesn't need to be fixed
|
||||||
// (it's also located on a different child path, so the below FindChild calls wouldn't work)
|
// (it's also located on a different child path, so the below FindChild calls wouldn't work)
|
||||||
|
// Default size is 70
|
||||||
var fog = brambleNode.FindChild("Effects/InnerWarpFogSphere");
|
var fog = brambleNode.FindChild("Effects/InnerWarpFogSphere");
|
||||||
|
fog.transform.localScale = Vector3.one * config.scale * 70f;
|
||||||
var fogMaterial = fog.GetComponent<MeshRenderer>().material;
|
var fogMaterial = fog.GetComponent<MeshRenderer>().material;
|
||||||
fogMaterial.SetFloat("_Radius", fogMaterial.GetFloat("_Radius") * config.scale);
|
fogMaterial.SetFloat("_Radius", fogMaterial.GetFloat("_Radius") * config.scale);
|
||||||
fogMaterial.SetFloat("_Density", fogMaterial.GetFloat("_Density") / config.scale);
|
fogMaterial.SetFloat("_Density", fogMaterial.GetFloat("_Density") / config.scale);
|
||||||
|
|||||||
@ -116,25 +116,33 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
foreach (var component in prop.GetComponentsInChildren<Component>(true))
|
foreach (var component in prop.GetComponentsInChildren<Component>(true))
|
||||||
{
|
{
|
||||||
// Components can come through as null here (yes, really),
|
// Rather than having the entire prop not exist when a detail fails let's just try-catch and log an error
|
||||||
// Usually if a script was added to a prefab in an asset bundle but isn't present in the loaded mod DLLs
|
try
|
||||||
if (component == null)
|
|
||||||
{
|
{
|
||||||
invalidComponentFound = true;
|
// Components can come through as null here (yes, really),
|
||||||
continue;
|
// Usually if a script was added to a prefab in an asset bundle but isn't present in the loaded mod DLLs
|
||||||
}
|
if (component == null)
|
||||||
if (component.gameObject == prop && component is OWItem) isItem = true;
|
{
|
||||||
|
invalidComponentFound = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (component.gameObject == prop && component is OWItem) isItem = true;
|
||||||
|
|
||||||
if (sector == null)
|
if (sector == null)
|
||||||
{
|
{
|
||||||
if (FixUnsectoredComponent(component)) continue;
|
if (FixUnsectoredComponent(component)) continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FixSectoredComponent(component, sector, existingSectors, detail.keepLoaded);
|
FixSectoredComponent(component, sector, existingSectors, detail.keepLoaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
FixComponent(component, go, detail.ignoreSun);
|
FixComponent(component, go, detail.ignoreSun);
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
NHLogger.LogError($"Failed to correct component {component?.GetType()?.Name} on {go?.name} - {e}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (detail.path != null)
|
if (detail.path != null)
|
||||||
@ -155,7 +163,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Items shouldn't use these else they get weird
|
// Items should always be kept loaded else they will vanish in your hand as you leave the sector
|
||||||
if (isItem) detail.keepLoaded = true;
|
if (isItem) detail.keepLoaded = true;
|
||||||
|
|
||||||
prop.transform.localScale = detail.stretch ?? (detail.scale != 0 ? Vector3.one * detail.scale : prefab.transform.localScale);
|
prop.transform.localScale = detail.stretch ?? (detail.scale != 0 ? Vector3.one * detail.scale : prefab.transform.localScale);
|
||||||
@ -374,7 +382,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
else if (component is NomaiInterfaceOrb orb)
|
else if (component is NomaiInterfaceOrb orb)
|
||||||
{
|
{
|
||||||
// detect planet gravity
|
// detect planet gravity
|
||||||
var gravityVolume = planetGO.GetAttachedOWRigidbody().GetAttachedGravityVolume();
|
var gravityVolume = planetGO.GetAttachedOWRigidbody()?.GetAttachedGravityVolume();
|
||||||
orb.GetComponent<ConstantForceDetector>()._detectableFields = gravityVolume ? new ForceVolume[] { gravityVolume } : new ForceVolume[] { };
|
orb.GetComponent<ConstantForceDetector>()._detectableFields = gravityVolume ? new ForceVolume[] { gravityVolume } : new ForceVolume[] { };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -454,6 +454,8 @@ namespace NewHorizons.Components.SizeControllers
|
|||||||
|
|
||||||
public float GetSupernovaRadius() => supernova.GetSupernovaRadius();
|
public float GetSupernovaRadius() => supernova.GetSupernovaRadius();
|
||||||
|
|
||||||
|
public float GetSurfaceRadius() => transform.localScale.x;
|
||||||
|
|
||||||
public float GetMaxSupernovaRadius() => supernovaSize;
|
public float GetMaxSupernovaRadius() => supernovaSize;
|
||||||
|
|
||||||
protected new void FixedUpdate()
|
protected new void FixedUpdate()
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using NewHorizons.Builder.Atmosphere;
|
using NewHorizons.Builder.Atmosphere;
|
||||||
|
using NewHorizons.Components.SizeControllers;
|
||||||
using NewHorizons.Utility.OWML;
|
using NewHorizons.Utility.OWML;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@ -17,7 +18,11 @@ namespace NewHorizons.Components.Stars
|
|||||||
private readonly List<StarController> _stars = new();
|
private readonly List<StarController> _stars = new();
|
||||||
private readonly List<Light> _lights = new();
|
private readonly List<Light> _lights = new();
|
||||||
|
|
||||||
private StarController _activeStar;
|
// SunController or StarEvolutionController
|
||||||
|
public StarEvolutionController ActiveStarEvolutionController { get; private set; }
|
||||||
|
public SunController ActiveSunController { get; private set; }
|
||||||
|
|
||||||
|
private StarController _activeStarController;
|
||||||
private SunLightController _sunLightController;
|
private SunLightController _sunLightController;
|
||||||
private SunLightParamUpdater _sunLightParamUpdater;
|
private SunLightParamUpdater _sunLightParamUpdater;
|
||||||
|
|
||||||
@ -54,7 +59,7 @@ namespace NewHorizons.Components.Stars
|
|||||||
NHLogger.LogVerbose($"Removing star from list: {star?.gameObject?.name}");
|
NHLogger.LogVerbose($"Removing star from list: {star?.gameObject?.name}");
|
||||||
if (Instance._stars.Contains(star))
|
if (Instance._stars.Contains(star))
|
||||||
{
|
{
|
||||||
if (Instance._activeStar != null && Instance._activeStar.Equals(star))
|
if (Instance._activeStarController != null && Instance._activeStarController.Equals(star))
|
||||||
{
|
{
|
||||||
Instance._stars.Remove(star);
|
Instance._stars.Remove(star);
|
||||||
if (Instance._stars.Count > 0) Instance.ChangeActiveStar(Instance._stars[0]);
|
if (Instance._stars.Count > 0) Instance.ChangeActiveStar(Instance._stars[0]);
|
||||||
@ -121,11 +126,11 @@ namespace NewHorizons.Components.Stars
|
|||||||
|
|
||||||
if (_stars.Count > 0)
|
if (_stars.Count > 0)
|
||||||
{
|
{
|
||||||
if (_activeStar == null || !_activeStar.gameObject.activeInHierarchy)
|
if (_activeStarController == null || !_activeStarController.gameObject.activeInHierarchy)
|
||||||
{
|
{
|
||||||
if (_stars.Contains(_activeStar))
|
if (_stars.Contains(_activeStarController))
|
||||||
{
|
{
|
||||||
_stars.Remove(_activeStar);
|
_stars.Remove(_activeStarController);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_stars.Count > 0)
|
if (_stars.Count > 0)
|
||||||
@ -145,8 +150,8 @@ namespace NewHorizons.Components.Stars
|
|||||||
// Update atmo shaders
|
// Update atmo shaders
|
||||||
foreach (var (planet, material) in AtmosphereBuilder.Skys)
|
foreach (var (planet, material) in AtmosphereBuilder.Skys)
|
||||||
{
|
{
|
||||||
var sqrDist = (planet.transform.position - _activeStar.transform.position).sqrMagnitude;
|
var sqrDist = (planet.transform.position - _activeStarController.transform.position).sqrMagnitude;
|
||||||
var intensity = Mathf.Min(_activeStar.Intensity / (sqrDist / hearthSunDistanceSqr), 1f);
|
var intensity = Mathf.Min(_activeStarController.Intensity / (sqrDist / hearthSunDistanceSqr), 1f);
|
||||||
|
|
||||||
material.SetFloat(SunIntensity, intensity);
|
material.SetFloat(SunIntensity, intensity);
|
||||||
}
|
}
|
||||||
@ -156,7 +161,7 @@ namespace NewHorizons.Components.Stars
|
|||||||
if (star == null) continue;
|
if (star == null) continue;
|
||||||
if (!(star.gameObject.activeSelf && star.gameObject.activeInHierarchy)) continue;
|
if (!(star.gameObject.activeSelf && star.gameObject.activeInHierarchy)) continue;
|
||||||
|
|
||||||
if (star.Intensity * (star.transform.position - origin).sqrMagnitude < _activeStar.Intensity * (_activeStar.transform.position - origin).sqrMagnitude)
|
if (star.Intensity * (star.transform.position - origin).sqrMagnitude < _activeStarController.Intensity * (_activeStarController.transform.position - origin).sqrMagnitude)
|
||||||
{
|
{
|
||||||
ChangeActiveStar(star);
|
ChangeActiveStar(star);
|
||||||
break;
|
break;
|
||||||
@ -170,11 +175,13 @@ namespace NewHorizons.Components.Stars
|
|||||||
{
|
{
|
||||||
if (_sunLightController == null || _sunLightParamUpdater == null) return;
|
if (_sunLightController == null || _sunLightParamUpdater == null) return;
|
||||||
|
|
||||||
if (_activeStar != null) _activeStar.Disable();
|
_activeStarController?.Disable();
|
||||||
|
|
||||||
NHLogger.LogVerbose($"Switching active star: {star.gameObject.name}");
|
NHLogger.LogVerbose($"Switching active star: {star.gameObject.name}");
|
||||||
|
|
||||||
_activeStar = star;
|
_activeStarController = star;
|
||||||
|
ActiveStarEvolutionController = star.GetComponentInChildren<StarEvolutionController>();
|
||||||
|
ActiveSunController = star.GetComponent<SunController>();
|
||||||
|
|
||||||
star.Enable();
|
star.Enable();
|
||||||
|
|
||||||
@ -194,7 +201,8 @@ namespace NewHorizons.Components.Stars
|
|||||||
transform.localPosition = Vector3.zero;
|
transform.localPosition = Vector3.zero;
|
||||||
|
|
||||||
// Some effects use Locator.GetSunTransform so hopefully its fine to change it
|
// Some effects use Locator.GetSunTransform so hopefully its fine to change it
|
||||||
Locator._sunTransform = transform;
|
// Use the root transform of the star because that's the default behaviour, breaks SunProxy if not (potentially others)
|
||||||
|
Locator._sunTransform = star.transform;
|
||||||
|
|
||||||
// TODO?: maybe also turn off star controller stuff (mainly proxy light) since idk if that can handle more than 1 being on
|
// TODO?: maybe also turn off star controller stuff (mainly proxy light) since idk if that can handle more than 1 being on
|
||||||
}
|
}
|
||||||
|
|||||||
54
NewHorizons/Components/Volumes/WaterCloakFixerVolume.cs
Normal file
54
NewHorizons/Components/Volumes/WaterCloakFixerVolume.cs
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace NewHorizons.Components.Volumes
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A cloak can interfere with the rendering of water
|
||||||
|
/// Water has a lower render queue and is transparent, so you can see the background black cloak over top of the water
|
||||||
|
/// We fix this by setting the water's render queue to that of the cloak
|
||||||
|
/// However, this means that when you are inside the water you will see through the cloak since it's not rendered on top
|
||||||
|
/// To fix that, we set the render queue back to normal when the player enters the water
|
||||||
|
/// Currently this doesnt nothing to fix probe camera pictures. If you are outside of the water, the probe will see the stars and through the cloak
|
||||||
|
/// Oh well
|
||||||
|
/// </summary>
|
||||||
|
internal class WaterCloakFixerVolume : MonoBehaviour
|
||||||
|
{
|
||||||
|
public Material material;
|
||||||
|
private OWTriggerVolume _volume;
|
||||||
|
|
||||||
|
public const int WATER_RENDER_QUEUE = 2990;
|
||||||
|
public const int CLOAK_RENDER_QUEUE = 3000;
|
||||||
|
|
||||||
|
public void Start()
|
||||||
|
{
|
||||||
|
_volume = GetComponent<RadialFluidVolume>().GetOWTriggerVolume();
|
||||||
|
|
||||||
|
_volume.OnEntry += WaterCloakFixerVolume_OnEntry;
|
||||||
|
_volume.OnExit += WaterCloakFixerVolume_OnExit;
|
||||||
|
|
||||||
|
material.renderQueue = CLOAK_RENDER_QUEUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnDestroy()
|
||||||
|
{
|
||||||
|
_volume.OnEntry -= WaterCloakFixerVolume_OnEntry;
|
||||||
|
_volume.OnExit -= WaterCloakFixerVolume_OnExit;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WaterCloakFixerVolume_OnEntry(GameObject hitObj)
|
||||||
|
{
|
||||||
|
if (hitObj.CompareTag("PlayerDetector"))
|
||||||
|
{
|
||||||
|
material.renderQueue = WATER_RENDER_QUEUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WaterCloakFixerVolume_OnExit(GameObject hitObj)
|
||||||
|
{
|
||||||
|
if (hitObj.CompareTag("PlayerDetector"))
|
||||||
|
{
|
||||||
|
material.renderQueue = CLOAK_RENDER_QUEUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
22
NewHorizons/External/Modules/OrbitModule.cs
vendored
22
NewHorizons/External/Modules/OrbitModule.cs
vendored
@ -45,6 +45,12 @@ namespace NewHorizons.External.Modules
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool isTidallyLocked;
|
public bool isTidallyLocked;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Is the body meant to stay in one place without moving? If staticPosition is not set, the initial position
|
||||||
|
/// will be determined using its orbital parameters.
|
||||||
|
/// </summary>
|
||||||
|
public bool isStatic;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If it is tidally locked, this direction will face towards the primary. Ex: Interloper uses `0, -1, 0`. Most planets
|
/// If it is tidally locked, this direction will face towards the primary. Ex: Interloper uses `0, -1, 0`. Most planets
|
||||||
/// will want something like `-1, 0, 0`.
|
/// will want something like `-1, 0, 0`.
|
||||||
@ -62,12 +68,6 @@ namespace NewHorizons.External.Modules
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool dottedOrbitLine;
|
public bool dottedOrbitLine;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Is the body meant to stay in one place without moving? If staticPosition is not set, the initial position
|
|
||||||
/// will be determined using its orbital parameters.
|
|
||||||
/// </summary>
|
|
||||||
public bool isStatic;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Colour of the orbit-line in the map view.
|
/// Colour of the orbit-line in the map view.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -78,6 +78,16 @@ namespace NewHorizons.External.Modules
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool trackingOrbitLine;
|
public bool trackingOrbitLine;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If the camera is farther than this distance the orbit line will fade out. Leave empty to not have it fade out.
|
||||||
|
/// </summary>
|
||||||
|
public float orbitLineFadeEndDistance = -1f;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If the camera is closer than this distance the orbit line will fade out. Leave empty to not have it fade out.
|
||||||
|
/// </summary>
|
||||||
|
public float orbitLineFadeStartDistance = -1f;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The semi-major axis of the ellipse that is the body's orbit. For a circular orbit this is the radius.
|
/// The semi-major axis of the ellipse that is the body's orbit. For a circular orbit this is the radius.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -627,7 +627,7 @@ namespace NewHorizons.Handlers
|
|||||||
|
|
||||||
if (body.Config.Water != null)
|
if (body.Config.Water != null)
|
||||||
{
|
{
|
||||||
WaterBuilder.Make(go, sector, rb, body.Config.Water);
|
WaterBuilder.Make(go, sector, rb, body.Config);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (body.Config.Sand != null)
|
if (body.Config.Sand != null)
|
||||||
|
|||||||
@ -6,6 +6,7 @@ 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
|
||||||
{
|
{
|
||||||
@ -66,17 +67,20 @@ namespace NewHorizons.Handlers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var proxyBody in GameObject.FindObjectsOfType<ProxyBody>())
|
|
||||||
{
|
|
||||||
toDisable.Add(proxyBody.gameObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
Delay.FireInNUpdates(() =>
|
Delay.FireInNUpdates(() =>
|
||||||
{
|
{
|
||||||
foreach (var gameObject in toDisable)
|
foreach (var gameObject in toDisable)
|
||||||
{
|
{
|
||||||
gameObject.SetActive(false);
|
gameObject.SetActive(false);
|
||||||
}
|
}
|
||||||
|
// Kill all non nh proxies
|
||||||
|
foreach (var proxy in GameObject.FindObjectsOfType<ProxyBody>())
|
||||||
|
{
|
||||||
|
if (proxy is not NHProxy)
|
||||||
|
{
|
||||||
|
proxy.gameObject.SetActive(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
GameObject.FindObjectOfType<SunProxy>().gameObject.SetActive(false);
|
GameObject.FindObjectOfType<SunProxy>().gameObject.SetActive(false);
|
||||||
|
|
||||||
// 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
|
||||||
|
|||||||
@ -10,11 +10,11 @@ namespace NewHorizons.Handlers
|
|||||||
{
|
{
|
||||||
public static void SetUpPlayerSpawn()
|
public static void SetUpPlayerSpawn()
|
||||||
{
|
{
|
||||||
var spawnPoint = Main.SystemDict[Main.Instance.CurrentStarSystem].SpawnPoint;
|
if (UsingCustomSpawn())
|
||||||
if (spawnPoint != null)
|
|
||||||
{
|
{
|
||||||
SearchUtilities.Find("Player_Body").GetComponent<MatchInitialMotion>().SetBodyToMatch(spawnPoint.GetAttachedOWRigidbody());
|
var spawn = GetDefaultSpawn();
|
||||||
GetPlayerSpawner().SetInitialSpawnPoint(spawnPoint);
|
SearchUtilities.Find("Player_Body").GetComponent<MatchInitialMotion>().SetBodyToMatch(spawn.GetAttachedOWRigidbody());
|
||||||
|
GetPlayerSpawner().SetInitialSpawnPoint(spawn);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -44,6 +44,13 @@ namespace NewHorizons.Handlers
|
|||||||
// Arbitrary number, depending on the machine some people die, some people fall through the floor, its very inconsistent
|
// Arbitrary number, depending on the machine some people die, some people fall through the floor, its very inconsistent
|
||||||
Delay.StartCoroutine(SpawnCoroutine(30));
|
Delay.StartCoroutine(SpawnCoroutine(30));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var cloak = GetDefaultSpawn()?.GetAttachedOWRigidbody()?.GetComponentInChildren<CloakFieldController>();
|
||||||
|
if (cloak != null)
|
||||||
|
{
|
||||||
|
// Ensures it has invoked everything and actually placed the player in the cloaking field #671
|
||||||
|
cloak._firstUpdate = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SpawnShip()
|
public static void SpawnShip()
|
||||||
|
|||||||
@ -907,7 +907,8 @@ namespace NewHorizons
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(_defaultSystemOverride))
|
// Ignore first load because it doesn't even know what systems we have
|
||||||
|
if (!_firstLoad && !string.IsNullOrEmpty(_defaultSystemOverride))
|
||||||
{
|
{
|
||||||
NHLogger.LogError($"The given default system override {_defaultSystemOverride} is invalid - no system exists with that name");
|
NHLogger.LogError($"The given default system override {_defaultSystemOverride} is invalid - no system exists with that name");
|
||||||
}
|
}
|
||||||
|
|||||||
19
NewHorizons/Patches/ProxyPatches/SunProxyPatches.cs
Normal file
19
NewHorizons/Patches/ProxyPatches/SunProxyPatches.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using HarmonyLib;
|
||||||
|
using NewHorizons.Utility;
|
||||||
|
|
||||||
|
namespace NewHorizons.Patches.ProxyPatches
|
||||||
|
{
|
||||||
|
[HarmonyPatch(typeof(SunProxy))]
|
||||||
|
public static class SunProxyPatches
|
||||||
|
{
|
||||||
|
[HarmonyPostfix]
|
||||||
|
[HarmonyPatch(nameof(SunProxy.Start))]
|
||||||
|
public static void SunProxy_Start(SunProxy __instance)
|
||||||
|
{
|
||||||
|
// We mess with the Locator.GetSunTransform() value to switch it to other relevant stars since it's used for some other effects
|
||||||
|
// However if it's set to a different star when the SunProxy starts it breaks, so we double check it here
|
||||||
|
__instance._sunTransform = SearchUtilities.Find("Sun_Body").transform;
|
||||||
|
__instance._realSunController = __instance._sunTransform.GetComponent<SunController>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
using HarmonyLib;
|
||||||
|
using NewHorizons.Handlers;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace NewHorizons.Patches.ShipLogPatches
|
||||||
|
{
|
||||||
|
[HarmonyPatch(typeof(ShipLogEntryLocation))]
|
||||||
|
public static class ShipLogEntryLocationPatches
|
||||||
|
{
|
||||||
|
[HarmonyPrefix]
|
||||||
|
[HarmonyPatch(nameof(ShipLogEntryLocation.OnValidate))]
|
||||||
|
public static bool ShipLogEntryLocation_OnValidate(ShipLogEntryLocation __instance)
|
||||||
|
{
|
||||||
|
// This part is unchanged
|
||||||
|
if (!__instance._entryID.Equals(string.Empty) && !__instance.gameObject.name.Equals(__instance._entryID))
|
||||||
|
{
|
||||||
|
__instance.gameObject.name = __instance._entryID;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Base method checks if its on the Ringworld to see if it can be cloaked, we wanna check for a cloak field controller instead
|
||||||
|
var cloak = __instance.GetComponentInChildren<CloakFieldController>();
|
||||||
|
__instance._isWithinCloakField = cloak != null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,4 +1,5 @@
|
|||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
using NewHorizons.Components.Stars;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
namespace NewHorizons.Patches.SunPatches
|
namespace NewHorizons.Patches.SunPatches
|
||||||
{
|
{
|
||||||
@ -13,10 +14,20 @@ namespace NewHorizons.Patches.SunPatches
|
|||||||
{
|
{
|
||||||
Vector3 position = __instance.transform.position;
|
Vector3 position = __instance.transform.position;
|
||||||
float w = 2000f;
|
float w = 2000f;
|
||||||
if (__instance._sunController != null)
|
|
||||||
|
var sunController = SunLightEffectsController.Instance.ActiveSunController;
|
||||||
|
var starEvolutionController = SunLightEffectsController.Instance.ActiveStarEvolutionController;
|
||||||
|
|
||||||
|
if (sunController != null)
|
||||||
{
|
{
|
||||||
w = __instance._sunController.HasSupernovaStarted() ? __instance._sunController.GetSupernovaRadius() : __instance._sunController.GetSurfaceRadius();
|
w = sunController.HasSupernovaStarted() ? sunController.GetSupernovaRadius() : sunController.GetSurfaceRadius();
|
||||||
}
|
}
|
||||||
|
// This is an addition in this patch, to work with our stars
|
||||||
|
else if (starEvolutionController != null)
|
||||||
|
{
|
||||||
|
w = starEvolutionController.HasSupernovaStarted() ? starEvolutionController.GetSupernovaRadius() : starEvolutionController.GetSurfaceRadius();
|
||||||
|
}
|
||||||
|
|
||||||
float range = __instance.sunLight.range;
|
float range = __instance.sunLight.range;
|
||||||
Color color = __instance._sunLightController != null ? __instance._sunLightController.sunColor : __instance.sunLight.color;
|
Color color = __instance._sunLightController != null ? __instance._sunLightController.sunColor : __instance.sunLight.color;
|
||||||
float w2 = __instance._sunLightController != null ? __instance._sunLightController.sunIntensity : __instance.sunLight.intensity;
|
float w2 = __instance._sunLightController != null ? __instance._sunLightController.sunIntensity : __instance.sunLight.intensity;
|
||||||
|
|||||||
@ -29,12 +29,22 @@ namespace NewHorizons.Patches.WarpPatches
|
|||||||
[HarmonyPatch(nameof(VesselWarpController.CheckSystemActivation))]
|
[HarmonyPatch(nameof(VesselWarpController.CheckSystemActivation))]
|
||||||
public static void VesselWarpController_CheckSystemActivation(VesselWarpController __instance)
|
public static void VesselWarpController_CheckSystemActivation(VesselWarpController __instance)
|
||||||
{
|
{
|
||||||
if (Locator.GetEyeStateManager() == null && Main.Instance.CurrentStarSystem != "EyeOfTheUniverse")
|
// Base method only manages the state of the source warp platform blackhole if the EyeStateManager isn't null
|
||||||
|
// However we place the vessel into other systems, so we want to handle the state in those locations as well
|
||||||
|
// For some reason the blackhole can also just be null in which case we ignore all this. Happens in Intervention 1.0.3
|
||||||
|
if (Locator.GetEyeStateManager() == null && Main.Instance.CurrentStarSystem != "EyeOfTheUniverse" && __instance._sourceWarpPlatform._blackHole != null)
|
||||||
{
|
{
|
||||||
if (!__instance._sourceWarpPlatform.IsBlackHoleOpen() && __instance._hasPower && __instance._warpPlatformPowerSlot.IsActivated() && __instance._targetWarpPlatform != null)
|
var isBlackHoleOpen = __instance._sourceWarpPlatform.IsBlackHoleOpen();
|
||||||
__instance._sourceWarpPlatform.OpenBlackHole(__instance._targetWarpPlatform, true);
|
var shouldBlackHoleBeOpen = __instance._hasPower && __instance._warpPlatformPowerSlot.IsActivated() && __instance._targetWarpPlatform != null;
|
||||||
else if (__instance._sourceWarpPlatform.IsBlackHoleOpen() && (!__instance._hasPower || !__instance._warpPlatformPowerSlot.IsActivated()))
|
|
||||||
|
if (isBlackHoleOpen && !shouldBlackHoleBeOpen)
|
||||||
|
{
|
||||||
__instance._sourceWarpPlatform.CloseBlackHole();
|
__instance._sourceWarpPlatform.CloseBlackHole();
|
||||||
|
}
|
||||||
|
else if (!isBlackHoleOpen && shouldBlackHoleBeOpen)
|
||||||
|
{
|
||||||
|
__instance._sourceWarpPlatform.OpenBlackHole(__instance._targetWarpPlatform, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1056,6 +1056,10 @@
|
|||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "Should the body always have one side facing its primary?"
|
"description": "Should the body always have one side facing its primary?"
|
||||||
},
|
},
|
||||||
|
"isStatic": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Is the body meant to stay in one place without moving? If staticPosition is not set, the initial position\nwill be determined using its orbital parameters."
|
||||||
|
},
|
||||||
"alignmentAxis": {
|
"alignmentAxis": {
|
||||||
"description": "If it is tidally locked, this direction will face towards the primary. Ex: Interloper uses `0, -1, 0`. Most planets\nwill want something like `-1, 0, 0`.",
|
"description": "If it is tidally locked, this direction will face towards the primary. Ex: Interloper uses `0, -1, 0`. Most planets\nwill want something like `-1, 0, 0`.",
|
||||||
"$ref": "#/definitions/MVector3"
|
"$ref": "#/definitions/MVector3"
|
||||||
@ -1069,10 +1073,6 @@
|
|||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "Should the orbit line be dotted?"
|
"description": "Should the orbit line be dotted?"
|
||||||
},
|
},
|
||||||
"isStatic": {
|
|
||||||
"type": "boolean",
|
|
||||||
"description": "Is the body meant to stay in one place without moving? If staticPosition is not set, the initial position\nwill be determined using its orbital parameters."
|
|
||||||
},
|
|
||||||
"tint": {
|
"tint": {
|
||||||
"description": "Colour of the orbit-line in the map view.",
|
"description": "Colour of the orbit-line in the map view.",
|
||||||
"$ref": "#/definitions/MColor"
|
"$ref": "#/definitions/MColor"
|
||||||
@ -1081,6 +1081,16 @@
|
|||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "Should we just draw a line behind its orbit instead of the entire circle/ellipse?"
|
"description": "Should we just draw a line behind its orbit instead of the entire circle/ellipse?"
|
||||||
},
|
},
|
||||||
|
"orbitLineFadeEndDistance": {
|
||||||
|
"type": "number",
|
||||||
|
"description": "If the camera is farther than this distance the orbit line will fade out. Leave empty to not have it fade out.",
|
||||||
|
"format": "float"
|
||||||
|
},
|
||||||
|
"orbitLineFadeStartDistance": {
|
||||||
|
"type": "number",
|
||||||
|
"description": "If the camera is closer than this distance the orbit line will fade out. Leave empty to not have it fade out.",
|
||||||
|
"format": "float"
|
||||||
|
},
|
||||||
"semiMajorAxis": {
|
"semiMajorAxis": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"description": "The semi-major axis of the ellipse that is the body's orbit. For a circular orbit this is the radius.",
|
"description": "The semi-major axis of the ellipse that is the body's orbit. For a circular orbit this is the radius.",
|
||||||
|
|||||||
@ -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.14.6",
|
"version": "1.14.7",
|
||||||
"owmlVersion": "2.9.3",
|
"owmlVersion": "2.9.3",
|
||||||
"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" ],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user