Organize + validate

This commit is contained in:
Nick 2022-05-17 19:41:45 -04:00
parent a475564db6
commit e1e630aaef
154 changed files with 629 additions and 1478 deletions

View File

@ -1,8 +1,5 @@
using NewHorizons.External; using NewHorizons.External.Modules;
using OWML.Utils;
using UnityEngine; using UnityEngine;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.Atmosphere namespace NewHorizons.Builder.Atmosphere
{ {
public static class AirBuilder public static class AirBuilder
@ -26,7 +23,7 @@ namespace NewHorizons.Builder.Atmosphere
SFV._allowShipAutoroll = true; SFV._allowShipAutoroll = true;
SFV._disableOnStart = false; SFV._disableOnStart = false;
if(info.HasOxygen) if (info.HasOxygen)
{ {
airGO.AddComponent<OxygenVolume>(); airGO.AddComponent<OxygenVolume>();
} }

View File

@ -1,7 +1,5 @@
using NewHorizons.External; using NewHorizons.External.Modules;
using UnityEngine; using UnityEngine;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.Atmosphere namespace NewHorizons.Builder.Atmosphere
{ {
public static class AtmosphereBuilder public static class AtmosphereBuilder
@ -18,11 +16,11 @@ namespace NewHorizons.Builder.Atmosphere
atmo.transform.parent = atmoGO.transform; atmo.transform.parent = atmoGO.transform;
atmo.transform.position = planetGO.transform.TransformPoint(Vector3.zero); atmo.transform.position = planetGO.transform.TransformPoint(Vector3.zero);
atmo.transform.localScale = Vector3.one * atmosphereModule.Size * 1.2f; atmo.transform.localScale = Vector3.one * atmosphereModule.Size * 1.2f;
foreach(var meshRenderer in atmo.GetComponentsInChildren<MeshRenderer>()) foreach (var meshRenderer in atmo.GetComponentsInChildren<MeshRenderer>())
{ {
meshRenderer.material.SetFloat("_InnerRadius", atmosphereModule.Cloud != null ? atmosphereModule.Size : surfaceSize); meshRenderer.material.SetFloat("_InnerRadius", atmosphereModule.Cloud != null ? atmosphereModule.Size : surfaceSize);
meshRenderer.material.SetFloat("_OuterRadius", atmosphereModule.Size * 1.2f); meshRenderer.material.SetFloat("_OuterRadius", atmosphereModule.Size * 1.2f);
if(atmosphereModule.AtmosphereTint != null) if (atmosphereModule.AtmosphereTint != null)
meshRenderer.material.SetColor("_SkyColor", atmosphereModule.AtmosphereTint.ToColor()); meshRenderer.material.SetColor("_SkyColor", atmosphereModule.AtmosphereTint.ToColor());
} }

View File

@ -1,11 +1,9 @@
using NewHorizons.External; using NewHorizons.External.Modules;
using NewHorizons.Utility; using NewHorizons.Utility;
using OWML.Common; using OWML.Common;
using OWML.Utils;
using System; using System;
using UnityEngine; using UnityEngine;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.Atmosphere namespace NewHorizons.Builder.Atmosphere
{ {
public static class CloudsBuilder public static class CloudsBuilder
@ -95,7 +93,7 @@ namespace NewHorizons.Builder.Atmosphere
// Fix the rotations once the rest is done // Fix the rotations once the rest is done
cloudsMainGO.transform.rotation = planetGO.transform.TransformRotation(Quaternion.Euler(0, 0, 0)); cloudsMainGO.transform.rotation = planetGO.transform.TransformRotation(Quaternion.Euler(0, 0, 0));
// For the base shader it has to be rotated idk // For the base shader it has to be rotated idk
if(atmo.UseBasicCloudShader) cloudsMainGO.transform.rotation = planetGO.transform.TransformRotation(Quaternion.Euler(90, 0, 0)); if (atmo.UseBasicCloudShader) cloudsMainGO.transform.rotation = planetGO.transform.TransformRotation(Quaternion.Euler(90, 0, 0));
cloudsMainGO.transform.position = planetGO.transform.TransformPoint(Vector3.zero); cloudsMainGO.transform.position = planetGO.transform.TransformPoint(Vector3.zero);
cloudsBottomGO.transform.position = planetGO.transform.TransformPoint(Vector3.zero); cloudsBottomGO.transform.position = planetGO.transform.TransformPoint(Vector3.zero);

View File

@ -1,9 +1,6 @@
using NewHorizons.External; using NewHorizons.External.Modules;
using NewHorizons.Utility; using NewHorizons.Utility;
using OWML.Utils;
using UnityEngine; using UnityEngine;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.Atmosphere namespace NewHorizons.Builder.Atmosphere
{ {
public static class EffectsBuilder public static class EffectsBuilder
@ -22,7 +19,7 @@ namespace NewHorizons.Builder.Atmosphere
SCG._dynamicCullingBounds = false; SCG._dynamicCullingBounds = false;
SCG._waitForStreaming = false; SCG._waitForStreaming = false;
if(info.IsRaining) if (info.IsRaining)
{ {
var rainGO = GameObject.Instantiate(SearchUtilities.CachedFind("/GiantsDeep_Body/Sector_GD/Sector_GDInterior/Effects_GDInterior/Effects_GD_Rain"), effectsGO.transform); var rainGO = GameObject.Instantiate(SearchUtilities.CachedFind("/GiantsDeep_Body/Sector_GD/Sector_GDInterior/Effects_GDInterior/Effects_GD_Rain"), effectsGO.transform);
rainGO.transform.position = planetGO.transform.position; rainGO.transform.position = planetGO.transform.position;
@ -40,12 +37,12 @@ namespace NewHorizons.Builder.Atmosphere
rainGO.SetActive(true); rainGO.SetActive(true);
} }
if(info.IsSnowing) if (info.IsSnowing)
{ {
var snowGO = new GameObject("SnowEffects"); var snowGO = new GameObject("SnowEffects");
snowGO.transform.parent = effectsGO.transform; snowGO.transform.parent = effectsGO.transform;
snowGO.transform.position = planetGO.transform.position; snowGO.transform.position = planetGO.transform.position;
for(int i = 0; i < 5; i++) for (int i = 0; i < 5; i++)
{ {
var snowEmitter = GameObject.Instantiate(SearchUtilities.CachedFind("/BrittleHollow_Body/Sector_BH/Effects_BH/Effects_BH_Snowflakes"), snowGO.transform); var snowEmitter = GameObject.Instantiate(SearchUtilities.CachedFind("/BrittleHollow_Body/Sector_BH/Effects_BH/Effects_BH_Snowflakes"), snowGO.transform);
snowEmitter.name = "SnowEmitter"; snowEmitter.name = "SnowEmitter";

View File

@ -1,13 +1,5 @@
using NewHorizons.External; using NewHorizons.External.Modules;
using OWML.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.Atmosphere namespace NewHorizons.Builder.Atmosphere
{ {
public static class FogBuilder public static class FogBuilder

View File

@ -1,8 +1,5 @@
using NewHorizons.External; using NewHorizons.External.Modules;
using OWML.Utils;
using UnityEngine; using UnityEngine;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.Atmosphere namespace NewHorizons.Builder.Atmosphere
{ {
public static class SunOverrideBuilder public static class SunOverrideBuilder

View File

@ -1,14 +1,10 @@
using NewHorizons.External; using NewHorizons.External.Configs;
using NewHorizons.External.Configs;
using OWML.Utils;
using UnityEngine; using UnityEngine;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.Atmosphere namespace NewHorizons.Builder.Atmosphere
{ {
public static class VolumesBuilder public static class VolumesBuilder
{ {
public static void Make(GameObject planetGO, IPlanetConfig config, float sphereOfInfluence) public static void Make(GameObject planetGO, PlanetConfig config, float sphereOfInfluence)
{ {
var innerRadius = config.Base.SurfaceSize; var innerRadius = config.Base.SurfaceSize;
var useMiniMap = config.Base.IsSatellite; var useMiniMap = config.Base.IsSatellite;

View File

@ -1,22 +1,15 @@
using NewHorizons.External; using NewHorizons.External.Configs;
using NewHorizons.External.Modules;
using NewHorizons.Handlers;
using NewHorizons.Utility; using NewHorizons.Utility;
using OWML.Common; using OWML.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using NewHorizons.External.Configs;
using Logger = NewHorizons.Utility.Logger;
using Random = UnityEngine.Random; using Random = UnityEngine.Random;
using NewHorizons.Handlers;
namespace NewHorizons.Builder.Body namespace NewHorizons.Builder.Body
{ {
public static class AsteroidBeltBuilder public static class AsteroidBeltBuilder
{ {
public static void Make(string bodyName, IPlanetConfig parentConfig, IModBehaviour mod) public static void Make(string bodyName, PlanetConfig parentConfig, IModBehaviour mod)
{ {
var belt = parentConfig.AsteroidBelt; var belt = parentConfig.AsteroidBelt;
@ -57,7 +50,7 @@ namespace NewHorizons.Builder.Body
}; };
config.ProcGen = belt.ProcGen; config.ProcGen = belt.ProcGen;
if(config.ProcGen == null) if (config.ProcGen == null)
{ {
config.ProcGen = new ProcGenModule() config.ProcGen = new ProcGenModule()
{ {

View File

@ -1,12 +1,6 @@
using NewHorizons.Components; using NewHorizons.Components;
using NewHorizons.Utility; using NewHorizons.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
namespace NewHorizons.Builder.Body namespace NewHorizons.Builder.Body
{ {
public static class CloakBuilder public static class CloakBuilder

View File

@ -1,18 +1,10 @@
using NewHorizons.External; using NewHorizons.External.Configs;
using NewHorizons.External.Configs;
using OWML.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
namespace NewHorizons.Builder.Body namespace NewHorizons.Builder.Body
{ {
public static class CometTailBuilder public static class CometTailBuilder
{ {
public static void Make(GameObject planetGO, Sector sector, IPlanetConfig config) public static void Make(GameObject planetGO, Sector sector, PlanetConfig config)
{ {
var cometTail = GameObject.Instantiate(GameObject.Find("Comet_Body/Sector_CO/Effects_CO/Effects_CO_TailMeshes"), sector?.transform ?? planetGO.transform); var cometTail = GameObject.Instantiate(GameObject.Find("Comet_Body/Sector_CO/Effects_CO/Effects_CO_TailMeshes"), sector?.transform ?? planetGO.transform);
cometTail.transform.position = planetGO.transform.position; cometTail.transform.position = planetGO.transform.position;

View File

@ -1,13 +1,8 @@
using NewHorizons.Components; using NewHorizons.Components;
using NewHorizons.External.VariableSize;
using NewHorizons.Utility; using NewHorizons.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
using NewHorizons.External.Modules.VariableSize;
namespace NewHorizons.Builder.Body namespace NewHorizons.Builder.Body
{ {
@ -76,7 +71,7 @@ namespace NewHorizons.Builder.Body
var waterMaterials = GameObject.Find("TimberHearth_Body/Sector_TH/Geometry_TH/Terrain_TH_Water_v3/Village_Upper_Water/Village_Upper_Water_Geo").GetComponent<MeshRenderer>().materials; var waterMaterials = GameObject.Find("TimberHearth_Body/Sector_TH/Geometry_TH/Terrain_TH_Water_v3/Village_Upper_Water/Village_Upper_Water_Geo").GetComponent<MeshRenderer>().materials;
var materials = new Material[waterMaterials.Length]; var materials = new Material[waterMaterials.Length];
for(int i = 0; i < waterMaterials.Length; i++) for (int i = 0; i < waterMaterials.Length; i++)
{ {
materials[i] = new Material(waterMaterials[i]); materials[i] = new Material(waterMaterials[i]);
if (module.Tint != null) if (module.Tint != null)
@ -126,7 +121,7 @@ namespace NewHorizons.Builder.Body
lavaMaterial.mainTextureOffset = new Vector2(0.1f, 0.2f); lavaMaterial.mainTextureOffset = new Vector2(0.1f, 0.2f);
lavaMaterial.mainTextureScale = new Vector2(1f, 3f); lavaMaterial.mainTextureScale = new Vector2(1f, 3f);
if(module.Tint != null) if (module.Tint != null)
{ {
lavaMaterial.SetColor("_EmissionColor", module.Tint.ToColor()); lavaMaterial.SetColor("_EmissionColor", module.Tint.ToColor());
} }
@ -158,7 +153,7 @@ namespace NewHorizons.Builder.Body
var funnelSizeController = funnelGO.AddComponent<FunnelController>(); var funnelSizeController = funnelGO.AddComponent<FunnelController>();
if(module.Curve != null) if (module.Curve != null)
{ {
var curve = new AnimationCurve(); var curve = new AnimationCurve();
foreach (var pair in module.Curve) foreach (var pair in module.Curve)
@ -177,7 +172,7 @@ namespace NewHorizons.Builder.Body
{ {
var targetAO = AstroObjectLocator.GetAstroObject(module.Target); var targetAO = AstroObjectLocator.GetAstroObject(module.Target);
var target = targetAO?.GetAttachedOWRigidbody(); var target = targetAO?.GetAttachedOWRigidbody();
if(target == null) if (target == null)
{ {
if (targetAO != null) Logger.LogError($"Found funnel target ({targetAO.name}) but couldn't find rigidbody for the funnel {funnelGO.name}"); if (targetAO != null) Logger.LogError($"Found funnel target ({targetAO.name}) but couldn't find rigidbody for the funnel {funnelGO.name}");
else Logger.LogError($"Couldn't find the target ({module.Target}) for the funnel {funnelGO.name}"); else Logger.LogError($"Couldn't find the target ({module.Target}) for the funnel {funnelGO.name}");

View File

@ -1,12 +1,6 @@
using NewHorizons.Utility; using NewHorizons.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.Body.Geometry namespace NewHorizons.Builder.Body.Geometry
{ {
static class CubeSphere static class CubeSphere
@ -14,7 +8,7 @@ namespace NewHorizons.Builder.Body.Geometry
public static Mesh Build(int resolution, Texture2D heightMap, float minHeight, float maxHeight, Vector3 stretch) public static Mesh Build(int resolution, Texture2D heightMap, float minHeight, float maxHeight, Vector3 stretch)
{ {
// It breaks if resolution is greater than 100 I don't know why // It breaks if resolution is greater than 100 I don't know why
if(resolution > 100) if (resolution > 100)
{ {
Logger.LogWarning($"Can't make CubeSphere's with resolution higher than 100 for some reason"); Logger.LogWarning($"Can't make CubeSphere's with resolution higher than 100 for some reason");
resolution = 100; resolution = 100;

View File

@ -1,11 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using Random = UnityEngine.Random; using Random = UnityEngine.Random;
namespace NewHorizons.Builder.Body.Geometry namespace NewHorizons.Builder.Body.Geometry
{ {
public static class Icosphere public static class Icosphere
@ -75,7 +71,7 @@ namespace NewHorizons.Builder.Body.Geometry
var randomOffset = new Vector3(Random.Range(0, 10f), Random.Range(0, 10f), Random.Range(0, 10f)); var randomOffset = new Vector3(Random.Range(0, 10f), Random.Range(0, 10f), Random.Range(0, 10f));
for(int i = 0; i < verticesToCopy.Length; i++) for (int i = 0; i < verticesToCopy.Length; i++)
{ {
var v = verticesToCopy[i]; var v = verticesToCopy[i];
@ -105,7 +101,7 @@ namespace NewHorizons.Builder.Body.Geometry
{ {
if (level < vertices.Count) return; if (level < vertices.Count) return;
for(int i = vertices.Count - 1; i < level; i++) for (int i = vertices.Count - 1; i < level; i++)
{ {
// Each triangle will be subdivided into 4 new ones // Each triangle will be subdivided into 4 new ones
int[] oldTriangles = triangles[i]; int[] oldTriangles = triangles[i];
@ -118,7 +114,7 @@ namespace NewHorizons.Builder.Body.Geometry
int v = oldVertices.Length; int v = oldVertices.Length;
int newTrianglesIndex = 0; int newTrianglesIndex = 0;
for(int j = 0; j < oldTriangles.Length; j+=3, v+=3) for (int j = 0; j < oldTriangles.Length; j += 3, v += 3)
{ {
// Old vertex indices // Old vertex indices
var v0Ind = oldTriangles[j]; var v0Ind = oldTriangles[j];

View File

@ -1,10 +1,4 @@
using System; using UnityEngine;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace NewHorizons.Builder.Body.Geometry namespace NewHorizons.Builder.Body.Geometry
{ {
// Perlin noise generator for Unity // Perlin noise generator for Unity

View File

@ -1,6 +1,4 @@
using UnityEngine; using UnityEngine;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.Body namespace NewHorizons.Builder.Body
{ {
public static class GeometryBuilder public static class GeometryBuilder

View File

@ -1,16 +1,10 @@
using NewHorizons.Builder.Body.Geometry; using NewHorizons.Builder.Body.Geometry;
using NewHorizons.Builder.Props; using NewHorizons.External.Modules;
using NewHorizons.External;
using NewHorizons.Utility; using NewHorizons.Utility;
using OWML.Common; using OWML.Common;
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.Body namespace NewHorizons.Builder.Body
{ {
public static class HeightMapBuilder public static class HeightMapBuilder
@ -27,7 +21,7 @@ namespace NewHorizons.Builder.Body
if (module.TextureMap == null) textureMap = Texture2D.whiteTexture; if (module.TextureMap == null) textureMap = Texture2D.whiteTexture;
else textureMap = ImageUtilities.GetTexture(mod, module.TextureMap); else textureMap = ImageUtilities.GetTexture(mod, module.TextureMap);
} }
catch(Exception e) catch (Exception e)
{ {
Logger.LogError($"Couldn't load HeightMap textures, {e.Message}, {e.StackTrace}"); Logger.LogError($"Couldn't load HeightMap textures, {e.Message}, {e.StackTrace}");
return; return;
@ -56,7 +50,7 @@ namespace NewHorizons.Builder.Body
var cubeSphereMC = cubeSphere.AddComponent<MeshCollider>(); var cubeSphereMC = cubeSphere.AddComponent<MeshCollider>();
cubeSphereMC.sharedMesh = mesh; cubeSphereMC.sharedMesh = mesh;
if(planetGO.GetComponent<ProxyShadowCasterSuperGroup>() != null) cubeSphere.AddComponent<ProxyShadowCaster>(); if (planetGO.GetComponent<ProxyShadowCasterSuperGroup>() != null) cubeSphere.AddComponent<ProxyShadowCaster>();
// Fix rotation in the end // Fix rotation in the end
cubeSphere.transform.rotation = planetGO.transform.TransformRotation(Quaternion.Euler(90, 0, 0)); cubeSphere.transform.rotation = planetGO.transform.TransformRotation(Quaternion.Euler(90, 0, 0));

View File

@ -1,12 +1,6 @@
using NewHorizons.External.VariableSize; using System.Collections.Generic;
using OWML.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using Logger = NewHorizons.Utility.Logger; using NewHorizons.External.Modules.VariableSize;
namespace NewHorizons.Builder.Body namespace NewHorizons.Builder.Body
{ {
@ -15,10 +9,10 @@ namespace NewHorizons.Builder.Body
public static void Make(GameObject planetGO, Sector sector, OWRigidbody rb, LavaModule module) public static void Make(GameObject planetGO, Sector sector, OWRigidbody rb, LavaModule module)
{ {
var heightScale = module.Size; var heightScale = module.Size;
if(module.Curve != null) if (module.Curve != null)
{ {
var modifier = 1f; var modifier = 1f;
foreach(var pair in module.Curve) foreach (var pair in module.Curve)
{ {
if (pair.Value < modifier) modifier = pair.Value; if (pair.Value < modifier) modifier = pair.Value;
} }
@ -35,7 +29,7 @@ namespace NewHorizons.Builder.Body
lavaSphere.transform.localScale = Vector3.one; lavaSphere.transform.localScale = Vector3.one;
lavaSphere.transform.name = "LavaSphere"; lavaSphere.transform.name = "LavaSphere";
lavaSphere.GetComponent<MeshRenderer>().material.SetFloat("_HeightScale", heightScale); lavaSphere.GetComponent<MeshRenderer>().material.SetFloat("_HeightScale", heightScale);
if(module.Tint != null) lavaSphere.GetComponent<MeshRenderer>().material.SetColor("_EmissionColor", module.Tint.ToColor()); if (module.Tint != null) lavaSphere.GetComponent<MeshRenderer>().material.SetColor("_EmissionColor", module.Tint.ToColor());
var sectorCullGroup = lavaSphere.GetComponent<SectorCullGroup>(); var sectorCullGroup = lavaSphere.GetComponent<SectorCullGroup>();
sectorCullGroup.SetSector(sector); sectorCullGroup.SetSector(sector);

View File

@ -1,13 +1,7 @@
using NewHorizons.Builder.Body.Geometry; using NewHorizons.Builder.Body.Geometry;
using NewHorizons.External; using NewHorizons.External.Modules;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using NewHorizons.Utility; using NewHorizons.Utility;
using UnityEngine;
namespace NewHorizons.Builder.Body namespace NewHorizons.Builder.Body
{ {
public static class ProcGenBuilder public static class ProcGenBuilder
@ -17,8 +11,8 @@ namespace NewHorizons.Builder.Body
public static void Make(GameObject planetGO, Sector sector, ProcGenModule module) public static void Make(GameObject planetGO, Sector sector, ProcGenModule module)
{ {
if(quantumMaterial == null) quantumMaterial = SearchUtilities.FindResourceOfTypeAndName<Material>("Rock_QM_EyeRock_mat"); if (quantumMaterial == null) quantumMaterial = SearchUtilities.FindResourceOfTypeAndName<Material>("Rock_QM_EyeRock_mat");
if(iceMaterial == null) iceMaterial = SearchUtilities.FindResourceOfTypeAndName<Material>("Rock_BH_IceSpike_mat"); if (iceMaterial == null) iceMaterial = SearchUtilities.FindResourceOfTypeAndName<Material>("Rock_BH_IceSpike_mat");
GameObject icosphere = new GameObject("Icosphere"); GameObject icosphere = new GameObject("Icosphere");

View File

@ -2,12 +2,11 @@
using NewHorizons.Builder.Props; using NewHorizons.Builder.Props;
using NewHorizons.Components; using NewHorizons.Components;
using NewHorizons.Components.SizeControllers; using NewHorizons.Components.SizeControllers;
using NewHorizons.External.VariableSize;
using NewHorizons.Utility; using NewHorizons.Utility;
using OWML.Common;
using System; using System;
using UnityEngine; using UnityEngine;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
using NewHorizons.External.Modules.VariableSize;
namespace NewHorizons.Builder.Body namespace NewHorizons.Builder.Body
{ {

View File

@ -1,16 +1,12 @@
using NewHorizons.External; using NewHorizons.Components;
using NewHorizons.Components.SizeControllers;
using NewHorizons.Utility;
using OWML.Common; using OWML.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using NewHorizons.Utility;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
using NewHorizons.External.VariableSize; using NewHorizons.External.Modules.VariableSize;
using NewHorizons.Components;
using NewHorizons.Components.SizeControllers;
namespace NewHorizons.Builder.Body namespace NewHorizons.Builder.Body
{ {

View File

@ -1,11 +1,6 @@
using NewHorizons.External.VariableSize; using NewHorizons.Utility;
using NewHorizons.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using NewHorizons.External.Modules.VariableSize;
namespace NewHorizons.Builder.Body namespace NewHorizons.Builder.Body
{ {

View File

@ -1,15 +1,9 @@
using NewHorizons.Components; using NewHorizons.Components;
using NewHorizons.External; using NewHorizons.External.Configs;
using NewHorizons.Utility; using NewHorizons.Utility;
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using NewHorizons.External.Configs;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.Body namespace NewHorizons.Builder.Body
{ {
public static class SingularityBuilder public static class SingularityBuilder
@ -23,18 +17,8 @@ namespace NewHorizons.Builder.Body
private static Shader blackHoleShader = null; private static Shader blackHoleShader = null;
private static Shader whiteHoleShader = null; private static Shader whiteHoleShader = null;
public static void Make(GameObject go, Sector sector, OWRigidbody OWRB, IPlanetConfig config) public static void Make(GameObject go, Sector sector, OWRigidbody OWRB, PlanetConfig config)
{ {
// Backwards compatibility
if(config.Singularity == null)
{
if(config.Base.BlackHoleSize != 0)
{
MakeBlackHole(go, sector, Vector3.zero, config.Base.BlackHoleSize, true, null);
}
return;
}
var size = config.Singularity.Size; var size = config.Singularity.Size;
var pairedSingularity = config.Singularity.PairedSingularity; var pairedSingularity = config.Singularity.PairedSingularity;
@ -63,10 +47,10 @@ namespace NewHorizons.Builder.Body
} }
// Try to pair them // Try to pair them
if(pairedSingularity != null && newSingularity != null) if (pairedSingularity != null && newSingularity != null)
{ {
var pairedSingularityAO = AstroObjectLocator.GetAstroObject(pairedSingularity); var pairedSingularityAO = AstroObjectLocator.GetAstroObject(pairedSingularity);
if(pairedSingularityAO != null) if (pairedSingularityAO != null)
{ {
switch (polarity) switch (polarity)
{ {
@ -117,7 +101,7 @@ namespace NewHorizons.Builder.Body
meshRenderer.material.SetFloat("_MassScale", 1); meshRenderer.material.SetFloat("_MassScale", 1);
meshRenderer.material.SetFloat("_DistortFadeDist", size * 0.55f); meshRenderer.material.SetFloat("_DistortFadeDist", size * 0.55f);
if(makeAudio) if (makeAudio)
{ {
var blackHoleAmbience = GameObject.Instantiate(GameObject.Find("BrittleHollow_Body/BlackHole_BH/BlackHoleAmbience"), blackHole.transform); var blackHoleAmbience = GameObject.Instantiate(GameObject.Find("BrittleHollow_Body/BlackHole_BH/BlackHoleAmbience"), blackHole.transform);
blackHoleAmbience.name = "BlackHoleAmbience"; blackHoleAmbience.name = "BlackHoleAmbience";
@ -222,7 +206,7 @@ namespace NewHorizons.Builder.Body
whiteHoleVolume.enabled = true; whiteHoleVolume.enabled = true;
whiteHoleFluidVolume.enabled = true; whiteHoleFluidVolume.enabled = true;
if(makeZeroGVolume) if (makeZeroGVolume)
{ {
var zeroGVolume = GameObject.Instantiate(GameObject.Find("WhiteHole_Body/ZeroGVolume"), whiteHole.transform); var zeroGVolume = GameObject.Instantiate(GameObject.Find("WhiteHole_Body/ZeroGVolume"), whiteHole.transform);
zeroGVolume.name = "ZeroGVolume"; zeroGVolume.name = "ZeroGVolume";

View File

@ -1,16 +1,9 @@
using NewHorizons.External; using NewHorizons.Components;
using OWML.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using NewHorizons.Utility;
using Logger = NewHorizons.Utility.Logger;
using NewHorizons.External.VariableSize;
using NewHorizons.Components;
using NewHorizons.Components.SizeControllers; using NewHorizons.Components.SizeControllers;
using NewHorizons.Utility;
using OWML.Utils;
using UnityEngine;
using NewHorizons.External.Modules.VariableSize;
namespace NewHorizons.Builder.Body namespace NewHorizons.Builder.Body
{ {

View File

@ -1,11 +1,8 @@
using NewHorizons.External; using NewHorizons.Components;
using NewHorizons.External.VariableSize;
using OWML.Utils;
using UnityEngine;
using NewHorizons.Utility;
using Logger = NewHorizons.Utility.Logger;
using NewHorizons.Components;
using NewHorizons.Components.SizeControllers; using NewHorizons.Components.SizeControllers;
using NewHorizons.Utility;
using UnityEngine;
using NewHorizons.External.Modules.VariableSize;
namespace NewHorizons.Builder.Body namespace NewHorizons.Builder.Body
{ {
@ -34,7 +31,7 @@ namespace NewHorizons.Builder.Body
var GDSharedMaterials = GameObject.Find("Ocean_GD").GetComponent<TessellatedSphereLOD>()._lowAltitudeMaterials; var GDSharedMaterials = GameObject.Find("Ocean_GD").GetComponent<TessellatedSphereLOD>()._lowAltitudeMaterials;
var tempArray = new Material[GDSharedMaterials.Length]; var tempArray = new Material[GDSharedMaterials.Length];
for(int i = 0; i < GDSharedMaterials.Length; i++) for (int i = 0; i < GDSharedMaterials.Length; i++)
{ {
tempArray[i] = new Material(GDSharedMaterials[i]); tempArray[i] = new Material(GDSharedMaterials[i]);
if (module.Tint != null) if (module.Tint != null)
@ -104,7 +101,7 @@ namespace NewHorizons.Builder.Body
else else
{ {
fogGO.GetComponent<MeshRenderer>().material.SetFloat("_Radius", module.Size); fogGO.GetComponent<MeshRenderer>().material.SetFloat("_Radius", module.Size);
fogGO.GetComponent<MeshRenderer>().material.SetFloat("_Radius2", module.Size/2f); fogGO.GetComponent<MeshRenderer>().material.SetFloat("_Radius2", module.Size / 2f);
} }
// TODO: make LOD work // TODO: make LOD work

View File

@ -1,9 +1,4 @@
using NewHorizons.External; using UnityEngine;
using NewHorizons.Utility;
using OWML.Utils;
using UnityEngine;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.General namespace NewHorizons.Builder.General
{ {
public static class AmbientLightBuilder public static class AmbientLightBuilder

View File

@ -1,17 +1,12 @@
using NewHorizons.External; using NewHorizons.Components.Orbital;
using NewHorizons.Utility;
using OWML.Utils;
using System;
using UnityEngine;
using NewHorizons.External.Configs; using NewHorizons.External.Configs;
using UnityEngine;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
using NewHorizons.Components.Orbital;
namespace NewHorizons.Builder.General namespace NewHorizons.Builder.General
{ {
public static class AstroObjectBuilder public static class AstroObjectBuilder
{ {
public static NHAstroObject Make(GameObject body, AstroObject primaryBody, IPlanetConfig config) public static NHAstroObject Make(GameObject body, AstroObject primaryBody, PlanetConfig config)
{ {
NHAstroObject astroObject = body.AddComponent<NHAstroObject>(); NHAstroObject astroObject = body.AddComponent<NHAstroObject>();
astroObject.HideDisplayName = !config.Base.HasMapMarker; astroObject.HideDisplayName = !config.Base.HasMapMarker;
@ -42,7 +37,7 @@ namespace NewHorizons.Builder.General
var alignment = body.AddComponent<AlignWithTargetBody>(); var alignment = body.AddComponent<AlignWithTargetBody>();
alignment.SetTargetBody(primaryBody?.GetAttachedOWRigidbody()); alignment.SetTargetBody(primaryBody?.GetAttachedOWRigidbody());
alignment._usePhysicsToRotate = true; alignment._usePhysicsToRotate = true;
if(config.Orbit.AlignmentAxis == null) if (config.Orbit.AlignmentAxis == null)
{ {
alignment._localAlignmentAxis = new Vector3(0, -1, 0); alignment._localAlignmentAxis = new Vector3(0, -1, 0);
} }

View File

@ -1,20 +1,12 @@
using NewHorizons.Builder.Orbital; using NewHorizons.Components.Orbital;
using NewHorizons.External;
using NewHorizons.Components.Orbital;
using OWML.Utils;
using System;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
using NewHorizons.Utility;
using Logger = NewHorizons.Utility.Logger;
using NewHorizons.External.Configs; using NewHorizons.External.Configs;
using UnityEngine;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.General namespace NewHorizons.Builder.General
{ {
public static class DetectorBuilder public static class DetectorBuilder
{ {
public static GameObject Make(GameObject planetGO, OWRigidbody OWRB, AstroObject primaryBody, AstroObject astroObject, IPlanetConfig config) public static GameObject Make(GameObject planetGO, OWRigidbody OWRB, AstroObject primaryBody, AstroObject astroObject, PlanetConfig config)
{ {
GameObject detectorGO = new GameObject("FieldDetector"); GameObject detectorGO = new GameObject("FieldDetector");
detectorGO.SetActive(false); detectorGO.SetActive(false);
@ -27,7 +19,7 @@ namespace NewHorizons.Builder.General
OWRB.RegisterAttachedForceDetector(forceDetector); OWRB.RegisterAttachedForceDetector(forceDetector);
// For falling into sun // For falling into sun
if(!config.Base.InvulnerableToSun && config.Star == null && config.FocalPoint == null) if (!config.Base.InvulnerableToSun && config.Star == null && config.FocalPoint == null)
{ {
detectorGO.layer = LayerMask.NameToLayer("AdvancedDetector"); detectorGO.layer = LayerMask.NameToLayer("AdvancedDetector");

View File

@ -1,17 +1,11 @@
using NewHorizons.External; using NewHorizons.External.Configs;
using NewHorizons.Utility;
using OWML.Utils;
using System;
using System.Reflection;
using UnityEngine; using UnityEngine;
using NewHorizons.External.Configs;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.General namespace NewHorizons.Builder.General
{ {
public static class GravityBuilder public static class GravityBuilder
{ {
public static GravityVolume Make(GameObject planetGO, AstroObject ao, IPlanetConfig config) public static GravityVolume Make(GameObject planetGO, AstroObject ao, PlanetConfig config)
{ {
var exponent = config.Base.GravityFallOff.Equals("linear") ? 1f : 2f; var exponent = config.Base.GravityFallOff.Equals("linear") ? 1f : 2f;
var GM = config.Base.SurfaceGravity * Mathf.Pow(config.Base.SurfaceSize, exponent); var GM = config.Base.SurfaceGravity * Mathf.Pow(config.Base.SurfaceSize, exponent);

View File

@ -1,16 +1,11 @@
using NewHorizons.External; using NewHorizons.External.Configs;
using OWML.Utils;
using System.Reflection;
using UnityEngine;
using NewHorizons.External.Configs;
using Logger = NewHorizons.Utility.Logger;
using NewHorizons.Handlers; using NewHorizons.Handlers;
using UnityEngine;
namespace NewHorizons.Builder.General namespace NewHorizons.Builder.General
{ {
static class MarkerBuilder static class MarkerBuilder
{ {
public static void Make(GameObject body, string name, IPlanetConfig config) public static void Make(GameObject body, string name, PlanetConfig config)
{ {
MapMarker mapMarker = body.AddComponent<MapMarker>(); MapMarker mapMarker = body.AddComponent<MapMarker>();
mapMarker._labelID = (UITextType)TranslationHandler.AddUI(config.Name); mapMarker._labelID = (UITextType)TranslationHandler.AddUI(config.Name);
@ -29,7 +24,7 @@ namespace NewHorizons.Builder.General
{ {
markerType = MapMarker.MarkerType.HourglassTwins; markerType = MapMarker.MarkerType.HourglassTwins;
} }
else if(config.Base.IsSatellite) else if (config.Base.IsSatellite)
{ {
markerType = MapMarker.MarkerType.Probe; markerType = MapMarker.MarkerType.Probe;
} }

View File

@ -1,8 +1,4 @@
using NewHorizons.External; using UnityEngine;
using OWML.Utils;
using UnityEngine;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.General namespace NewHorizons.Builder.General
{ {
public static class RFVolumeBuilder public static class RFVolumeBuilder

View File

@ -1,16 +1,10 @@
using NewHorizons.External.Configs; using NewHorizons.External.Configs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
namespace NewHorizons.Builder.General namespace NewHorizons.Builder.General
{ {
public static class RigidBodyBuilder public static class RigidBodyBuilder
{ {
public static OWRigidbody Make(GameObject body, IPlanetConfig config) public static OWRigidbody Make(GameObject body, PlanetConfig config)
{ {
body.AddComponent<ProxyShadowCasterSuperGroup>(); body.AddComponent<ProxyShadowCasterSuperGroup>();

View File

@ -1,9 +1,5 @@
using NewHorizons.External; using System.Collections.Generic;
using OWML.Utils;
using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.General namespace NewHorizons.Builder.General
{ {
public static class MakeSector public static class MakeSector

View File

@ -1,10 +1,6 @@
using NewHorizons.External; using NewHorizons.External.Modules;
using OWML.Utils;
using System;
using UnityEngine; using UnityEngine;
using NewHorizons.Utility;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.General namespace NewHorizons.Builder.General
{ {
public static class SpawnPointBuilder public static class SpawnPointBuilder
@ -13,7 +9,7 @@ namespace NewHorizons.Builder.General
public static SpawnPoint Make(GameObject planetGO, SpawnModule module, OWRigidbody owRigidBody) public static SpawnPoint Make(GameObject planetGO, SpawnModule module, OWRigidbody owRigidBody)
{ {
SpawnPoint playerSpawn = null; SpawnPoint playerSpawn = null;
if(!Main.Instance.IsWarping && module.PlayerSpawnPoint != null) if (!Main.Instance.IsWarping && module.PlayerSpawnPoint != null)
{ {
GameObject spawnGO = new GameObject("PlayerSpawnPoint"); GameObject spawnGO = new GameObject("PlayerSpawnPoint");
spawnGO.transform.parent = planetGO.transform; spawnGO.transform.parent = planetGO.transform;
@ -25,7 +21,7 @@ namespace NewHorizons.Builder.General
spawnGO.transform.rotation = Quaternion.FromToRotation(Vector3.up, (playerSpawn.transform.position - planetGO.transform.position).normalized); spawnGO.transform.rotation = Quaternion.FromToRotation(Vector3.up, (playerSpawn.transform.position - planetGO.transform.position).normalized);
spawnGO.transform.position = spawnGO.transform.position + spawnGO.transform.TransformDirection(Vector3.up) * 4f; spawnGO.transform.position = spawnGO.transform.position + spawnGO.transform.TransformDirection(Vector3.up) * 4f;
} }
if(module.ShipSpawnPoint != null) if (module.ShipSpawnPoint != null)
{ {
GameObject spawnGO = new GameObject("ShipSpawnPoint"); GameObject spawnGO = new GameObject("ShipSpawnPoint");
spawnGO.transform.parent = planetGO.transform; spawnGO.transform.parent = planetGO.transform;
@ -44,7 +40,7 @@ namespace NewHorizons.Builder.General
ship.GetRequiredComponent<MatchInitialMotion>().SetBodyToMatch(owRigidBody); ship.GetRequiredComponent<MatchInitialMotion>().SetBodyToMatch(owRigidBody);
if(Main.Instance.IsWarping) if (Main.Instance.IsWarping)
{ {
Logger.Log("Overriding player spawn to be inside ship"); Logger.Log("Overriding player spawn to be inside ship");
GameObject playerSpawnGO = new GameObject("PlayerSpawnPoint"); GameObject playerSpawnGO = new GameObject("PlayerSpawnPoint");
@ -54,10 +50,10 @@ namespace NewHorizons.Builder.General
playerSpawnGO.transform.localPosition = new Vector3(0, 0, 0); playerSpawnGO.transform.localPosition = new Vector3(0, 0, 0);
playerSpawn = playerSpawnGO.AddComponent<SpawnPoint>(); playerSpawn = playerSpawnGO.AddComponent<SpawnPoint>();
playerSpawnGO.transform.localRotation = Quaternion.Euler(0,0,0); playerSpawnGO.transform.localRotation = Quaternion.Euler(0, 0, 0);
} }
} }
if(!Main.Instance.IsWarping && module.StartWithSuit && !suitUpQueued) if (!Main.Instance.IsWarping && module.StartWithSuit && !suitUpQueued)
{ {
suitUpQueued = true; suitUpQueued = true;
Main.Instance.ModHelper.Events.Unity.RunWhen(() => Main.IsSystemReady, () => SuitUp()); Main.Instance.ModHelper.Events.Unity.RunWhen(() => Main.IsSystemReady, () => SuitUp());

View File

@ -1,23 +1,16 @@
using NewHorizons.Builder.General; using NewHorizons.Components.Orbital;
using NewHorizons.Components.Orbital;
using NewHorizons.External;
using NewHorizons.External.Configs; using NewHorizons.External.Configs;
using NewHorizons.External.Modules;
using NewHorizons.Handlers; using NewHorizons.Handlers;
using NewHorizons.Utility; using NewHorizons.Utility;
using OWML.Common; using OWML.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.Orbital namespace NewHorizons.Builder.Orbital
{ {
public static class FocalPointBuilder public static class FocalPointBuilder
{ {
public static void Make(GameObject go, AstroObject ao, IPlanetConfig config, IModBehaviour mod) public static void Make(GameObject go, AstroObject ao, PlanetConfig config, IModBehaviour mod)
{ {
var module = config.FocalPoint; var module = config.FocalPoint;
@ -30,23 +23,23 @@ namespace NewHorizons.Builder.Orbital
// Grab the bodies from the main dictionary // Grab the bodies from the main dictionary
NewHorizonsBody primary = null; NewHorizonsBody primary = null;
NewHorizonsBody secondary = null; NewHorizonsBody secondary = null;
foreach(var body in Main.BodyDict[Main.Instance.CurrentStarSystem]) foreach (var body in Main.BodyDict[Main.Instance.CurrentStarSystem])
{ {
if(body.Config.Name == module.Primary) if (body.Config.Name == module.Primary)
{ {
primary = body; primary = body;
} }
else if(body.Config.Name == module.Secondary) else if (body.Config.Name == module.Secondary)
{ {
secondary = body; secondary = body;
} }
if(primary != null && secondary != null) if (primary != null && secondary != null)
{ {
break; break;
} }
} }
if(primary == null || secondary == null) if (primary == null || secondary == null)
{ {
Logger.LogError($"Couldn't make focal point between [{module.Primary} = {primary}] and [{module.Secondary} = {secondary}]"); Logger.LogError($"Couldn't make focal point between [{module.Primary} = {primary}] and [{module.Secondary} = {secondary}]");
return; return;
@ -74,7 +67,7 @@ namespace NewHorizons.Builder.Orbital
binary.FakeMassBody = PlanetCreationHandler.GenerateBody(new NewHorizonsBody(fakeMassConfig, mod)); binary.FakeMassBody = PlanetCreationHandler.GenerateBody(new NewHorizonsBody(fakeMassConfig, mod));
} }
private static float GetGravitationalMass(IPlanetConfig config) private static float GetGravitationalMass(PlanetConfig config)
{ {
var surfaceAcceleration = config.Base.SurfaceGravity; var surfaceAcceleration = config.Base.SurfaceGravity;
var upperSurfaceRadius = config.Base.SurfaceSize; var upperSurfaceRadius = config.Base.SurfaceSize;

View File

@ -1,16 +1,7 @@
using NewHorizons.External; using NewHorizons.Components.Orbital;
using OWML.Utils; using NewHorizons.External.Modules;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
using System.Reflection;
using NewHorizons.Utility;
using NewHorizons.Components.Orbital;
namespace NewHorizons.Builder.Orbital namespace NewHorizons.Builder.Orbital
{ {
public static class InitialMotionBuilder public static class InitialMotionBuilder

View File

@ -1,17 +1,11 @@
using NewHorizons.External; using NewHorizons.Components.Orbital;
using NewHorizons.Utility;
using OWML.Utils;
using UnityEngine;
using NewHorizons.External.Configs; using NewHorizons.External.Configs;
using Logger = NewHorizons.Utility.Logger; using UnityEngine;
using NewHorizons.Components.Orbital;
using System;
namespace NewHorizons.Builder.Orbital namespace NewHorizons.Builder.Orbital
{ {
public static class OrbitlineBuilder public static class OrbitlineBuilder
{ {
public static OrbitLine Make(GameObject planetGO, NHAstroObject astroObject, bool isMoon, IPlanetConfig config) public static OrbitLine Make(GameObject planetGO, NHAstroObject astroObject, bool isMoon, PlanetConfig config)
{ {
GameObject orbitGO = new GameObject("Orbit"); GameObject orbitGO = new GameObject("Orbit");
orbitGO.transform.parent = planetGO.transform; orbitGO.transform.parent = planetGO.transform;
@ -36,7 +30,7 @@ namespace NewHorizons.Builder.Orbital
var parentGravity = astroObject.GetPrimaryBody()?.GetGravityVolume(); var parentGravity = astroObject.GetPrimaryBody()?.GetGravityVolume();
OrbitLine orbitLine; OrbitLine orbitLine;
if(config.Orbit.TrackingOrbitLine || (new Gravity(parentGravity).Power == 1 && ecc != 0)) if (config.Orbit.TrackingOrbitLine || (new Gravity(parentGravity).Power == 1 && ecc != 0))
{ {
orbitLine = orbitGO.AddComponent<TrackingOrbitLine>(); orbitLine = orbitGO.AddComponent<TrackingOrbitLine>();
} }
@ -67,7 +61,7 @@ namespace NewHorizons.Builder.Orbital
var fade = isMoon; var fade = isMoon;
if (config.Base.IsSatellite) if (config.Base.IsSatellite)
{ {
if(config.Orbit.Tint != null) color = new Color(0.4082f, 0.516f, 0.4469f, 1f); if (config.Orbit.Tint != null) color = new Color(0.4082f, 0.516f, 0.4469f, 1f);
fade = true; fade = true;
orbitLine._fadeEndDist = 5000; orbitLine._fadeEndDist = 5000;
orbitLine._fadeStartDist = 3000; orbitLine._fadeStartDist = 3000;

View File

@ -1,22 +1,18 @@
using NewHorizons.Utility; using NewHorizons.External.Configs;
using NewHorizons.External.Modules;
using NewHorizons.Handlers;
using NewHorizons.Utility;
using OWML.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using Random = UnityEngine.Random;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
using NewHorizons.External;
using OWML.Common;
using NewHorizons.External.Configs;
using NewHorizons.Handlers;
namespace NewHorizons.Builder.Props namespace NewHorizons.Builder.Props
{ {
public static class DetailBuilder public static class DetailBuilder
{ {
public static void Make(GameObject go, Sector sector, IPlanetConfig config, IModBehaviour mod, string uniqueModName, PropModule.DetailInfo detail) public static void Make(GameObject go, Sector sector, PlanetConfig config, IModBehaviour mod, string uniqueModName, PropModule.DetailInfo detail)
{ {
GameObject detailGO = null; GameObject detailGO = null;
@ -185,7 +181,7 @@ namespace NewHorizons.Builder.Props
angler.OnChangeAnglerState(AnglerfishController.AnglerState.Lurking); angler.OnChangeAnglerState(AnglerfishController.AnglerState.Lurking);
} }
} }
catch(Exception e) catch (Exception e)
{ {
Logger.LogWarning($"Exception when modifying component [{component.GetType().Name}] on [{planetGO.name}] : {e.Message}, {e.StackTrace}"); Logger.LogWarning($"Exception when modifying component [{component.GetType().Name}] on [{planetGO.name}] : {e.Message}, {e.StackTrace}");
} }

View File

@ -1,15 +1,8 @@
using NewHorizons.External; using NewHorizons.External.Modules;
using NewHorizons.Handlers; using NewHorizons.Handlers;
using OWML.Common; using OWML.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml; using System.Xml;
using UnityEngine; using UnityEngine;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.Props namespace NewHorizons.Builder.Props
{ {
public static class DialogueBuilder public static class DialogueBuilder
@ -72,7 +65,7 @@ namespace NewHorizons.Builder.Props
var owCollider = conversationZone.AddComponent<OWCollider>(); var owCollider = conversationZone.AddComponent<OWCollider>();
var interact = conversationZone.AddComponent<InteractReceiver>(); var interact = conversationZone.AddComponent<InteractReceiver>();
if(info.radius <= 0) if (info.radius <= 0)
{ {
sphere.enabled = false; sphere.enabled = false;
owCollider.enabled = false; owCollider.enabled = false;
@ -110,7 +103,7 @@ namespace NewHorizons.Builder.Props
controller._dialogueTree = dialogue; controller._dialogueTree = dialogue;
controller.lookOnlyWhenTalking = lookOnlyWhenTalking; controller.lookOnlyWhenTalking = lookOnlyWhenTalking;
} }
else if(nomaiController != null) else if (nomaiController != null)
{ {
if (lookOnlyWhenTalking) if (lookOnlyWhenTalking)
{ {
@ -153,7 +146,7 @@ namespace NewHorizons.Builder.Props
triggerVolume.OnExit += controller.OnZoneExit; triggerVolume.OnExit += controller.OnZoneExit;
} }
// Simpler for the Nomai // Simpler for the Nomai
else if(nomaiController) else if (nomaiController)
{ {
triggerVolume.OnEntry += (_) => nomaiController.StartWatchingPlayer(); triggerVolume.OnEntry += (_) => nomaiController.StartWatchingPlayer();
triggerVolume.OnExit += (_) => nomaiController.StopWatchingPlayer(); triggerVolume.OnExit += (_) => nomaiController.StopWatchingPlayer();

View File

@ -1,12 +1,6 @@
using NewHorizons.External; using NewHorizons.External.Modules;
using NewHorizons.Utility; using NewHorizons.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
namespace NewHorizons.Builder.Props namespace NewHorizons.Builder.Props
{ {
public static class GeyserBuilder public static class GeyserBuilder

View File

@ -1,17 +1,13 @@
using NewHorizons.External; using NewHorizons.External.Modules;
using NewHorizons.Handlers; using NewHorizons.Handlers;
using NewHorizons.Utility; using NewHorizons.Utility;
using OWML.Common; using OWML.Common;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml; using System.Xml;
using UnityEngine; using UnityEngine;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
using Random = UnityEngine.Random; using Random = UnityEngine.Random;
namespace NewHorizons.Builder.Props namespace NewHorizons.Builder.Props
{ {
public static class NomaiTextBuilder public static class NomaiTextBuilder

View File

@ -1,16 +1,11 @@
using NewHorizons.External; using NewHorizons.External.Modules;
using NewHorizons.Handlers;
using NewHorizons.Utility;
using OWML.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using NewHorizons.Utility;
using OWML.ModHelper;
using OWML.Common;
using NewHorizons.Handlers;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.Props namespace NewHorizons.Builder.Props
{ {
public static class ProjectionBuilder public static class ProjectionBuilder

View File

@ -1,25 +1,14 @@
using NewHorizons.External; using NewHorizons.Builder.ShipLog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using Random = UnityEngine.Random;
using Logger = NewHorizons.Utility.Logger;
using System.Reflection;
using NewHorizons.Builder.General;
using NewHorizons.Utility;
using OWML.Common;
using NewHorizons.Builder.ShipLog;
using NewHorizons.External.Configs; using NewHorizons.External.Configs;
using System.IO; using OWML.Common;
using System;
using UnityEngine;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.Props namespace NewHorizons.Builder.Props
{ {
public static class PropBuildManager public static class PropBuildManager
{ {
public static void Make(GameObject go, Sector sector, OWRigidbody planetBody, IPlanetConfig config, IModBehaviour mod, string uniqueModName) public static void Make(GameObject go, Sector sector, OWRigidbody planetBody, PlanetConfig config, IModBehaviour mod, string uniqueModName)
{ {
if (config.Props.Scatter != null) if (config.Props.Scatter != null)
{ {

View File

@ -1,17 +1,9 @@
using NewHorizons.Builder.General; using NewHorizons.Components;
using NewHorizons.Components; using NewHorizons.External.Modules;
using NewHorizons.External;
using NewHorizons.Handlers; using NewHorizons.Handlers;
using NewHorizons.Utility; using NewHorizons.Utility;
using OWML.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.Props namespace NewHorizons.Builder.Props
{ {
public static class RaftBuilder public static class RaftBuilder

View File

@ -1,26 +1,20 @@
using NewHorizons.Utility; using NewHorizons.External.Configs;
using NewHorizons.External.Modules;
using NewHorizons.Utility;
using OWML.Common;
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using Random = UnityEngine.Random; using Random = UnityEngine.Random;
using Logger = NewHorizons.Utility.Logger;
using NewHorizons.External;
using OWML.Common;
using NewHorizons.External.Configs;
namespace NewHorizons.Builder.Props namespace NewHorizons.Builder.Props
{ {
public static class ScatterBuilder public static class ScatterBuilder
{ {
public static void Make(GameObject go, Sector sector, IPlanetConfig config, IModBehaviour mod, string uniqueModName) public static void Make(GameObject go, Sector sector, PlanetConfig config, IModBehaviour mod, string uniqueModName)
{ {
MakeScatter(go, config.Props.Scatter, config.Base.SurfaceSize, sector, mod, uniqueModName, config); MakeScatter(go, config.Props.Scatter, config.Base.SurfaceSize, sector, mod, uniqueModName, config);
} }
private static void MakeScatter(GameObject go, PropModule.ScatterInfo[] scatterInfo, float radius, Sector sector, IModBehaviour mod, string uniqueModName, IPlanetConfig config) private static void MakeScatter(GameObject go, PropModule.ScatterInfo[] scatterInfo, float radius, Sector sector, IModBehaviour mod, string uniqueModName, PlanetConfig config)
{ {
var heightMap = config.HeightMap; var heightMap = config.HeightMap;

View File

@ -1,16 +1,11 @@
using NewHorizons.Components; using NewHorizons.Components;
using NewHorizons.External; using NewHorizons.External.Modules;
using NewHorizons.Handlers;
using NewHorizons.Utility; using NewHorizons.Utility;
using OWML.Common; using OWML.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.Props namespace NewHorizons.Builder.Props
{ {
public static class SignalBuilder public static class SignalBuilder

View File

@ -1,16 +1,10 @@
using NewHorizons.Components; using NewHorizons.Components;
using NewHorizons.External; using NewHorizons.External.Modules;
using NewHorizons.Handlers; using NewHorizons.Handlers;
using NewHorizons.Utility; using NewHorizons.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
using Random = UnityEngine.Random; using Random = UnityEngine.Random;
namespace NewHorizons.Builder.Props namespace NewHorizons.Builder.Props
{ {
public static class TornadoBuilder public static class TornadoBuilder

View File

@ -1,8 +1,6 @@
using NewHorizons.External; using NewHorizons.External.Modules;
using NewHorizons.Utility; using NewHorizons.Utility;
using UnityEngine; using UnityEngine;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.Props namespace NewHorizons.Builder.Props
{ {
public static class VolcanoBuilder public static class VolcanoBuilder

View File

@ -1,15 +1,7 @@
using NewHorizons.Components; using NewHorizons.External.Modules;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml.Linq;
using NewHorizons.External;
using NewHorizons.Utility;
using OWML.Common; using OWML.Common;
using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.UI;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.ShipLog namespace NewHorizons.Builder.ShipLog
{ {
public static class EntryLocationBuilder public static class EntryLocationBuilder

View File

@ -1,17 +1,13 @@
using NewHorizons.Components; using NewHorizons.Components;
using System.Collections.Generic; using NewHorizons.External.Modules;
using System.IO; using NewHorizons.Handlers;
using System.Linq;
using System.Xml.Linq;
using NewHorizons.External;
using NewHorizons.Utility; using NewHorizons.Utility;
using OWML.Common; using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
using System;
using NewHorizons.Handlers;
namespace NewHorizons.Builder.ShipLog namespace NewHorizons.Builder.ShipLog
{ {
public static class MapModeBuilder public static class MapModeBuilder
@ -44,7 +40,7 @@ namespace NewHorizons.Builder.ShipLog
} }
} }
if(flagManualPositionUsed) if (flagManualPositionUsed)
{ {
if (flagAutoPositionUsed && flagManualPositionUsed) if (flagAutoPositionUsed && flagManualPositionUsed)
Logger.LogWarning("Can't mix manual and automatic layout of ship log map mode, defaulting to manual"); Logger.LogWarning("Can't mix manual and automatic layout of ship log map mode, defaulting to manual");
@ -139,7 +135,7 @@ namespace NewHorizons.Builder.ShipLog
} }
#endregion #endregion
# region Details #region Details
private static void MakeDetail(ShipLogModule.ShipLogDetailInfo info, Transform parent, NewHorizonsBody body, Material greyScaleMaterial) private static void MakeDetail(ShipLogModule.ShipLogDetailInfo info, Transform parent, NewHorizonsBody body, Material greyScaleMaterial)
{ {
GameObject detailGameObject = new GameObject("Detail"); GameObject detailGameObject = new GameObject("Detail");
@ -213,12 +209,12 @@ namespace NewHorizons.Builder.ShipLog
for (int x = 0; x < currentNav[y].Length; x++) for (int x = 0; x < currentNav[y].Length; x++)
{ {
navMatrix[y][x] = currentNav[y][x]; navMatrix[y][x] = currentNav[y][x];
astroIdToNavIndex.Add(currentNav[y][x].GetID(), new [] {y, x}); astroIdToNavIndex.Add(currentNav[y][x].GetID(), new[] { y, x });
} }
} }
} }
foreach(NewHorizonsBody body in bodies) foreach (NewHorizonsBody body in bodies)
{ {
if (body.Config.ShipLog?.mapMode?.manualNavigationPosition == null) continue; if (body.Config.ShipLog?.mapMode?.manualNavigationPosition == null) continue;
@ -499,8 +495,8 @@ namespace NewHorizons.Builder.ShipLog
{ {
Texture2D texture; Texture2D texture;
if(body.Config.Star != null) texture = ImageUtilities.GetTexture(Main.Instance, "AssetBundle/DefaultMapModeStar.png"); if (body.Config.Star != null) texture = ImageUtilities.GetTexture(Main.Instance, "AssetBundle/DefaultMapModeStar.png");
else if(body.Config.Atmosphere != null) texture = ImageUtilities.GetTexture(Main.Instance, "AssetBundle/DefaultMapModNoAtmo.png"); else if (body.Config.Atmosphere != null) texture = ImageUtilities.GetTexture(Main.Instance, "AssetBundle/DefaultMapModNoAtmo.png");
else texture = ImageUtilities.GetTexture(Main.Instance, "AssetBundle/DefaultMapModePlanet.png"); else texture = ImageUtilities.GetTexture(Main.Instance, "AssetBundle/DefaultMapModePlanet.png");
var color = GetDominantPlanetColor(body); var color = GetDominantPlanetColor(body);
@ -544,7 +540,7 @@ namespace NewHorizons.Builder.ShipLog
var sandColor = body.Config.Sand?.Tint; var sandColor = body.Config.Sand?.Tint;
if (sandColor != null) return sandColor.ToColor(); if (sandColor != null) return sandColor.ToColor();
} }
catch(Exception) catch (Exception)
{ {
Logger.LogWarning($"Something went wrong trying to pick the colour for {body.Config.Name} but I'm too lazy to fix it."); Logger.LogWarning($"Something went wrong trying to pick the colour for {body.Config.Name} but I'm too lazy to fix it.");
} }

View File

@ -1,15 +1,7 @@
using NewHorizons.Components; using NewHorizons.External.Modules;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml.Linq;
using NewHorizons.External;
using NewHorizons.Utility;
using OWML.Common; using OWML.Common;
using UnityEngine; using UnityEngine;
using UnityEngine.UI;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.ShipLog namespace NewHorizons.Builder.ShipLog
{ {
public static class RevealBuilder public static class RevealBuilder

View File

@ -1,17 +1,11 @@
using System; using NewHorizons.External.Modules;
using NewHorizons.Components;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml.Linq;
using NewHorizons.External;
using NewHorizons.Utility;
using OWML.Common;
using UnityEngine;
using UnityEngine.UI;
using Logger = NewHorizons.Utility.Logger;
using NewHorizons.Handlers; using NewHorizons.Handlers;
using NewHorizons.Utility;
using System;
using System.Collections.Generic;
using System.Xml.Linq;
using UnityEngine;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.ShipLog namespace NewHorizons.Builder.ShipLog
{ {
public static class RumorModeBuilder public static class RumorModeBuilder

View File

@ -1,11 +1,8 @@
using System; using NewHorizons.External.Configs;
using NewHorizons.External.Configs;
using NewHorizons.Utility; using NewHorizons.Utility;
using OWML.Common; using OWML.Common;
using UnityEngine; using UnityEngine;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
using Object = System.Object;
namespace NewHorizons.Builder.StarSystem namespace NewHorizons.Builder.StarSystem
{ {
public class SkyboxBuilder public class SkyboxBuilder

View File

@ -1,11 +1,4 @@
using System; namespace NewHorizons.Components
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Components
{ {
public class BlackHoleDestructionVolume : DestructionVolume public class BlackHoleDestructionVolume : DestructionVolume
{ {

View File

@ -1,10 +1,4 @@
using System; namespace NewHorizons.Components
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NewHorizons.Components
{ {
public class ChangeStarSystemVolume : BlackHoleDestructionVolume public class ChangeStarSystemVolume : BlackHoleDestructionVolume
{ {
@ -18,7 +12,7 @@ namespace NewHorizons.Components
public override void VanishShip(OWRigidbody shipBody, RelativeLocationData entryLocation) public override void VanishShip(OWRigidbody shipBody, RelativeLocationData entryLocation)
{ {
if(PlayerState.IsInsideShip()) Main.Instance.ChangeCurrentStarSystem(TargetSolarSystem, true); if (PlayerState.IsInsideShip()) Main.Instance.ChangeCurrentStarSystem(TargetSolarSystem, true);
} }
public override void VanishPlayer(OWRigidbody playerBody, RelativeLocationData entryLocation) public override void VanishPlayer(OWRigidbody playerBody, RelativeLocationData entryLocation)

View File

@ -1,10 +1,6 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
namespace NewHorizons.Components namespace NewHorizons.Components
{ {
public class CloakSectorController : MonoBehaviour public class CloakSectorController : MonoBehaviour
@ -33,7 +29,7 @@ namespace NewHorizons.Components
void OnDestroy() void OnDestroy()
{ {
if(_isInitialized) if (_isInitialized)
{ {
_cloak.OnPlayerEnter -= OnPlayerEnter; _cloak.OnPlayerEnter -= OnPlayerEnter;
_cloak.OnPlayerExit -= OnPlayerExit; _cloak.OnPlayerExit -= OnPlayerExit;

View File

@ -1,10 +1,4 @@
using System; using UnityEngine;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace NewHorizons.Components namespace NewHorizons.Components
{ {
public class CloakedAudioSignal : AudioSignal public class CloakedAudioSignal : AudioSignal

View File

@ -1,10 +1,4 @@
using System; using UnityEngine;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace NewHorizons.Components namespace NewHorizons.Components
{ {
public class FunnelController : MonoBehaviour public class FunnelController : MonoBehaviour

View File

@ -1,12 +1,6 @@
using NewHorizons.Builder.General; using NewHorizons.Builder.General;
using NewHorizons.External.Configs; using NewHorizons.External.Configs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
namespace NewHorizons.Components namespace NewHorizons.Components
{ {
public class MapSatelliteOrbitFix : MonoBehaviour public class MapSatelliteOrbitFix : MonoBehaviour

View File

@ -1,10 +1,4 @@
using System; using UnityEngine;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace NewHorizons.Components namespace NewHorizons.Components
{ {
public class NHFluidVolume : RadialFluidVolume public class NHFluidVolume : RadialFluidVolume

View File

@ -1,7 +1,5 @@
using NewHorizons.Utility; using NewHorizons.Utility;
using System.Collections.Generic;
using UnityEngine; using UnityEngine;
namespace NewHorizons.Components namespace NewHorizons.Components
{ {
public class NHProxy : ProxyPlanet public class NHProxy : ProxyPlanet

View File

@ -1,11 +1,5 @@
using System; using UnityEngine;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using Random = UnityEngine.Random; using Random = UnityEngine.Random;
namespace NewHorizons.Components namespace NewHorizons.Components
{ {
public class NHTornadoWanderController : MonoBehaviour public class NHTornadoWanderController : MonoBehaviour

View File

@ -1,10 +1,4 @@
using System; using UnityEngine;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace NewHorizons.Components.Orbital namespace NewHorizons.Components.Orbital
{ {
public class BinaryFocalPoint : MonoBehaviour public class BinaryFocalPoint : MonoBehaviour
@ -20,7 +14,7 @@ namespace NewHorizons.Components.Orbital
void Start() void Start()
{ {
// Make sure its active but maybe it hasn't been set yet // Make sure its active but maybe it hasn't been set yet
if(FakeMassBody) FakeMassBody.SetActive(true); if (FakeMassBody) FakeMassBody.SetActive(true);
} }
void Update() void Update()
@ -28,7 +22,7 @@ namespace NewHorizons.Components.Orbital
if (Primary == null || Secondary == null) return; if (Primary == null || Secondary == null) return;
// Secondary and primary must have been engulfed by a star // Secondary and primary must have been engulfed by a star
if(!Primary.isActiveAndEnabled && !Secondary.isActiveAndEnabled) if (!Primary.isActiveAndEnabled && !Secondary.isActiveAndEnabled)
{ {
ReferenceFrameTracker component = Locator.GetPlayerBody().GetComponent<ReferenceFrameTracker>(); ReferenceFrameTracker component = Locator.GetPlayerBody().GetComponent<ReferenceFrameTracker>();
if (component.GetReferenceFrame(true) != null && component.GetReferenceFrame(true).GetOWRigidBody() == gameObject) if (component.GetReferenceFrame(true) != null && component.GetReferenceFrame(true).GetOWRigidBody() == gameObject)

View File

@ -1,11 +1,5 @@
using NewHorizons.External; using NewHorizons.External.Modules;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
namespace NewHorizons.Components.Orbital namespace NewHorizons.Components.Orbital
{ {
public class Gravity public class Gravity
@ -31,7 +25,7 @@ namespace NewHorizons.Components.Orbital
public Gravity(GravityVolume gv) public Gravity(GravityVolume gv)
{ {
if(gv == null) if (gv == null)
{ {
Mass = 0; Mass = 0;
Power = 2; Power = 2;

View File

@ -1,10 +1,4 @@
using System; namespace NewHorizons.Components.Orbital
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NewHorizons.Components.Orbital
{ {
public interface IOrbitalParameters public interface IOrbitalParameters
{ {

View File

@ -1,10 +1,4 @@
using NewHorizons.External; using NewHorizons.External.Modules;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NewHorizons.Components.Orbital namespace NewHorizons.Components.Orbital
{ {
public class NHAstroObject : AstroObject, IOrbitalParameters public class NHAstroObject : AstroObject, IOrbitalParameters

View File

@ -1,11 +1,6 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Components.Orbital namespace NewHorizons.Components.Orbital
{ {
public class NHOrbitLine : OrbitLine public class NHOrbitLine : OrbitLine
@ -94,7 +89,7 @@ namespace NewHorizons.Components.Orbital
_lineRenderer.widthMultiplier = widthMultiplier; _lineRenderer.widthMultiplier = widthMultiplier;
_lineRenderer.startColor = new Color(_color.r, _color.g, _color.b, num3 * num3); _lineRenderer.startColor = new Color(_color.r, _color.g, _color.b, num3 * num3);
} }
catch(Exception ex) catch (Exception ex)
{ {
Logger.LogError($"Exception in OrbitLine for [{_astroObject?.name}] : {ex.Message}, {ex.StackTrace}"); Logger.LogError($"Exception in OrbitLine for [{_astroObject?.name}] : {ex.Message}, {ex.StackTrace}");
enabled = false; enabled = false;

View File

@ -1,11 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Components.Orbital namespace NewHorizons.Components.Orbital
{ {
public class OrbitalParameters : IOrbitalParameters public class OrbitalParameters : IOrbitalParameters
@ -32,7 +26,7 @@ namespace NewHorizons.Components.Orbital
orbitalParameters.ArgumentOfPeriapsis = argumentOfPeriapsis; orbitalParameters.ArgumentOfPeriapsis = argumentOfPeriapsis;
// If primary gravity is linear and the orbit is eccentric its not even an ellipse so theres no true anomaly // If primary gravity is linear and the orbit is eccentric its not even an ellipse so theres no true anomaly
if(primaryGravity.Power == 1 && eccentricity != 0) if (primaryGravity.Power == 1 && eccentricity != 0)
{ {
trueAnomaly = 0; trueAnomaly = 0;
} }
@ -45,7 +39,7 @@ namespace NewHorizons.Components.Orbital
var secondaryMass = secondaryGravity.Mass; var secondaryMass = secondaryGravity.Mass;
var power = primaryGravity.Power; var power = primaryGravity.Power;
var period = (float) (GravityVolume.GRAVITATIONAL_CONSTANT * (primaryMass + secondaryMass) / (4 * Math.PI * Math.PI * Math.Pow(semiMajorAxis, power))); var period = (float)(GravityVolume.GRAVITATIONAL_CONSTANT * (primaryMass + secondaryMass) / (4 * Math.PI * Math.PI * Math.Pow(semiMajorAxis, power)));
orbitalParameters.Period = period; orbitalParameters.Period = period;
@ -63,10 +57,10 @@ namespace NewHorizons.Components.Orbital
float v; float v;
// For linear // For linear
if(primaryGravity.Power == 1) if (primaryGravity.Power == 1)
{ {
// Have to deal with a limit // Have to deal with a limit
if(eccentricity == 0) if (eccentricity == 0)
{ {
var v2 = 2 * mu * (Mathf.Log(r_a / r) + (1 / 2f)); var v2 = 2 * mu * (Mathf.Log(r_a / r) + (1 / 2f));
v = Mathf.Sqrt(v2); v = Mathf.Sqrt(v2);

View File

@ -1,11 +1,6 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Components.Orbital namespace NewHorizons.Components.Orbital
{ {
public class TrackingOrbitLine : OrbitLine public class TrackingOrbitLine : OrbitLine

View File

@ -1,18 +1,12 @@
using NewHorizons.Builder.General; using NewHorizons.Builder.General;
using NewHorizons.Builder.Orbital;
using NewHorizons.Components.Orbital; using NewHorizons.Components.Orbital;
using NewHorizons.External; using NewHorizons.External.Modules;
using NewHorizons.Handlers; using NewHorizons.Handlers;
using NewHorizons.Utility; using NewHorizons.Utility;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using Random = UnityEngine.Random;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
using Random = UnityEngine.Random;
namespace NewHorizons.Components namespace NewHorizons.Components
{ {
public class QuantumPlanet : QuantumObject public class QuantumPlanet : QuantumObject
@ -106,7 +100,7 @@ namespace NewHorizons.Components
} }
} }
if(canChange) if (canChange)
{ {
if (newState.sector != null && newState.sector != oldState.sector) SetNewSector(oldState, newState); if (newState.sector != null && newState.sector != oldState.sector) SetNewSector(oldState, newState);
if (newState.orbit != null && newState.orbit != oldState.orbit) SetNewOrbit(primaryBody, orbitalParams); if (newState.orbit != null && newState.orbit != oldState.orbit) SetNewOrbit(primaryBody, orbitalParams);

View File

@ -1,7 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Components namespace NewHorizons.Components
{ {
public class RingShape : Shape public class RingShape : Shape

View File

@ -1,10 +1,7 @@
using System; using NewHorizons.External.Modules;
using NewHorizons.External;
using OWML.Common;
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
{ {
public class ShipLogDetail : MonoBehaviour public class ShipLogDetail : MonoBehaviour

View File

@ -1,15 +1,10 @@
using System; using NewHorizons.Handlers;
using NewHorizons.Utility;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using NewHorizons.Utility;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
using UnityEngine.UI;
using OWML.Common;
using NewHorizons.Handlers;
namespace NewHorizons.Components namespace NewHorizons.Components
{ {
public class ShipLogStarChartMode : ShipLogMode public class ShipLogStarChartMode : ShipLogMode
@ -112,7 +107,7 @@ namespace NewHorizons.Components
private void OnEnterFlightConsole(OWRigidbody _) private void OnEnterFlightConsole(OWRigidbody _)
{ {
_isAtFlightConsole = true; _isAtFlightConsole = true;
if(_target != null) if (_target != null)
{ {
_warpPrompt.SetVisibility(true); _warpPrompt.SetVisibility(true);
} }
@ -131,7 +126,7 @@ namespace NewHorizons.Components
private void OnGameUnpaused() private void OnGameUnpaused()
{ {
if(_target != null && _isAtFlightConsole) if (_target != null && _isAtFlightConsole)
{ {
_warpPrompt.SetVisibility(true); _warpPrompt.SetVisibility(true);
} }
@ -175,7 +170,7 @@ namespace NewHorizons.Components
} }
catch (Exception) { } catch (Exception) { }
if(texture != null) if (texture != null)
{ {
shipLogEntryCard._photo.sprite = MakeSprite((Texture2D)texture); shipLogEntryCard._photo.sprite = MakeSprite((Texture2D)texture);
newCard.transform.Find("EntryCardRoot/EntryCardBackground/PhotoImage").gameObject.SetActive(true); newCard.transform.Find("EntryCardRoot/EntryCardBackground/PhotoImage").gameObject.SetActive(true);
@ -321,9 +316,9 @@ namespace NewHorizons.Components
private void RemoveWarpTarget(bool playSound = false) private void RemoveWarpTarget(bool playSound = false)
{ {
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(global::AudioType.ShipLogMarkLocation, 1f);
_target.SetMarkedOnHUD(false); _target.SetMarkedOnHUD(false);
_target = null; _target = null;

View File

@ -1,13 +1,6 @@
using NewHorizons.Builder.General; using NewHorizons.Builder.General;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using NewHorizons.Utility;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Components namespace NewHorizons.Components
{ {
public class ShipWarpController : MonoBehaviour public class ShipWarpController : MonoBehaviour
@ -124,7 +117,7 @@ namespace NewHorizons.Components
public void Update() public void Update()
{ {
if(_isWarpingIn && LateInitializerManager.isDoneInitializing) if (_isWarpingIn && LateInitializerManager.isDoneInitializing)
{ {
Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => StartWarpInEffect(), 1); Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => StartWarpInEffect(), 1);
_isWarpingIn = false; _isWarpingIn = false;
@ -188,7 +181,7 @@ namespace NewHorizons.Components
Locator.GetDeathManager()._invincible = false; Locator.GetDeathManager()._invincible = false;
// For some reason warping into the ship makes you suffocate while in the ship // For some reason warping into the ship makes you suffocate while in the ship
if(_wearingSuit) resources.OnSuitUp(); if (_wearingSuit) resources.OnSuitUp();
var o2Volume = Locator.GetShipBody().GetComponent<OxygenVolume>(); var o2Volume = Locator.GetShipBody().GetComponent<OxygenVolume>();
var atmoVolume = GameObject.Find("Ship_Body/Volumes/ShipAtmosphereVolume").GetComponent<SimpleFluidVolume>(); var atmoVolume = GameObject.Find("Ship_Body/Volumes/ShipAtmosphereVolume").GetComponent<SimpleFluidVolume>();

View File

@ -1,10 +1,4 @@
using System; using UnityEngine;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace NewHorizons.Components.SizeControllers namespace NewHorizons.Components.SizeControllers
{ {
public class SizeController : MonoBehaviour public class SizeController : MonoBehaviour

View File

@ -1,11 +1,5 @@
using NewHorizons.Builder.Body; using NewHorizons.Builder.Body;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
namespace NewHorizons.Components.SizeControllers namespace NewHorizons.Components.SizeControllers
{ {
public class StarAtmosphereSizeController : SizeController public class StarAtmosphereSizeController : SizeController

View File

@ -1,10 +1,4 @@
using System; using UnityEngine;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace NewHorizons.Components.SizeControllers namespace NewHorizons.Components.SizeControllers
{ {
public class WaterSizeController : SizeController public class WaterSizeController : SizeController

View File

@ -1,10 +1,4 @@
using System; using UnityEngine;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace NewHorizons.Components namespace NewHorizons.Components
{ {
public class StarController : MonoBehaviour public class StarController : MonoBehaviour

View File

@ -1,12 +1,6 @@
using NewHorizons.Utility; using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Components namespace NewHorizons.Components
{ {
[RequireComponent(typeof(SunLightController))] [RequireComponent(typeof(SunLightController))]
@ -46,7 +40,7 @@ namespace NewHorizons.Components
if (Instance._activeStar != null && Instance._activeStar.Equals(star)) if (Instance._activeStar != null && Instance._activeStar.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]);
} }
else else
{ {
@ -66,7 +60,7 @@ namespace NewHorizons.Components
return; return;
} }
foreach(var star in _stars) foreach (var star in _stars)
{ {
if (star == null) continue; if (star == null) continue;
@ -89,7 +83,7 @@ namespace NewHorizons.Components
{ {
if (_sunLightController == null || _sunLightParamUpdater == null) return; if (_sunLightController == null || _sunLightParamUpdater == null) return;
if(_activeStar != null) _activeStar.Disable(); if (_activeStar != null) _activeStar.Disable();
Logger.Log($"Switching active star: {star.gameObject.name}"); Logger.Log($"Switching active star: {star.gameObject.name}");

View File

@ -1,10 +1,4 @@
using System; using UnityEngine;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace NewHorizons.Components namespace NewHorizons.Components
{ {
public class TimeLoopController : MonoBehaviour public class TimeLoopController : MonoBehaviour
@ -21,7 +15,7 @@ namespace NewHorizons.Components
{ {
// Stock gives like 33 seconds after the sun collapses // Stock gives like 33 seconds after the sun collapses
// Gonna assume it takes like 7 seconds to collapse after the supernova trigger // Gonna assume it takes like 7 seconds to collapse after the supernova trigger
if(_supernovaHappened && Time.time > _supernovaTime + 40f) if (_supernovaHappened && Time.time > _supernovaTime + 40f)
{ {
Locator.GetDeathManager().KillPlayer(DeathType.TimeLoop); Locator.GetDeathManager().KillPlayer(DeathType.TimeLoop);
} }

View File

@ -1,11 +1,4 @@
using System; namespace NewHorizons.Components
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace NewHorizons.Components
{ {
public class TornadoFix : SectoredMonoBehaviour public class TornadoFix : SectoredMonoBehaviour
{ {
@ -19,7 +12,7 @@ namespace NewHorizons.Components
tornadoController._formationDuration = 1f; tornadoController._formationDuration = 1f;
tornadoController._collapseDuration = 1f; tornadoController._collapseDuration = 1f;
if(_sector != null) if (_sector != null)
{ {
_sector.OnOccupantEnterSector += OnOccupantEnterSector; _sector.OnOccupantEnterSector += OnOccupantEnterSector;
_sector.OnOccupantExitSector += OnOccupantExitSector; _sector.OnOccupantExitSector += OnOccupantExitSector;
@ -28,7 +21,7 @@ namespace NewHorizons.Components
public new void SetSector(Sector sector) public new void SetSector(Sector sector)
{ {
if(_sector != null) if (_sector != null)
{ {
_sector.OnOccupantEnterSector -= OnOccupantEnterSector; _sector.OnOccupantEnterSector -= OnOccupantEnterSector;
_sector.OnOccupantExitSector -= OnOccupantExitSector; _sector.OnOccupantExitSector -= OnOccupantExitSector;

View File

@ -1,10 +1,7 @@
using NewHorizons.Utility; using NewHorizons.External.Modules;
using NewHorizons.Utility;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NewHorizons.External.Configs namespace NewHorizons.External.Configs
{ {
public class Config public class Config

View File

@ -1,34 +0,0 @@
using NewHorizons.External.VariableSize;
using NewHorizons.Utility;
namespace NewHorizons.External.Configs
{
public interface IPlanetConfig
{
string Name { get; }
string StarSystem { get; }
bool Destroy { get; }
string[] ChildrenToDestroy { get; }
int BuildPriority { get; }
bool CanShowOnTitle { get; }
bool IsQuantumState { get; }
BaseModule Base { get; }
AtmosphereModule Atmosphere { get; }
OrbitModule Orbit { get; }
RingModule Ring { get; }
HeightMapModule HeightMap { get; }
ProcGenModule ProcGen { get; }
AsteroidBeltModule AsteroidBelt { get; }
StarModule Star { get; }
FocalPointModule FocalPoint { get; }
PropModule Props { get; }
ShipLogModule ShipLog { get; }
SpawnModule Spawn { get; }
SignalModule Signal { get; }
SingularityModule Singularity { get; }
LavaModule Lava { get; }
SandModule Sand { get; }
WaterModule Water { get; }
FunnelModule Funnel { get; }
}
}

View File

@ -1,14 +1,13 @@
using NewHorizons.External.VariableSize; using NewHorizons.External.Modules;
using NewHorizons.Utility; using NewHorizons.External.Modules.VariableSize;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
namespace NewHorizons.External.Configs namespace NewHorizons.External.Configs
{ {
public class PlanetConfig : Config, IPlanetConfig public class PlanetConfig : Config
{ {
public string Name { get; set; } public string Name { get; set; }
public string Version { get; set; }
public string StarSystem { get; set; } = "SolarSystem"; public string StarSystem { get; set; } = "SolarSystem";
public bool Destroy { get; set; } public bool Destroy { get; set; }
public string[] ChildrenToDestroy { get; set; } public string[] ChildrenToDestroy { get; set; }
@ -37,9 +36,39 @@ namespace NewHorizons.External.Configs
public PlanetConfig(Dictionary<string, object> dict) : base(dict) public PlanetConfig(Dictionary<string, object> dict) : base(dict)
{ {
// Always have to have a base module // Always have to have a base module
if(Base == null) Base = new BaseModule(); if (Base == null) Base = new BaseModule();
if(Orbit == null) Orbit = new OrbitModule(); if (Orbit == null) Orbit = new OrbitModule();
if (ShipLog == null) ShipLog = new ShipLogModule(); if (ShipLog == null) ShipLog = new ShipLogModule();
} }
public void Validate()
{
if (Base.CenterOfSolarSystem) Orbit.IsStatic = true;
if (Base.WaterSize != 0)
{
Water = new WaterModule();
Water.Size = Base.WaterSize;
Water.Tint = Base.WaterTint;
}
if (Base.LavaSize != 0)
{
Lava = new LavaModule();
Lava.Size = Base.LavaSize;
}
if(Base.BlackHoleSize != 0)
{
Singularity = new SingularityModule();
Singularity.Type = "BlackHole";
Singularity.Size = Base.BlackHoleSize;
}
if(Base.IsSatellite)
{
Base.ShowMinimap = false;
}
}
} }
} }

View File

@ -1,10 +1,4 @@
using NewHorizons.Utility; using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NewHorizons.External.Configs namespace NewHorizons.External.Configs
{ {
public class StarSystemConfig : Config public class StarSystemConfig : Config

View File

@ -1,12 +1,6 @@
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.External.Configs namespace NewHorizons.External.Configs
{ {
public class TranslationConfig public class TranslationConfig
@ -19,7 +13,7 @@ namespace NewHorizons.External.Configs
{ {
Dictionary<string, object> dict = JObject.Parse(File.ReadAllText(filename)).ToObject<Dictionary<string, object>>(); Dictionary<string, object> dict = JObject.Parse(File.ReadAllText(filename)).ToObject<Dictionary<string, object>>();
if(dict.ContainsKey(nameof(DialogueDictionary))) if (dict.ContainsKey(nameof(DialogueDictionary)))
{ {
DialogueDictionary = (Dictionary<string, string>)(dict[nameof(DialogueDictionary)] as Newtonsoft.Json.Linq.JObject).ToObject(typeof(Dictionary<string, string>)); DialogueDictionary = (Dictionary<string, string>)(dict[nameof(DialogueDictionary)] as Newtonsoft.Json.Linq.JObject).ToObject(typeof(Dictionary<string, string>));
} }

View File

@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NewHorizons.External
{
public class FocalPointModule
{
public string Primary { get; set; }
public string Secondary { get; set; }
}
}

View File

@ -1,10 +1,4 @@
using System; namespace NewHorizons.External.Modules
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NewHorizons.External
{ {
public class AsteroidBeltModule : Module public class AsteroidBeltModule : Module
{ {

View File

@ -1,11 +1,5 @@
using NewHorizons.Utility; using NewHorizons.Utility;
using System; namespace NewHorizons.External.Modules
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NewHorizons.External
{ {
public class AtmosphereModule : Module public class AtmosphereModule : Module
{ {

View File

@ -1,11 +1,5 @@
using NewHorizons.Utility; using NewHorizons.Utility;
using System; namespace NewHorizons.External.Modules
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NewHorizons.External
{ {
public class BaseModule : Module public class BaseModule : Module
{ {
@ -20,11 +14,13 @@ namespace NewHorizons.External
public MVector3 CometTailRotation { get; set; } public MVector3 CometTailRotation { get; set; }
public bool HasReferenceFrame { get; set; } = true; public bool HasReferenceFrame { get; set; } = true;
public bool CenterOfSolarSystem { get; set; } = false; public bool CenterOfSolarSystem { get; set; } = false;
public bool IsSatellite { get; set; }
public float CloakRadius { get; set; } = 0f; public float CloakRadius { get; set; } = 0f;
public bool InvulnerableToSun { get; set; } public bool InvulnerableToSun { get; set; }
public bool ShowMinimap { get; set; } = true;
// Old, see SingularityModule instead
// Obsolete
public bool IsSatellite { get; set; }
public float BlackHoleSize { get; set; } public float BlackHoleSize { get; set; }
public float LavaSize { get; set; } public float LavaSize { get; set; }
public float WaterSize { get; set; } public float WaterSize { get; set; }

View File

@ -0,0 +1,8 @@
namespace NewHorizons.External.Modules
{
public class FocalPointModule
{
public string Primary { get; set; }
public string Secondary { get; set; }
}
}

View File

@ -1,7 +1,5 @@
using NewHorizons.Utility; using NewHorizons.Utility;
using UnityEngine; namespace NewHorizons.External.Modules
namespace NewHorizons.External
{ {
public class HeightMapModule : Module public class HeightMapModule : Module
{ {

View File

@ -1,11 +1,6 @@
using NewHorizons.Utility; using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; namespace NewHorizons.External.Modules
using System.Text;
using System.Threading.Tasks;
namespace NewHorizons.External
{ {
public abstract class Module public abstract class Module
{ {

View File

@ -1,12 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NewHorizons.Handlers;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.External.Modules
namespace NewHorizons.External
{ {
public static class NewHorizonsData public static class NewHorizonsData
{ {
@ -30,7 +25,7 @@ namespace NewHorizons.External
_activeProfile = _saveFile.Profiles[_activeProfileName]; _activeProfile = _saveFile.Profiles[_activeProfileName];
Logger.Log($"Loaded save data for {_activeProfileName}"); Logger.Log($"Loaded save data for {_activeProfileName}");
} }
catch(Exception) catch (Exception)
{ {
try try
{ {
@ -41,7 +36,7 @@ namespace NewHorizons.External
Main.Instance.ModHelper.Storage.Save(_saveFile, _fileName); Main.Instance.ModHelper.Storage.Save(_saveFile, _fileName);
Logger.Log($"Loaded save data for {_activeProfileName}"); Logger.Log($"Loaded save data for {_activeProfileName}");
} }
catch(Exception e) catch (Exception e)
{ {
Logger.LogError($"Couldn't create save data {e.Message}, {e.StackTrace}"); Logger.LogError($"Couldn't create save data {e.Message}, {e.StackTrace}");
} }
@ -67,7 +62,7 @@ namespace NewHorizons.External
Save(); Save();
} }
# region Frequencies #region Frequencies
public static bool KnowsFrequency(string frequency) public static bool KnowsFrequency(string frequency)
{ {
@ -90,9 +85,9 @@ namespace NewHorizons.External
return (_activeProfile != null && _activeProfile.KnownFrequencies.Count > 0); return (_activeProfile != null && _activeProfile.KnownFrequencies.Count > 0);
} }
# endregion #endregion
# region Signals #region Signals
public static bool KnowsSignal(string signal) public static bool KnowsSignal(string signal)
{ {
@ -110,9 +105,9 @@ namespace NewHorizons.External
} }
} }
# endregion #endregion
# region Newly Revealed Facts #region Newly Revealed Facts
public static void AddNewlyRevealedFactID(string id) public static void AddNewlyRevealedFactID(string id)
{ {
@ -131,7 +126,7 @@ namespace NewHorizons.External
Save(); Save();
} }
# endregion #endregion
private class NewHorizonsSaveFile private class NewHorizonsSaveFile
{ {

View File

@ -1,12 +1,6 @@
using NewHorizons.Components.Orbital; using NewHorizons.Components.Orbital;
using NewHorizons.Utility; using NewHorizons.Utility;
using System; namespace NewHorizons.External.Modules
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NewHorizons.External
{ {
public class OrbitModule : Module, IOrbitalParameters public class OrbitModule : Module, IOrbitalParameters
{ {

View File

@ -1,11 +1,5 @@
using NewHorizons.Utility; using NewHorizons.Utility;
using System; namespace NewHorizons.External.Modules
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NewHorizons.External
{ {
public class ProcGenModule : Module public class ProcGenModule : Module
{ {

View File

@ -1,11 +1,5 @@
using NewHorizons.Utility; using NewHorizons.Utility;
using System; namespace NewHorizons.External.Modules
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NewHorizons.External
{ {
public class PropModule : Module public class PropModule : Module
{ {

View File

@ -1,6 +1,5 @@
using NewHorizons.Utility; using NewHorizons.Utility;
namespace NewHorizons.External.Modules
namespace NewHorizons.External
{ {
public class ShipLogModule : Module public class ShipLogModule : Module
{ {

View File

@ -1,11 +1,5 @@
using NewHorizons.Utility; using NewHorizons.Utility;
using System; namespace NewHorizons.External.Modules
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NewHorizons.External
{ {
public class SignalModule : Module public class SignalModule : Module
{ {

View File

@ -1,11 +1,5 @@
using NewHorizons.Utility; using NewHorizons.Utility;
using System; namespace NewHorizons.External.Modules
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NewHorizons.External
{ {
public class SpawnModule : Module public class SpawnModule : Module
{ {

View File

@ -1,11 +1,5 @@
using NewHorizons.Utility; using NewHorizons.Utility;
using System; namespace NewHorizons.External.Modules.VariableSize
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NewHorizons.External.VariableSize
{ {
public class FunnelModule : VariableSizeModule public class FunnelModule : VariableSizeModule
{ {

Some files were not shown because too many files have changed in this diff Show More