mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Merge branch 'dev' into eye-of-the-universe
This commit is contained in:
commit
2222a4cd93
@ -7,6 +7,7 @@ using System.Collections.Generic;
|
|||||||
using NewHorizons.External.Modules;
|
using NewHorizons.External.Modules;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Logger = NewHorizons.Utility.Logger;
|
using Logger = NewHorizons.Utility.Logger;
|
||||||
|
using NewHorizons.Components.Volumes;
|
||||||
|
|
||||||
namespace NewHorizons.Builder.Body
|
namespace NewHorizons.Builder.Body
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
using NewHorizons.Components;
|
|
||||||
using NewHorizons.External.Configs;
|
using NewHorizons.External.Configs;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
using System;
|
using System;
|
||||||
@ -10,6 +9,7 @@ using System.Linq;
|
|||||||
using NewHorizons.Components.SizeControllers;
|
using NewHorizons.Components.SizeControllers;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using Color = UnityEngine.Color;
|
using Color = UnityEngine.Color;
|
||||||
|
using NewHorizons.Components.Volumes;
|
||||||
|
|
||||||
namespace NewHorizons.Builder.Body
|
namespace NewHorizons.Builder.Body
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
using NewHorizons.Components;
|
|
||||||
using NewHorizons.Components.SizeControllers;
|
using NewHorizons.Components.SizeControllers;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
using OWML.Utils;
|
using OWML.Utils;
|
||||||
@ -9,6 +8,7 @@ using OWML.ModHelper;
|
|||||||
using OWML.Common;
|
using OWML.Common;
|
||||||
using UnityEngine.InputSystem.XR;
|
using UnityEngine.InputSystem.XR;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using NewHorizons.Components.Stars;
|
||||||
|
|
||||||
namespace NewHorizons.Builder.Body
|
namespace NewHorizons.Builder.Body
|
||||||
{
|
{
|
||||||
@ -157,7 +157,6 @@ namespace NewHorizons.Builder.Body
|
|||||||
light.CopyPropertiesFrom(_sunLight.GetComponent<Light>());
|
light.CopyPropertiesFrom(_sunLight.GetComponent<Light>());
|
||||||
light.intensity *= starModule.solarLuminosity;
|
light.intensity *= starModule.solarLuminosity;
|
||||||
light.range = starModule.lightRadius;
|
light.range = starModule.lightRadius;
|
||||||
light.range *= Mathf.Sqrt(starModule.solarLuminosity);
|
|
||||||
|
|
||||||
Color lightColour = light.color;
|
Color lightColour = light.color;
|
||||||
if (starModule.lightTint != null) lightColour = starModule.lightTint.ToColor();
|
if (starModule.lightTint != null) lightColour = starModule.lightTint.ToColor();
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
using NewHorizons.Components;
|
|
||||||
using NewHorizons.Components.SizeControllers;
|
using NewHorizons.Components.SizeControllers;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using NewHorizons.External.Modules.VariableSize;
|
using NewHorizons.External.Modules.VariableSize;
|
||||||
using Tessellation;
|
using Tessellation;
|
||||||
|
using NewHorizons.Components.Volumes;
|
||||||
|
|
||||||
namespace NewHorizons.Builder.Body
|
namespace NewHorizons.Builder.Body
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
using NewHorizons.Builder.General;
|
|
||||||
using NewHorizons.External.Configs;
|
using NewHorizons.External.Configs;
|
||||||
using NewHorizons.External.Modules;
|
using NewHorizons.External.Modules;
|
||||||
using NewHorizons.Handlers;
|
using NewHorizons.Handlers;
|
||||||
@ -80,7 +79,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
}
|
}
|
||||||
else FixSectoredComponent(component, sector, isTorch);
|
else FixSectoredComponent(component, sector, isTorch);
|
||||||
|
|
||||||
FixComponent(component, go, prefab.name);
|
FixComponent(component, go);
|
||||||
}
|
}
|
||||||
|
|
||||||
prop.transform.position = detail.position == null ? go.transform.position : go.transform.TransformPoint(detail.position);
|
prop.transform.position = detail.position == null ? go.transform.position : go.transform.TransformPoint(detail.position);
|
||||||
@ -101,7 +100,6 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
prop.transform.localScale = detail.scale != 0 ? Vector3.one * detail.scale : prefab.transform.localScale;
|
prop.transform.localScale = detail.scale != 0 ? Vector3.one * detail.scale : prefab.transform.localScale;
|
||||||
|
|
||||||
if (!detail.keepLoaded) GroupsBuilder.Make(prop, sector);
|
|
||||||
prop.SetActive(true);
|
prop.SetActive(true);
|
||||||
|
|
||||||
if (prop == null) return null;
|
if (prop == null) return null;
|
||||||
@ -224,11 +222,11 @@ namespace NewHorizons.Builder.Props
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void FixComponent(Component component, GameObject planetGO, string prefab)
|
private static void FixComponent(Component component, GameObject planetGO)
|
||||||
{
|
{
|
||||||
// Fix other components
|
// Fix other components
|
||||||
// I forget why this is here
|
// I forget why this is here
|
||||||
if (component is GhostIK || component is GhostEffects)
|
if (component is GhostIK or GhostEffects)
|
||||||
{
|
{
|
||||||
Component.DestroyImmediate(component);
|
Component.DestroyImmediate(component);
|
||||||
return;
|
return;
|
||||||
@ -280,27 +278,40 @@ namespace NewHorizons.Builder.Props
|
|||||||
torchItem.mindSlideProjector._mindProjectorImageEffect = SearchUtilities.Find("Player_Body/PlayerCamera").GetComponent<MindProjectorImageEffect>();
|
torchItem.mindSlideProjector._mindProjectorImageEffect = SearchUtilities.Find("Player_Body/PlayerCamera").GetComponent<MindProjectorImageEffect>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix a bunch of stuff when done loading
|
|
||||||
Delay.RunWhen(() => Main.IsSystemReady, () =>
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (component == null) return;
|
|
||||||
if (component is Animator animator) animator.enabled = true;
|
if (component is Animator animator) animator.enabled = true;
|
||||||
else if (component is Collider collider) collider.enabled = true;
|
if (component is Collider collider) collider.enabled = true;
|
||||||
else if (component is Renderer renderer) renderer.enabled = true;
|
if (component is Renderer renderer) renderer.enabled = true;
|
||||||
else if (component is Shape shape) shape.enabled = true;
|
if (component is Shape shape) shape.enabled = true;
|
||||||
else if (component is SectorCullGroup sectorCullGroup)
|
|
||||||
|
// fixes sector cull group deactivating renderers on map view enter and fast foward
|
||||||
|
// TODO: does this actually work? what? how?
|
||||||
|
if (component is SectorCullGroup sectorCullGroup)
|
||||||
{
|
{
|
||||||
sectorCullGroup._inMapView = false;
|
sectorCullGroup._inMapView = false;
|
||||||
sectorCullGroup._isFastForwarding = false;
|
sectorCullGroup._isFastForwarding = false;
|
||||||
sectorCullGroup.SetVisible(sectorCullGroup.ShouldBeVisible(), true, false);
|
sectorCullGroup.SetVisible(sectorCullGroup.ShouldBeVisible(), true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If it's not a moving anglerfish make sure the anim controller is regular
|
// If it's not a moving anglerfish make sure the anim controller is regular
|
||||||
else if (component is AnglerfishAnimController angler && angler.GetComponentInParent<AnglerfishController>() == null)
|
if (component is AnglerfishAnimController && component.GetComponentInParent<AnglerfishController>() == null)
|
||||||
|
component.gameObject.AddComponent<AnglerAnimFixer>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Has to happen after AnglerfishAnimController awake to remove the events it has set up.
|
||||||
|
/// Otherwise results in the anglerfish 1) having its animations controlled by an actual fish 2) randomly having different animations on solarsystem load
|
||||||
|
/// Can't do delay because it needs to work with scatter (copies a prefab made using MakeDetail).
|
||||||
|
/// </summary>
|
||||||
|
[RequireComponent(typeof(AnglerfishAnimController))]
|
||||||
|
private class AnglerAnimFixer : MonoBehaviour
|
||||||
{
|
{
|
||||||
Logger.LogVerbose("Enabling anglerfish animation");
|
private void Start()
|
||||||
// Remove any reference to its angler
|
{
|
||||||
|
var angler = GetComponent<AnglerfishAnimController>();
|
||||||
|
|
||||||
|
Logger.LogVerbose("Fixing anglerfish animation");
|
||||||
|
|
||||||
|
// Remove any event reference to its angler
|
||||||
if (angler._anglerfishController)
|
if (angler._anglerfishController)
|
||||||
{
|
{
|
||||||
angler._anglerfishController.OnChangeAnglerState -= angler.OnChangeAnglerState;
|
angler._anglerfishController.OnChangeAnglerState -= angler.OnChangeAnglerState;
|
||||||
@ -310,13 +321,9 @@ namespace NewHorizons.Builder.Props
|
|||||||
}
|
}
|
||||||
angler.enabled = true;
|
angler.enabled = true;
|
||||||
angler.OnChangeAnglerState(AnglerfishController.AnglerState.Lurking);
|
angler.OnChangeAnglerState(AnglerfishController.AnglerState.Lurking);
|
||||||
|
|
||||||
|
Destroy(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Logger.LogWarning($"Exception when modifying component [{component.GetType().Name}] on [{planetGO.name}] for prop [{prefab}]:\n{e}");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,5 +1,5 @@
|
|||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using NewHorizons.Components;
|
using NewHorizons.Components.Quantum;
|
||||||
using NewHorizons.External.Configs;
|
using NewHorizons.External.Configs;
|
||||||
using NewHorizons.External.Modules;
|
using NewHorizons.External.Modules;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using NewHorizons.Components;
|
using NewHorizons.Components;
|
||||||
|
using NewHorizons.Components.Volumes;
|
||||||
using NewHorizons.External.Modules;
|
using NewHorizons.External.Modules;
|
||||||
using NewHorizons.Handlers;
|
using NewHorizons.Handlers;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
|
|||||||
@ -3,6 +3,8 @@ using NewHorizons.External.Modules;
|
|||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
using OWML.Common;
|
using OWML.Common;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Object = UnityEngine.Object;
|
using Object = UnityEngine.Object;
|
||||||
using Random = UnityEngine.Random;
|
using Random = UnityEngine.Random;
|
||||||
@ -19,13 +21,20 @@ namespace NewHorizons.Builder.Props
|
|||||||
{
|
{
|
||||||
var heightMap = config.HeightMap;
|
var heightMap = config.HeightMap;
|
||||||
|
|
||||||
|
var makeFibonacciSphere = scatterInfo.Any(x => x.preventOverlap);
|
||||||
|
|
||||||
|
List<Vector3> points = new();
|
||||||
|
|
||||||
|
if (makeFibonacciSphere)
|
||||||
|
{
|
||||||
var area = 4f * Mathf.PI * radius * radius;
|
var area = 4f * Mathf.PI * radius * radius;
|
||||||
|
|
||||||
// To not use more than 0.5GB of RAM while doing this
|
// To not use more than 0.5GB of RAM while doing this
|
||||||
// Works up to planets with 575 radius before capping
|
// Works up to planets with 575 radius before capping
|
||||||
var numPoints = Math.Min((int)(area * 10), 41666666);
|
var numPoints = Math.Min((int)(area * 10), 41666666);
|
||||||
|
|
||||||
var points = RandomUtility.FibonacciSphere(numPoints);
|
points = RandomUtility.FibonacciSphere(numPoints);
|
||||||
|
}
|
||||||
|
|
||||||
Texture2D heightMapTexture = null;
|
Texture2D heightMapTexture = null;
|
||||||
if (heightMap != null)
|
if (heightMap != null)
|
||||||
@ -55,13 +64,29 @@ namespace NewHorizons.Builder.Props
|
|||||||
GameObject prefab;
|
GameObject prefab;
|
||||||
if (propInfo.assetBundle != null) prefab = AssetBundleUtilities.LoadPrefab(propInfo.assetBundle, propInfo.path, mod);
|
if (propInfo.assetBundle != null) prefab = AssetBundleUtilities.LoadPrefab(propInfo.assetBundle, propInfo.path, mod);
|
||||||
else prefab = SearchUtilities.Find(propInfo.path);
|
else prefab = SearchUtilities.Find(propInfo.path);
|
||||||
|
|
||||||
|
// Run all the make detail stuff on it early and just copy it over and over instead
|
||||||
|
var detailInfo = new PropModule.DetailInfo()
|
||||||
|
{
|
||||||
|
scale = propInfo.scale,
|
||||||
|
keepLoaded = propInfo.keepLoaded
|
||||||
|
};
|
||||||
|
var scatterPrefab = DetailBuilder.Make(go, sector, prefab, detailInfo);
|
||||||
|
|
||||||
for (int i = 0; i < propInfo.count; i++)
|
for (int i = 0; i < propInfo.count; i++)
|
||||||
{
|
{
|
||||||
// Failsafe
|
Vector3 point;
|
||||||
|
if (propInfo.preventOverlap)
|
||||||
|
{
|
||||||
if (points.Count == 0) break;
|
if (points.Count == 0) break;
|
||||||
|
var randomInd = Random.Range(0, points.Count - 1);
|
||||||
var randomInd = (int)Random.Range(0, points.Count - 1);
|
point = points[randomInd];
|
||||||
var point = points[randomInd];
|
points.QuickRemoveAt(randomInd);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
point = Random.onUnitSphere;
|
||||||
|
}
|
||||||
|
|
||||||
var height = radius;
|
var height = radius;
|
||||||
if (heightMapTexture != null)
|
if (heightMapTexture != null)
|
||||||
@ -92,14 +117,11 @@ namespace NewHorizons.Builder.Props
|
|||||||
point = Quaternion.Euler(90, 0, 0) * point;
|
point = Quaternion.Euler(90, 0, 0) * point;
|
||||||
}
|
}
|
||||||
|
|
||||||
var detailInfo = new PropModule.DetailInfo()
|
var prop = scatterPrefab.InstantiateInactive();
|
||||||
{
|
prop.transform.SetParent(sector?.transform ?? go.transform);
|
||||||
position = point.normalized * height,
|
prop.transform.localPosition = go.transform.TransformPoint(point * height);
|
||||||
scale = propInfo.scale,
|
var up = go.transform.InverseTransformPoint(prop.transform.position).normalized;
|
||||||
keepLoaded = propInfo.keepLoaded,
|
prop.transform.rotation = Quaternion.FromToRotation(Vector3.up, up);
|
||||||
alignToNormal = true
|
|
||||||
};
|
|
||||||
var prop = DetailBuilder.Make(go, sector, prefab, detailInfo);
|
|
||||||
|
|
||||||
if (propInfo.offset != null) prop.transform.localPosition += prop.transform.TransformVector(propInfo.offset);
|
if (propInfo.offset != null) prop.transform.localPosition += prop.transform.TransformVector(propInfo.offset);
|
||||||
if (propInfo.rotation != null) prop.transform.rotation *= Quaternion.Euler(propInfo.rotation);
|
if (propInfo.rotation != null) prop.transform.rotation *= Quaternion.Euler(propInfo.rotation);
|
||||||
@ -107,9 +129,10 @@ namespace NewHorizons.Builder.Props
|
|||||||
// Rotate around normal
|
// Rotate around normal
|
||||||
prop.transform.localRotation *= Quaternion.AngleAxis(Random.Range(0, 360), Vector3.up);
|
prop.transform.localRotation *= Quaternion.AngleAxis(Random.Range(0, 360), Vector3.up);
|
||||||
|
|
||||||
points.QuickRemoveAt(randomInd);
|
prop.SetActive(true);
|
||||||
if (points.Count == 0) return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GameObject.Destroy(scatterPrefab);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
using NewHorizons.Components;
|
|
||||||
using NewHorizons.External.Modules;
|
using NewHorizons.External.Modules;
|
||||||
using NewHorizons.Handlers;
|
using NewHorizons.Handlers;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
@ -9,6 +8,8 @@ using NewHorizons.External.Modules.VariableSize;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using Logger = NewHorizons.Utility.Logger;
|
using Logger = NewHorizons.Utility.Logger;
|
||||||
|
using NewHorizons.Components.ShipLog;
|
||||||
|
|
||||||
namespace NewHorizons.Builder.ShipLog
|
namespace NewHorizons.Builder.ShipLog
|
||||||
{
|
{
|
||||||
public static class MapModeBuilder
|
public static class MapModeBuilder
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
using NewHorizons.Components;
|
|
||||||
using NewHorizons.External.Modules;
|
using NewHorizons.External.Modules;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
using OWML.Common;
|
using OWML.Common;
|
||||||
@ -9,7 +8,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Logger = NewHorizons.Utility.Logger;
|
using Logger = NewHorizons.Utility.Logger;
|
||||||
using NHNotificationVolume = NewHorizons.Components.NotificationVolume;
|
using NHNotificationVolume = NewHorizons.Components.Volumes.NotificationVolume;
|
||||||
|
|
||||||
namespace NewHorizons.Builder.Volumes
|
namespace NewHorizons.Builder.Volumes
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
using NewHorizons.Builder.Body;
|
using NewHorizons.Builder.Body;
|
||||||
using NewHorizons.Builder.ShipLog;
|
using NewHorizons.Builder.ShipLog;
|
||||||
using NewHorizons.Builder.Volumes;
|
using NewHorizons.Builder.Volumes;
|
||||||
using NewHorizons.Components;
|
using NewHorizons.Components.Volumes;
|
||||||
using NewHorizons.External.Configs;
|
using NewHorizons.External.Configs;
|
||||||
using OWML.Common;
|
using OWML.Common;
|
||||||
using System;
|
using System;
|
||||||
@ -61,7 +61,7 @@ namespace NewHorizons.Builder.Volumes
|
|||||||
{
|
{
|
||||||
foreach (var interferenceVolume in config.Volumes.interferenceVolumes)
|
foreach (var interferenceVolume in config.Volumes.interferenceVolumes)
|
||||||
{
|
{
|
||||||
VolumeBuilder.Make<Components.InterferenceVolume>(go, sector, interferenceVolume);
|
VolumeBuilder.Make<Components.Volumes.InterferenceVolume>(go, sector, interferenceVolume);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (config.Volumes.reverbVolumes != null)
|
if (config.Volumes.reverbVolumes != null)
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
using NewHorizons.Builder.General;
|
using NewHorizons.Builder.General;
|
||||||
using NewHorizons.External.Configs;
|
using NewHorizons.External.Configs;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
namespace NewHorizons.Components
|
namespace NewHorizons.Components.Fixers
|
||||||
{
|
{
|
||||||
public class MapSatelliteOrbitFix : MonoBehaviour
|
public class MapSatelliteOrbitFix : MonoBehaviour
|
||||||
{
|
{
|
||||||
@ -7,7 +7,7 @@ using UnityEngine;
|
|||||||
|
|
||||||
using Logger = NewHorizons.Utility.Logger;
|
using Logger = NewHorizons.Utility.Logger;
|
||||||
|
|
||||||
namespace NewHorizons.Components
|
namespace NewHorizons.Components.Quantum
|
||||||
{
|
{
|
||||||
public class NHMultiStateQuantumObject : MultiStateQuantumObject
|
public class NHMultiStateQuantumObject : MultiStateQuantumObject
|
||||||
{
|
{
|
||||||
@ -28,7 +28,7 @@ namespace NewHorizons.Components
|
|||||||
}
|
}
|
||||||
else if (_sequential)
|
else if (_sequential)
|
||||||
{
|
{
|
||||||
_stateIndex = (_reverse ? (_stateIndex - 1) : (_stateIndex + 1));
|
_stateIndex = _reverse ? _stateIndex - 1 : _stateIndex + 1;
|
||||||
if (_loop)
|
if (_loop)
|
||||||
{
|
{
|
||||||
if (_stateIndex < 0)
|
if (_stateIndex < 0)
|
||||||
@ -83,7 +83,7 @@ namespace NewHorizons.Components
|
|||||||
if (!CurrentStateIsValid() && stateIndexIsValid)
|
if (!CurrentStateIsValid() && stateIndexIsValid)
|
||||||
{
|
{
|
||||||
_states[_stateIndex].SetVisible(visible: false);
|
_states[_stateIndex].SetVisible(visible: false);
|
||||||
_states[stateIndex] .SetVisible(visible: true);
|
_states[stateIndex].SetVisible(visible: true);
|
||||||
_stateIndex = stateIndex;
|
_stateIndex = stateIndex;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -105,11 +105,11 @@ namespace NewHorizons.Components
|
|||||||
var isVisible =
|
var isVisible =
|
||||||
isPlayerEntangled
|
isPlayerEntangled
|
||||||
? illumination
|
? illumination
|
||||||
: (
|
:
|
||||||
illumination
|
illumination
|
||||||
? visibility
|
? visibility
|
||||||
: playerInside
|
: playerInside
|
||||||
);
|
;
|
||||||
|
|
||||||
return !isVisible;
|
return !isVisible;
|
||||||
}
|
}
|
||||||
@ -157,7 +157,7 @@ namespace NewHorizons.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return indices[indices.Count-1];
|
return indices[indices.Count - 1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -9,7 +9,7 @@ using System.Linq;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Logger = NewHorizons.Utility.Logger;
|
using Logger = NewHorizons.Utility.Logger;
|
||||||
using Random = UnityEngine.Random;
|
using Random = UnityEngine.Random;
|
||||||
namespace NewHorizons.Components
|
namespace NewHorizons.Components.Quantum
|
||||||
{
|
{
|
||||||
public class QuantumPlanet : QuantumObject
|
public class QuantumPlanet : QuantumObject
|
||||||
{
|
{
|
||||||
@ -162,9 +162,9 @@ namespace NewHorizons.Components
|
|||||||
|
|
||||||
private void OnPlayerBlink()
|
private void OnPlayerBlink()
|
||||||
{
|
{
|
||||||
if (base.IsVisible())
|
if (IsVisible())
|
||||||
{
|
{
|
||||||
base.Collapse(true);
|
Collapse(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1,3 +1,4 @@
|
|||||||
|
using NewHorizons.Components.Volumes;
|
||||||
using NewHorizons.External.Modules.VariableSize;
|
using NewHorizons.External.Modules.VariableSize;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
using NewHorizons.External.Modules;
|
using NewHorizons.External.Modules;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using Logger = NewHorizons.Utility.Logger;
|
using Logger = NewHorizons.Utility.Logger;
|
||||||
namespace NewHorizons.Components
|
namespace NewHorizons.Components.ShipLog
|
||||||
{
|
{
|
||||||
public class ShipLogDetail : MonoBehaviour
|
public class ShipLogDetail : MonoBehaviour
|
||||||
{
|
{
|
||||||
@ -51,7 +51,7 @@ namespace NewHorizons.Components
|
|||||||
|
|
||||||
private void SetGreyScale(bool greyScale)
|
private void SetGreyScale(bool greyScale)
|
||||||
{
|
{
|
||||||
_revealedImage.material = (greyScale ? _greyScaleMaterial : null);
|
_revealedImage.material = greyScale ? _greyScaleMaterial : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6,7 +6,7 @@ using System.Linq;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using Logger = NewHorizons.Utility.Logger;
|
using Logger = NewHorizons.Utility.Logger;
|
||||||
namespace NewHorizons.Components
|
namespace NewHorizons.Components.ShipLog
|
||||||
{
|
{
|
||||||
public class ShipLogStarChartMode : ShipLogMode
|
public class ShipLogStarChartMode : ShipLogMode
|
||||||
{
|
{
|
||||||
@ -41,7 +41,7 @@ namespace NewHorizons.Components
|
|||||||
|
|
||||||
public override void Initialize(ScreenPromptList centerPromptList, ScreenPromptList upperRightPromptList, OWAudioSource oneShotSource)
|
public override void Initialize(ScreenPromptList centerPromptList, ScreenPromptList upperRightPromptList, OWAudioSource oneShotSource)
|
||||||
{
|
{
|
||||||
root = base.transform.Find("ScaleRoot/PanRoot");
|
root = transform.Find("ScaleRoot/PanRoot");
|
||||||
_oneShotSource = oneShotSource;
|
_oneShotSource = oneShotSource;
|
||||||
|
|
||||||
_centerPromptList = centerPromptList;
|
_centerPromptList = centerPromptList;
|
||||||
@ -100,11 +100,11 @@ namespace NewHorizons.Components
|
|||||||
if (_cardTemplate == null)
|
if (_cardTemplate == null)
|
||||||
{
|
{
|
||||||
var panRoot = SearchUtilities.Find("Ship_Body/Module_Cabin/Systems_Cabin/ShipLogPivot/ShipLog/ShipLogPivot/ShipLogCanvas/DetectiveMode/ScaleRoot/PanRoot");
|
var panRoot = SearchUtilities.Find("Ship_Body/Module_Cabin/Systems_Cabin/ShipLogPivot/ShipLog/ShipLogPivot/ShipLogCanvas/DetectiveMode/ScaleRoot/PanRoot");
|
||||||
_cardTemplate = GameObject.Instantiate(panRoot.GetComponentInChildren<ShipLogEntryCard>().gameObject);
|
_cardTemplate = Instantiate(panRoot.GetComponentInChildren<ShipLogEntryCard>().gameObject);
|
||||||
_cardTemplate.SetActive(false);
|
_cardTemplate.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
var newCard = GameObject.Instantiate(_cardTemplate, parent);
|
var newCard = Instantiate(_cardTemplate, parent);
|
||||||
var textComponent = newCard.transform.Find("EntryCardRoot/NameBackground/Name").GetComponent<Text>();
|
var textComponent = newCard.transform.Find("EntryCardRoot/NameBackground/Name").GetComponent<Text>();
|
||||||
|
|
||||||
var name = UniqueIDToName(uniqueID);
|
var name = UniqueIDToName(uniqueID);
|
||||||
@ -167,7 +167,7 @@ namespace NewHorizons.Components
|
|||||||
|
|
||||||
public override void EnterMode(string entryID = "", List<ShipLogFact> revealQueue = null)
|
public override void EnterMode(string entryID = "", List<ShipLogFact> revealQueue = null)
|
||||||
{
|
{
|
||||||
base.gameObject.SetActive(true);
|
gameObject.SetActive(true);
|
||||||
|
|
||||||
Locator.GetPromptManager().AddScreenPrompt(_detectiveModePrompt, _upperRightPromptList, TextAnchor.MiddleRight, -1, true);
|
Locator.GetPromptManager().AddScreenPrompt(_detectiveModePrompt, _upperRightPromptList, TextAnchor.MiddleRight, -1, true);
|
||||||
Locator.GetPromptManager().AddScreenPrompt(_targetSystemPrompt, _centerPromptList, TextAnchor.MiddleCenter, -1, true);
|
Locator.GetPromptManager().AddScreenPrompt(_targetSystemPrompt, _centerPromptList, TextAnchor.MiddleCenter, -1, true);
|
||||||
@ -175,7 +175,7 @@ namespace NewHorizons.Components
|
|||||||
|
|
||||||
public override void ExitMode()
|
public override void ExitMode()
|
||||||
{
|
{
|
||||||
base.gameObject.SetActive(false);
|
gameObject.SetActive(false);
|
||||||
|
|
||||||
Locator.GetPromptManager().RemoveScreenPrompt(_detectiveModePrompt);
|
Locator.GetPromptManager().RemoveScreenPrompt(_detectiveModePrompt);
|
||||||
Locator.GetPromptManager().RemoveScreenPrompt(_targetSystemPrompt);
|
Locator.GetPromptManager().RemoveScreenPrompt(_targetSystemPrompt);
|
||||||
@ -226,7 +226,7 @@ namespace NewHorizons.Components
|
|||||||
|
|
||||||
if (oldIndex != _cardIndex)
|
if (oldIndex != _cardIndex)
|
||||||
{
|
{
|
||||||
_oneShotSource.PlayOneShot(global::AudioType.ShipLogMoveBetweenPlanets, 1f);
|
_oneShotSource.PlayOneShot(AudioType.ShipLogMoveBetweenPlanets, 1f);
|
||||||
_startPanTime = Time.unscaledTime;
|
_startPanTime = Time.unscaledTime;
|
||||||
_startPanPos = _panRootPos;
|
_startPanPos = _panRootPos;
|
||||||
_panDuration = 0.25f;
|
_panDuration = 0.25f;
|
||||||
@ -300,7 +300,7 @@ namespace NewHorizons.Components
|
|||||||
{
|
{
|
||||||
if (_warpNotificationData != null) NotificationManager.SharedInstance.UnpinNotification(_warpNotificationData);
|
if (_warpNotificationData != null) NotificationManager.SharedInstance.UnpinNotification(_warpNotificationData);
|
||||||
if (_target == null) return;
|
if (_target == null) return;
|
||||||
if (playSound) _oneShotSource.PlayOneShot(global::AudioType.ShipLogMarkLocation, 1f);
|
if (playSound) _oneShotSource.PlayOneShot(AudioType.ShipLogMarkLocation, 1f);
|
||||||
_target.SetMarkedOnHUD(false);
|
_target.SetMarkedOnHUD(false);
|
||||||
_target = null;
|
_target = null;
|
||||||
}
|
}
|
||||||
@ -1,5 +1,6 @@
|
|||||||
using NewHorizons.Builder.Body;
|
using NewHorizons.Builder.Body;
|
||||||
using NewHorizons.Components.Orbital;
|
using NewHorizons.Components.Orbital;
|
||||||
|
using NewHorizons.Components.Stars;
|
||||||
using NewHorizons.External.Modules.VariableSize;
|
using NewHorizons.External.Modules.VariableSize;
|
||||||
using NewHorizons.Handlers;
|
using NewHorizons.Handlers;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
@ -286,7 +287,9 @@ namespace NewHorizons.Components.SizeControllers
|
|||||||
{
|
{
|
||||||
_stellarRemnant.SetActive(true);
|
_stellarRemnant.SetActive(true);
|
||||||
var remnantStarController = _stellarRemnant.GetComponentInChildren<StarController>();
|
var remnantStarController = _stellarRemnant.GetComponentInChildren<StarController>();
|
||||||
if (remnantStarController != null) StarLightController.AddStar(remnantStarController);
|
if (remnantStarController != null) SunLightEffectsController.AddStar(remnantStarController);
|
||||||
|
var remnantStarLight = _stellarRemnant.FindChild("SunLight");
|
||||||
|
if (remnantStarLight != null) SunLightEffectsController.AddStarLight(remnantStarLight.GetComponent<Light>());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Time.time > _supernovaStartTime + supernovaTime)
|
if (Time.time > _supernovaStartTime + supernovaTime)
|
||||||
@ -299,7 +302,8 @@ namespace NewHorizons.Components.SizeControllers
|
|||||||
|
|
||||||
private void DisableStar(bool start = false)
|
private void DisableStar(bool start = false)
|
||||||
{
|
{
|
||||||
if (controller != null) StarLightController.RemoveStar(controller);
|
if (controller != null) SunLightEffectsController.RemoveStar(controller);
|
||||||
|
if (!isProxy) SunLightEffectsController.RemoveStarLight(gameObject.FindChild("SunLight").GetComponent<Light>());
|
||||||
|
|
||||||
if (_stellarRemnant != null)
|
if (_stellarRemnant != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,129 +0,0 @@
|
|||||||
using NewHorizons.Builder.Atmosphere;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
using Logger = NewHorizons.Utility.Logger;
|
|
||||||
namespace NewHorizons.Components
|
|
||||||
{
|
|
||||||
[RequireComponent(typeof(SunLightController))]
|
|
||||||
[RequireComponent(typeof(SunLightParamUpdater))]
|
|
||||||
public class StarLightController : MonoBehaviour
|
|
||||||
{
|
|
||||||
private static readonly int SunIntensity = Shader.PropertyToID("_SunIntensity");
|
|
||||||
private static readonly float hearthSunDistanceSqr = 8593 * 8593;
|
|
||||||
|
|
||||||
public static StarLightController Instance { get; private set; }
|
|
||||||
|
|
||||||
private List<StarController> _stars = new List<StarController>();
|
|
||||||
private StarController _activeStar;
|
|
||||||
|
|
||||||
private SunLightController _sunLightController;
|
|
||||||
private SunLightParamUpdater _sunLightParamUpdater;
|
|
||||||
|
|
||||||
public void Awake()
|
|
||||||
{
|
|
||||||
Instance = this;
|
|
||||||
_sunLightController = GetComponent<SunLightController>();
|
|
||||||
_sunLightController.enabled = true;
|
|
||||||
_sunLightParamUpdater = GetComponent<SunLightParamUpdater>();
|
|
||||||
_sunLightParamUpdater._sunLightController = _sunLightController;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void AddStar(StarController star)
|
|
||||||
{
|
|
||||||
if (star == null) return;
|
|
||||||
|
|
||||||
Logger.LogVerbose($"Adding new star to list: {star.gameObject.name}");
|
|
||||||
Instance._stars.Add(star);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void RemoveStar(StarController star)
|
|
||||||
{
|
|
||||||
Logger.LogVerbose($"Removing star from list: {star?.gameObject?.name}");
|
|
||||||
if (Instance._stars.Contains(star))
|
|
||||||
{
|
|
||||||
if (Instance._activeStar != null && Instance._activeStar.Equals(star))
|
|
||||||
{
|
|
||||||
Instance._stars.Remove(star);
|
|
||||||
if (Instance._stars.Count > 0) Instance.ChangeActiveStar(Instance._stars[0]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Instance._stars.Remove(star);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Update()
|
|
||||||
{
|
|
||||||
if (_activeStar == null || !_activeStar.gameObject.activeInHierarchy)
|
|
||||||
{
|
|
||||||
if (_stars.Contains(_activeStar)) _stars.Remove(_activeStar);
|
|
||||||
if (_stars.Count > 0) ChangeActiveStar(_stars[0]);
|
|
||||||
else gameObject.SetActive(false);
|
|
||||||
|
|
||||||
foreach (var (_, material) in AtmosphereBuilder.Skys)
|
|
||||||
{
|
|
||||||
material.SetFloat(SunIntensity, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update atmo shaders
|
|
||||||
foreach (var (planet, material) in AtmosphereBuilder.Skys)
|
|
||||||
{
|
|
||||||
var sqrDist = (planet.transform.position - _activeStar.transform.position).sqrMagnitude;
|
|
||||||
var intensity = Mathf.Min(_activeStar.Intensity / (sqrDist / hearthSunDistanceSqr), 1f);
|
|
||||||
|
|
||||||
material.SetFloat(SunIntensity, intensity);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var star in _stars)
|
|
||||||
{
|
|
||||||
if (star == null) continue;
|
|
||||||
if (!(star.gameObject.activeSelf && star.gameObject.activeInHierarchy)) continue;
|
|
||||||
|
|
||||||
// Player is always at 0,0,0 more or less so if they arent using the map camera then wtv
|
|
||||||
var origin = Vector3.zero;
|
|
||||||
if (PlayerState.InMapView())
|
|
||||||
{
|
|
||||||
origin = Locator.GetActiveCamera().transform.position;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (star.Intensity * (star.transform.position - origin).sqrMagnitude < _activeStar.Intensity * (_activeStar.transform.position - origin).sqrMagnitude)
|
|
||||||
{
|
|
||||||
ChangeActiveStar(star);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ChangeActiveStar(StarController star)
|
|
||||||
{
|
|
||||||
if (_sunLightController == null || _sunLightParamUpdater == null) return;
|
|
||||||
|
|
||||||
if (_activeStar != null) _activeStar.Disable();
|
|
||||||
|
|
||||||
Logger.LogVerbose($"Switching active star: {star.gameObject.name}");
|
|
||||||
|
|
||||||
_activeStar = star;
|
|
||||||
|
|
||||||
star.Enable();
|
|
||||||
|
|
||||||
_sunLightController._sunBaseColor = star.SunColor;
|
|
||||||
_sunLightController._sunBaseIntensity = star.Intensity;
|
|
||||||
_sunLightController._sunLight = star.Light;
|
|
||||||
_sunLightController._ambientLight = star.AmbientLight;
|
|
||||||
|
|
||||||
_sunLightParamUpdater.sunLight = star.Light;
|
|
||||||
_sunLightParamUpdater._sunController = star.transform.GetComponent<SunController>();
|
|
||||||
_sunLightParamUpdater._propID_SunPosition = Shader.PropertyToID("_SunPosition");
|
|
||||||
_sunLightParamUpdater._propID_OWSunPositionRange = Shader.PropertyToID("_OWSunPositionRange");
|
|
||||||
_sunLightParamUpdater._propID_OWSunColorIntensity = Shader.PropertyToID("_OWSunColorIntensity");
|
|
||||||
|
|
||||||
// For the param thing to work it wants this to be on the star idk
|
|
||||||
this.transform.parent = star.transform;
|
|
||||||
this.transform.localPosition = Vector3.zero;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,5 +1,5 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
namespace NewHorizons.Components
|
namespace NewHorizons.Components.Stars
|
||||||
{
|
{
|
||||||
public class StarController : MonoBehaviour
|
public class StarController : MonoBehaviour
|
||||||
{
|
{
|
||||||
@ -5,7 +5,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace NewHorizons.Components
|
namespace NewHorizons.Components.Stars
|
||||||
{
|
{
|
||||||
public class StarDestructionVolume : DestructionVolume
|
public class StarDestructionVolume : DestructionVolume
|
||||||
{
|
{
|
||||||
@ -1,6 +1,6 @@
|
|||||||
using NewHorizons.Components.SizeControllers;
|
using NewHorizons.Components.SizeControllers;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
namespace NewHorizons.Components
|
namespace NewHorizons.Components.Stars
|
||||||
{
|
{
|
||||||
public class StarFluidVolume : SimpleFluidVolume
|
public class StarFluidVolume : SimpleFluidVolume
|
||||||
{
|
{
|
||||||
@ -1,7 +1,7 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using NewHorizons.Components.SizeControllers;
|
using NewHorizons.Components.SizeControllers;
|
||||||
|
|
||||||
namespace NewHorizons.Components
|
namespace NewHorizons.Components.Stars
|
||||||
{
|
{
|
||||||
[RequireComponent(typeof(OWAudioSource))]
|
[RequireComponent(typeof(OWAudioSource))]
|
||||||
public class StarSurfaceAudioController : SectoredMonoBehaviour
|
public class StarSurfaceAudioController : SectoredMonoBehaviour
|
||||||
@ -34,7 +34,7 @@ namespace NewHorizons.Components
|
|||||||
public void Update()
|
public void Update()
|
||||||
{
|
{
|
||||||
_fade = Mathf.MoveTowards(_fade, 1, Time.deltaTime * 0.2f);
|
_fade = Mathf.MoveTowards(_fade, 1, Time.deltaTime * 0.2f);
|
||||||
float value = Mathf.Max(0.0f, Vector3.Distance(Locator.GetPlayerCamera().transform.position, this.transform.position) - (_starEvolutionController != null ? _starEvolutionController.CurrentScale : _size));
|
float value = Mathf.Max(0.0f, Vector3.Distance(Locator.GetPlayerCamera().transform.position, transform.position) - (_starEvolutionController != null ? _starEvolutionController.CurrentScale : _size));
|
||||||
float num = Mathf.InverseLerp(1600f, 100f, value);
|
float num = Mathf.InverseLerp(1600f, 100f, value);
|
||||||
_audioSource.SetLocalVolume(num * num * _fade);
|
_audioSource.SetLocalVolume(num * num * _fade);
|
||||||
}
|
}
|
||||||
@ -1,6 +1,6 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace NewHorizons.Components
|
namespace NewHorizons.Components.Stars
|
||||||
{
|
{
|
||||||
public class StellarDeathController : MonoBehaviour
|
public class StellarDeathController : MonoBehaviour
|
||||||
{
|
{
|
||||||
@ -22,6 +22,7 @@ namespace NewHorizons.Components
|
|||||||
private float _currentSupernovaScale;
|
private float _currentSupernovaScale;
|
||||||
private Material _localSupernovaMat;
|
private Material _localSupernovaMat;
|
||||||
private bool _isProxy;
|
private bool _isProxy;
|
||||||
|
private bool _renderingEnabled = true;
|
||||||
private ParticleSystemRenderer[] _cachedParticleRenderers;
|
private ParticleSystemRenderer[] _cachedParticleRenderers;
|
||||||
|
|
||||||
public void Awake()
|
public void Awake()
|
||||||
@ -34,8 +35,12 @@ namespace NewHorizons.Components
|
|||||||
public void Activate()
|
public void Activate()
|
||||||
{
|
{
|
||||||
enabled = true;
|
enabled = true;
|
||||||
shockwave.enabled = true;
|
shockwave.enabled = _renderingEnabled;
|
||||||
foreach (var particle in explosionParticles) particle.Play();
|
for (int i = 0; i < explosionParticles.Length; i++)
|
||||||
|
{
|
||||||
|
explosionParticles[i].Play();
|
||||||
|
_cachedParticleRenderers[i].enabled = _renderingEnabled;
|
||||||
|
}
|
||||||
_time = 0.0f;
|
_time = 0.0f;
|
||||||
_currentSupernovaScale = supernovaScale.Evaluate(0.0f);
|
_currentSupernovaScale = supernovaScale.Evaluate(0.0f);
|
||||||
_localSupernovaMat = new Material(supernovaMaterial);
|
_localSupernovaMat = new Material(supernovaMaterial);
|
||||||
@ -71,7 +76,7 @@ namespace NewHorizons.Components
|
|||||||
surface.transform.localScale = Vector3.one * _currentSupernovaScale;
|
surface.transform.localScale = Vector3.one * _currentSupernovaScale;
|
||||||
_localSupernovaMat.color = Color.Lerp(Color.black, supernovaMaterial.color, supernovaAlpha.Evaluate(_time));
|
_localSupernovaMat.color = Color.Lerp(Color.black, supernovaMaterial.color, supernovaAlpha.Evaluate(_time));
|
||||||
|
|
||||||
float distanceToPlayer = PlayerState.InDreamWorld() ? 20000f : (Vector3.Distance(transform.position, Locator.GetPlayerCamera().transform.position) - GetSupernovaRadius());
|
float distanceToPlayer = PlayerState.InDreamWorld() ? 20000f : Vector3.Distance(transform.position, Locator.GetPlayerCamera().transform.position) - GetSupernovaRadius();
|
||||||
|
|
||||||
if (_isProxy) return;
|
if (_isProxy) return;
|
||||||
|
|
||||||
@ -97,6 +102,7 @@ namespace NewHorizons.Components
|
|||||||
|
|
||||||
public void SetRenderingEnabled(bool renderingEnabled)
|
public void SetRenderingEnabled(bool renderingEnabled)
|
||||||
{
|
{
|
||||||
|
_renderingEnabled = renderingEnabled;
|
||||||
if (!enabled) return;
|
if (!enabled) return;
|
||||||
shockwave.enabled = renderingEnabled;
|
shockwave.enabled = renderingEnabled;
|
||||||
SetParticlesVisibility(renderingEnabled);
|
SetParticlesVisibility(renderingEnabled);
|
||||||
191
NewHorizons/Components/Stars/SunLightEffectsController.cs
Normal file
191
NewHorizons/Components/Stars/SunLightEffectsController.cs
Normal file
@ -0,0 +1,191 @@
|
|||||||
|
using NewHorizons.Builder.Atmosphere;
|
||||||
|
using NewHorizons.Utility;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using Logger = NewHorizons.Utility.Logger;
|
||||||
|
namespace NewHorizons.Components.Stars
|
||||||
|
{
|
||||||
|
[RequireComponent(typeof(SunLightController))]
|
||||||
|
[RequireComponent(typeof(SunLightParamUpdater))]
|
||||||
|
public class SunLightEffectsController : MonoBehaviour
|
||||||
|
{
|
||||||
|
private static readonly int SunIntensity = Shader.PropertyToID("_SunIntensity");
|
||||||
|
private static readonly float hearthSunDistanceSqr = 8593 * 8593;
|
||||||
|
|
||||||
|
public static SunLightEffectsController Instance { get; private set; }
|
||||||
|
|
||||||
|
private readonly List<StarController> _stars = new();
|
||||||
|
private readonly List<Light> _lights = new();
|
||||||
|
|
||||||
|
private StarController _activeStar;
|
||||||
|
private SunLightController _sunLightController;
|
||||||
|
private SunLightParamUpdater _sunLightParamUpdater;
|
||||||
|
|
||||||
|
public void Awake()
|
||||||
|
{
|
||||||
|
Instance = this;
|
||||||
|
|
||||||
|
_sunLightController = GetComponent<SunLightController>();
|
||||||
|
_sunLightController.enabled = true;
|
||||||
|
|
||||||
|
_sunLightParamUpdater = GetComponent<SunLightParamUpdater>();
|
||||||
|
_sunLightParamUpdater._sunLightController = _sunLightController;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Start()
|
||||||
|
{
|
||||||
|
// Using GameObject.Find here so that if its null we just dont find it
|
||||||
|
var sunlight = GameObject.Find("Sun_Body/Sector_SUN/Effects_SUN/SunLight").GetComponent<Light>();
|
||||||
|
if (sunlight != null) AddStarLight(sunlight);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AddStar(StarController star)
|
||||||
|
{
|
||||||
|
if (star == null) return;
|
||||||
|
|
||||||
|
Logger.LogVerbose($"Adding new star to list: {star.gameObject.name}");
|
||||||
|
Instance._stars.Add(star);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RemoveStar(StarController star)
|
||||||
|
{
|
||||||
|
Logger.LogVerbose($"Removing star from list: {star?.gameObject?.name}");
|
||||||
|
if (Instance._stars.Contains(star))
|
||||||
|
{
|
||||||
|
if (Instance._activeStar != null && Instance._activeStar.Equals(star))
|
||||||
|
{
|
||||||
|
Instance._stars.Remove(star);
|
||||||
|
if (Instance._stars.Count > 0) Instance.ChangeActiveStar(Instance._stars[0]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Instance._stars.Remove(star);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AddStarLight(Light light)
|
||||||
|
{
|
||||||
|
if (light != null)
|
||||||
|
{
|
||||||
|
Instance._lights.SafeAdd(light);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RemoveStarLight(Light light)
|
||||||
|
{
|
||||||
|
if (light != null && Instance._lights.Contains(light))
|
||||||
|
{
|
||||||
|
Instance._lights.Remove(light);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update()
|
||||||
|
{
|
||||||
|
// Player is always at 0,0,0 more or less so if they arent using the map camera then wtv
|
||||||
|
var origin = Vector3.zero;
|
||||||
|
|
||||||
|
if (PlayerState.InMapView())
|
||||||
|
{
|
||||||
|
origin = Locator.GetActiveCamera().transform.position;
|
||||||
|
|
||||||
|
// Keep all star lights on in map
|
||||||
|
foreach (var light in _lights)
|
||||||
|
{
|
||||||
|
light.enabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Outside map, only show lights within 50km range or light.range
|
||||||
|
// For some reason outside of the actual range of the lights they still show reflection effects on water and glass
|
||||||
|
foreach (var light in _lights)
|
||||||
|
{
|
||||||
|
// Minimum 50km range so it's not badly noticeable for dim stars
|
||||||
|
if ((light.transform.position - origin).sqrMagnitude <= Mathf.Max(light.range * light.range, 2500000000))
|
||||||
|
{
|
||||||
|
light.enabled = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
light.enabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_stars.Count > 0)
|
||||||
|
{
|
||||||
|
if (_activeStar == null || !_activeStar.gameObject.activeInHierarchy)
|
||||||
|
{
|
||||||
|
if (_stars.Contains(_activeStar))
|
||||||
|
{
|
||||||
|
_stars.Remove(_activeStar);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_stars.Count > 0)
|
||||||
|
{
|
||||||
|
ChangeActiveStar(_stars[0]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (var (_, material) in AtmosphereBuilder.Skys)
|
||||||
|
{
|
||||||
|
material.SetFloat(SunIntensity, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Update atmo shaders
|
||||||
|
foreach (var (planet, material) in AtmosphereBuilder.Skys)
|
||||||
|
{
|
||||||
|
var sqrDist = (planet.transform.position - _activeStar.transform.position).sqrMagnitude;
|
||||||
|
var intensity = Mathf.Min(_activeStar.Intensity / (sqrDist / hearthSunDistanceSqr), 1f);
|
||||||
|
|
||||||
|
material.SetFloat(SunIntensity, intensity);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var star in _stars)
|
||||||
|
{
|
||||||
|
if (star == null) continue;
|
||||||
|
if (!(star.gameObject.activeSelf && star.gameObject.activeInHierarchy)) continue;
|
||||||
|
|
||||||
|
if (star.Intensity * (star.transform.position - origin).sqrMagnitude < _activeStar.Intensity * (_activeStar.transform.position - origin).sqrMagnitude)
|
||||||
|
{
|
||||||
|
ChangeActiveStar(star);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ChangeActiveStar(StarController star)
|
||||||
|
{
|
||||||
|
if (_sunLightController == null || _sunLightParamUpdater == null) return;
|
||||||
|
|
||||||
|
if (_activeStar != null) _activeStar.Disable();
|
||||||
|
|
||||||
|
Logger.LogVerbose($"Switching active star: {star.gameObject.name}");
|
||||||
|
|
||||||
|
_activeStar = star;
|
||||||
|
|
||||||
|
star.Enable();
|
||||||
|
|
||||||
|
_sunLightController._sunBaseColor = star.SunColor;
|
||||||
|
_sunLightController._sunBaseIntensity = star.Intensity;
|
||||||
|
_sunLightController._sunLight = star.Light;
|
||||||
|
_sunLightController._ambientLight = star.AmbientLight;
|
||||||
|
|
||||||
|
_sunLightParamUpdater.sunLight = star.Light;
|
||||||
|
_sunLightParamUpdater._sunController = star.transform.GetComponent<SunController>();
|
||||||
|
_sunLightParamUpdater._propID_SunPosition = Shader.PropertyToID("_SunPosition");
|
||||||
|
_sunLightParamUpdater._propID_OWSunPositionRange = Shader.PropertyToID("_OWSunPositionRange");
|
||||||
|
_sunLightParamUpdater._propID_OWSunColorIntensity = Shader.PropertyToID("_OWSunColorIntensity");
|
||||||
|
|
||||||
|
// For the param thing to work it wants this to be on the star idk
|
||||||
|
transform.parent = star.transform;
|
||||||
|
transform.localPosition = Vector3.zero;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,6 +1,6 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace NewHorizons.Components
|
namespace NewHorizons.Components.Volumes
|
||||||
{
|
{
|
||||||
[RequireComponent(typeof(OWTriggerVolume))]
|
[RequireComponent(typeof(OWTriggerVolume))]
|
||||||
public abstract class BaseVolume : MonoBehaviour
|
public abstract class BaseVolume : MonoBehaviour
|
||||||
@ -1,6 +1,6 @@
|
|||||||
using NewHorizons.OtherMods.AchievementsPlus.NH;
|
using NewHorizons.OtherMods.AchievementsPlus.NH;
|
||||||
|
|
||||||
namespace NewHorizons.Components
|
namespace NewHorizons.Components.Volumes
|
||||||
{
|
{
|
||||||
public class BlackHoleDestructionVolume : DestructionVolume
|
public class BlackHoleDestructionVolume : DestructionVolume
|
||||||
{
|
{
|
||||||
@ -15,7 +15,7 @@ namespace NewHorizons.Components
|
|||||||
SurveyorProbe requiredComponent = probeBody.GetRequiredComponent<SurveyorProbe>();
|
SurveyorProbe requiredComponent = probeBody.GetRequiredComponent<SurveyorProbe>();
|
||||||
if (requiredComponent.IsLaunched())
|
if (requiredComponent.IsLaunched())
|
||||||
{
|
{
|
||||||
UnityEngine.Object.Destroy(requiredComponent.gameObject);
|
Destroy(requiredComponent.gameObject);
|
||||||
ProbeLostAchievement.Earn();
|
ProbeLostAchievement.Earn();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
namespace NewHorizons.Components
|
namespace NewHorizons.Components.Volumes
|
||||||
{
|
{
|
||||||
public class ChangeStarSystemVolume : BlackHoleDestructionVolume
|
public class ChangeStarSystemVolume : BlackHoleDestructionVolume
|
||||||
{
|
{
|
||||||
@ -6,7 +6,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace NewHorizons.Components
|
namespace NewHorizons.Components.Volumes
|
||||||
{
|
{
|
||||||
public class InterferenceVolume : BaseVolume
|
public class InterferenceVolume : BaseVolume
|
||||||
{
|
{
|
||||||
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace NewHorizons.Components
|
namespace NewHorizons.Components.Volumes
|
||||||
{
|
{
|
||||||
public class MapRestrictionVolume : BaseVolume
|
public class MapRestrictionVolume : BaseVolume
|
||||||
{
|
{
|
||||||
@ -1,5 +1,5 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
namespace NewHorizons.Components
|
namespace NewHorizons.Components.Volumes
|
||||||
{
|
{
|
||||||
public class NHFluidVolume : RadialFluidVolume
|
public class NHFluidVolume : RadialFluidVolume
|
||||||
{
|
{
|
||||||
@ -1,4 +1,4 @@
|
|||||||
namespace NewHorizons.Components
|
namespace NewHorizons.Components.Volumes
|
||||||
{
|
{
|
||||||
public class NHInnerFogWarpVolume : InnerFogWarpVolume
|
public class NHInnerFogWarpVolume : InnerFogWarpVolume
|
||||||
{
|
{
|
||||||
@ -5,7 +5,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace NewHorizons.Components
|
namespace NewHorizons.Components.Volumes
|
||||||
{
|
{
|
||||||
public class NotificationVolume : BaseVolume
|
public class NotificationVolume : BaseVolume
|
||||||
{
|
{
|
||||||
@ -16,7 +16,7 @@ namespace NewHorizons.Components
|
|||||||
|
|
||||||
public void SetPinned(bool pin) => _pin = pin;
|
public void SetPinned(bool pin) => _pin = pin;
|
||||||
|
|
||||||
public void SetTarget(External.Modules.VolumesModule.NotificationVolumeInfo.NotificationTarget target) => SetTarget(EnumUtils.Parse<NotificationTarget>(target.ToString(), NotificationTarget.All));
|
public void SetTarget(External.Modules.VolumesModule.NotificationVolumeInfo.NotificationTarget target) => SetTarget(EnumUtils.Parse(target.ToString(), NotificationTarget.All));
|
||||||
|
|
||||||
public void SetTarget(NotificationTarget target) => _target = target;
|
public void SetTarget(NotificationTarget target) => _target = target;
|
||||||
|
|
||||||
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace NewHorizons.Components
|
namespace NewHorizons.Components.Volumes
|
||||||
{
|
{
|
||||||
public class RingFluidVolume : SimpleFluidVolume
|
public class RingFluidVolume : SimpleFluidVolume
|
||||||
{
|
{
|
||||||
5
NewHorizons/External/Modules/PropModule.cs
vendored
5
NewHorizons/External/Modules/PropModule.cs
vendored
@ -140,6 +140,11 @@ namespace NewHorizons.External.Modules
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public float? maxHeight;
|
public float? maxHeight;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Should we try to prevent overlap between the scattered details? True by default. If it's affecting load times turn it off.
|
||||||
|
/// </summary>
|
||||||
|
[DefaultValue(true)] public bool preventOverlap = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Should this detail stay loaded even if you're outside the sector (good for very large props)
|
/// Should this detail stay loaded even if you're outside the sector (good for very large props)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace NewHorizons.Handlers
|
namespace NewHorizons.Handlers
|
||||||
{
|
{
|
||||||
using InterferenceVolume = NewHorizons.Components.InterferenceVolume;
|
using InterferenceVolume = Components.Volumes.InterferenceVolume;
|
||||||
|
|
||||||
public static class InterferenceHandler
|
public static class InterferenceHandler
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,8 +4,9 @@ using NewHorizons.Builder.General;
|
|||||||
using NewHorizons.Builder.Orbital;
|
using NewHorizons.Builder.Orbital;
|
||||||
using NewHorizons.Builder.Props;
|
using NewHorizons.Builder.Props;
|
||||||
using NewHorizons.Builder.Volumes;
|
using NewHorizons.Builder.Volumes;
|
||||||
using NewHorizons.Components;
|
|
||||||
using NewHorizons.Components.Orbital;
|
using NewHorizons.Components.Orbital;
|
||||||
|
using NewHorizons.Components.Quantum;
|
||||||
|
using NewHorizons.Components.Stars;
|
||||||
using NewHorizons.OtherMods.OWRichPresence;
|
using NewHorizons.OtherMods.OWRichPresence;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
using System;
|
using System;
|
||||||
@ -59,8 +60,9 @@ namespace NewHorizons.Handlers
|
|||||||
GameObject.Destroy(starLightGO.GetComponent<Light>());
|
GameObject.Destroy(starLightGO.GetComponent<Light>());
|
||||||
starLightGO.name = "StarLightController";
|
starLightGO.name = "StarLightController";
|
||||||
|
|
||||||
starLightGO.AddComponent<StarLightController>();
|
starLightGO.AddComponent<SunLightEffectsController>();
|
||||||
StarLightController.AddStar(starController);
|
SunLightEffectsController.AddStar(starController);
|
||||||
|
SunLightEffectsController.AddStarLight(starController.Light);
|
||||||
|
|
||||||
starLightGO.SetActive(true);
|
starLightGO.SetActive(true);
|
||||||
}
|
}
|
||||||
@ -514,7 +516,10 @@ namespace NewHorizons.Handlers
|
|||||||
{
|
{
|
||||||
var (star, starController, starEvolutionController) = StarBuilder.Make(go, sector, body.Config.Star, body.Mod, body.Config.isStellarRemnant);
|
var (star, starController, starEvolutionController) = StarBuilder.Make(go, sector, body.Config.Star, body.Mod, body.Config.isStellarRemnant);
|
||||||
|
|
||||||
if (starController != null) StarLightController.AddStar(starController);
|
if (starController != null) SunLightEffectsController.AddStar(starController);
|
||||||
|
|
||||||
|
var starLight = star.FindChild("SunLight");
|
||||||
|
if (starLight != null) SunLightEffectsController.AddStarLight(starLight.GetComponent<Light>());
|
||||||
|
|
||||||
// If it has an evolution controller that means it will die -> we make a remnant (unless its a remnant)
|
// If it has an evolution controller that means it will die -> we make a remnant (unless its a remnant)
|
||||||
if (starEvolutionController != null && !body.Config.isStellarRemnant)
|
if (starEvolutionController != null && !body.Config.isStellarRemnant)
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
using NewHorizons.Components;
|
using NewHorizons.Components.Stars;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
using OWML.Utils;
|
using OWML.Utils;
|
||||||
using System;
|
using System;
|
||||||
@ -141,7 +141,8 @@ namespace NewHorizons.Handlers
|
|||||||
break;
|
break;
|
||||||
case AstroObject.Name.Sun:
|
case AstroObject.Name.Sun:
|
||||||
var starController = ao.gameObject.GetComponent<StarController>();
|
var starController = ao.gameObject.GetComponent<StarController>();
|
||||||
StarLightController.RemoveStar(starController);
|
SunLightEffectsController.RemoveStar(starController);
|
||||||
|
SunLightEffectsController.RemoveStarLight(ao.transform.Find("Sector_SUN/Effects_SUN/SunLight").GetComponent<Light>());
|
||||||
GameObject.Destroy(starController);
|
GameObject.Destroy(starController);
|
||||||
|
|
||||||
var audio = ao.GetComponentInChildren<SunSurfaceAudioController>();
|
var audio = ao.GetComponentInChildren<SunSurfaceAudioController>();
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
using NewHorizons.Components;
|
using NewHorizons.Components.ShipLog;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
using NewHorizons.Components;
|
using NewHorizons.Components.ShipLog;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|||||||
@ -5,6 +5,7 @@ using NewHorizons.Builder.General;
|
|||||||
using NewHorizons.Builder.Props;
|
using NewHorizons.Builder.Props;
|
||||||
using NewHorizons.Components;
|
using NewHorizons.Components;
|
||||||
using NewHorizons.Components.Orbital;
|
using NewHorizons.Components.Orbital;
|
||||||
|
using NewHorizons.Components.Fixers;
|
||||||
using NewHorizons.Components.SizeControllers;
|
using NewHorizons.Components.SizeControllers;
|
||||||
using NewHorizons.External;
|
using NewHorizons.External;
|
||||||
using NewHorizons.External.Configs;
|
using NewHorizons.External.Configs;
|
||||||
@ -124,7 +125,7 @@ namespace NewHorizons
|
|||||||
_wasConfigured = true;
|
_wasConfigured = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ResetConfigs(bool resetTranslation = true)
|
public void ResetConfigs(bool resetTranslation = true)
|
||||||
{
|
{
|
||||||
BodyDict.Clear();
|
BodyDict.Clear();
|
||||||
SystemDict.Clear();
|
SystemDict.Clear();
|
||||||
@ -165,11 +166,15 @@ namespace NewHorizons
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!resetTranslation) return;
|
if (resetTranslation)
|
||||||
|
{
|
||||||
TranslationHandler.ClearTables();
|
TranslationHandler.ClearTables();
|
||||||
TextTranslation.Get().SetLanguage(TextTranslation.Get().GetLanguage());
|
TextTranslation.Get().SetLanguage(TextTranslation.Get().GetLanguage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LoadTranslations(Instance.ModHelper.Manifest.ModFolderPath + "Assets/", this);
|
||||||
|
}
|
||||||
|
|
||||||
public void Awake()
|
public void Awake()
|
||||||
{
|
{
|
||||||
Instance = this;
|
Instance = this;
|
||||||
@ -217,7 +222,6 @@ namespace NewHorizons
|
|||||||
OnStarSystemLoaded.AddListener(RichPresenceHandler.OnStarSystemLoaded);
|
OnStarSystemLoaded.AddListener(RichPresenceHandler.OnStarSystemLoaded);
|
||||||
OnChangeStarSystem.AddListener(RichPresenceHandler.OnChangeStarSystem);
|
OnChangeStarSystem.AddListener(RichPresenceHandler.OnChangeStarSystem);
|
||||||
|
|
||||||
LoadTranslations(ModHelper.Manifest.ModFolderPath + "Assets/", this);
|
|
||||||
LoadAddonManifest("Assets/addon-manifest.json", this);
|
LoadAddonManifest("Assets/addon-manifest.json", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -537,6 +541,7 @@ namespace NewHorizons
|
|||||||
|
|
||||||
var map = GameObject.FindObjectOfType<MapController>();
|
var map = GameObject.FindObjectOfType<MapController>();
|
||||||
if (map != null) map._maxPanDistance = FurthestOrbit * 1.5f;
|
if (map != null) map._maxPanDistance = FurthestOrbit * 1.5f;
|
||||||
|
|
||||||
// Fix the map satellite
|
// Fix the map satellite
|
||||||
SearchUtilities.Find("HearthianMapSatellite_Body", false).AddComponent<MapSatelliteOrbitFix>();
|
SearchUtilities.Find("HearthianMapSatellite_Body", false).AddComponent<MapSatelliteOrbitFix>();
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="HarmonyX" Version="2.10.0" />
|
<PackageReference Include="HarmonyX" Version="2.10.0" />
|
||||||
<PackageReference Include="OWML" Version="2.6.0" />
|
<PackageReference Include="OWML" Version="2.6.0" />
|
||||||
<PackageReference Include="OuterWildsGameLibs" Version="1.1.12.201" />
|
<PackageReference Include="OuterWildsGameLibs" Version="1.1.13.393" />
|
||||||
<Reference Include="../Lib/System.ComponentModel.Annotations.dll" />
|
<Reference Include="../Lib/System.ComponentModel.Annotations.dll" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@ -0,0 +1,27 @@
|
|||||||
|
using NewHorizons.OtherMods.MenuFramework;
|
||||||
|
using Logger = NewHorizons.Utility.Logger;
|
||||||
|
|
||||||
|
namespace NewHorizons.OtherMods.CommonCameraUtility
|
||||||
|
{
|
||||||
|
public static class CommonCameraHandler
|
||||||
|
{
|
||||||
|
private static ICommonCameraAPI _cameraAPI;
|
||||||
|
|
||||||
|
static CommonCameraHandler()
|
||||||
|
{
|
||||||
|
_cameraAPI = Main.Instance.ModHelper.Interaction.TryGetModApi<ICommonCameraAPI>("xen.CommonCameraUtility");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RegisterCustomCamera(OWCamera camera)
|
||||||
|
{
|
||||||
|
if (_cameraAPI != null)
|
||||||
|
{
|
||||||
|
_cameraAPI.RegisterCustomCamera(camera);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger.LogError("Tried to register custom camera but Common Camera Utility was missing.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Events;
|
||||||
|
|
||||||
|
namespace NewHorizons.OtherMods.CommonCameraUtility
|
||||||
|
{
|
||||||
|
public interface ICommonCameraAPI
|
||||||
|
{
|
||||||
|
void RegisterCustomCamera(OWCamera OWCamera);
|
||||||
|
(OWCamera, Camera) CreateCustomCamera(string name);
|
||||||
|
UnityEvent<PlayerTool> EquipTool();
|
||||||
|
UnityEvent<PlayerTool> UnequipTool();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -4,9 +4,7 @@ using NewHorizons.Utility;
|
|||||||
using OWML.Common;
|
using OWML.Common;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Mail;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using static UnityEngine.InputSystem.InputRemoting;
|
|
||||||
using Logger = NewHorizons.Utility.Logger;
|
using Logger = NewHorizons.Utility.Logger;
|
||||||
|
|
||||||
namespace NewHorizons.OtherMods.MenuFramework
|
namespace NewHorizons.OtherMods.MenuFramework
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
using NewHorizons.Components;
|
using NewHorizons.Components.ShipLog;
|
||||||
using NewHorizons.Handlers;
|
using NewHorizons.Handlers;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
using System;
|
using System;
|
||||||
|
|||||||
@ -0,0 +1,24 @@
|
|||||||
|
using HarmonyLib;
|
||||||
|
using NewHorizons.OtherMods.CommonCameraUtility;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace NewHorizons.Patches.CameraPatches
|
||||||
|
{
|
||||||
|
[HarmonyPatch]
|
||||||
|
public static class NomaiRemoteCameraPatches
|
||||||
|
{
|
||||||
|
[HarmonyPostfix]
|
||||||
|
[HarmonyPatch(typeof(NomaiRemoteCamera), nameof(NomaiRemoteCamera.Awake))]
|
||||||
|
public static void NomaiRemoteCamera_Awake(NomaiRemoteCamera __instance)
|
||||||
|
{
|
||||||
|
// Ensures that if the player is visible from the remote camera they look normal
|
||||||
|
CommonCameraHandler.RegisterCustomCamera(__instance._camera);
|
||||||
|
|
||||||
|
// These layers were left on because it doesnt come up in base game (Dreamworld is inactive, player is far away)
|
||||||
|
__instance._camera.mainCamera.cullingMask &= ~(1 << LayerMask.NameToLayer("DreamSimulation"));
|
||||||
|
__instance._camera.mainCamera.cullingMask &= ~(1 <<LayerMask.NameToLayer("UI"));
|
||||||
|
__instance._camera.mainCamera.cullingMask &= ~(1 <<LayerMask.NameToLayer("HeadsUpDisplay"));
|
||||||
|
__instance._camera.mainCamera.cullingMask &= ~(1 <<LayerMask.NameToLayer("HelmetUVPass"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,5 +1,6 @@
|
|||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
namespace NewHorizons.Patches
|
|
||||||
|
namespace NewHorizons.Patches.CameraPatches
|
||||||
{
|
{
|
||||||
[HarmonyPatch]
|
[HarmonyPatch]
|
||||||
public static class OWCameraPatch
|
public static class OWCameraPatch
|
||||||
@ -1,5 +1,5 @@
|
|||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using NewHorizons.Components;
|
using NewHorizons.Components.Quantum;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using NewHorizons.Components;
|
using NewHorizons.Components.Volumes;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
namespace NewHorizons.Patches
|
namespace NewHorizons.Patches
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using NewHorizons.OtherMods.AchievementsPlus;
|
using NewHorizons.OtherMods.AchievementsPlus;
|
||||||
using NewHorizons.Builder.ShipLog;
|
using NewHorizons.Builder.ShipLog;
|
||||||
using NewHorizons.Components;
|
|
||||||
using NewHorizons.Handlers;
|
using NewHorizons.Handlers;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
using System;
|
using System;
|
||||||
@ -10,6 +9,8 @@ using System.Linq;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Logger = NewHorizons.Utility.Logger;
|
using Logger = NewHorizons.Utility.Logger;
|
||||||
using Object = UnityEngine.Object;
|
using Object = UnityEngine.Object;
|
||||||
|
using NewHorizons.Components.ShipLog;
|
||||||
|
|
||||||
namespace NewHorizons.Patches
|
namespace NewHorizons.Patches
|
||||||
{
|
{
|
||||||
[HarmonyPatch]
|
[HarmonyPatch]
|
||||||
|
|||||||
@ -1395,6 +1395,11 @@
|
|||||||
"description": "The highest height that these objects will be placed at (only relevant if there's a heightmap)",
|
"description": "The highest height that these objects will be placed at (only relevant if there's a heightmap)",
|
||||||
"format": "float"
|
"format": "float"
|
||||||
},
|
},
|
||||||
|
"preventOverlap": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Should we try to prevent overlap between the scattered details? True by default. If it's affecting load times turn it off.",
|
||||||
|
"default": true
|
||||||
|
},
|
||||||
"keepLoaded": {
|
"keepLoaded": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "Should this detail stay loaded even if you're outside the sector (good for very large props)"
|
"description": "Should this detail stay loaded even if you're outside the sector (good for very large props)"
|
||||||
|
|||||||
@ -31,7 +31,7 @@ namespace NewHorizons.Utility.DebugUtilities
|
|||||||
{
|
{
|
||||||
Logger.Log("Begin reload of config files...");
|
Logger.Log("Begin reload of config files...");
|
||||||
|
|
||||||
Main.ResetConfigs();
|
Main.Instance.ResetConfigs();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
"uniqueName": "xen.NewHorizons",
|
"uniqueName": "xen.NewHorizons",
|
||||||
"version": "1.5.1",
|
"version": "1.5.1",
|
||||||
"owmlVersion": "2.6.0",
|
"owmlVersion": "2.6.0",
|
||||||
"dependencies": [ "JohnCorby.VanillaFix", "_nebula.MenuFramework" ],
|
"dependencies": [ "JohnCorby.VanillaFix", "_nebula.MenuFramework", "xen.CommonCameraUtility" ],
|
||||||
"conflicts": [ "Raicuparta.QuantumSpaceBuddies", "PacificEngine.OW_Randomizer" ],
|
"conflicts": [ "Raicuparta.QuantumSpaceBuddies", "PacificEngine.OW_Randomizer" ],
|
||||||
"pathsToPreserve": [ "planets", "systems", "translations" ]
|
"pathsToPreserve": [ "planets", "systems", "translations" ]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
</None>
|
</None>
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||||
<PackageReference Include="NJsonSchema" Version="10.7.2" />
|
<PackageReference Include="NJsonSchema" Version="10.7.2" />
|
||||||
<PackageReference Include="OuterWildsGameLibs" Version="1.1.12.201" IncludeAssets="compile" />
|
<PackageReference Include="OuterWildsGameLibs" Version="1.1.13.393" IncludeAssets="compile" />
|
||||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user