diff --git a/NewHorizons/Builder/Atmosphere/AirBuilder.cs b/NewHorizons/Builder/Atmosphere/AirBuilder.cs index 9083bbe9..649159a9 100644 --- a/NewHorizons/Builder/Atmosphere/AirBuilder.cs +++ b/NewHorizons/Builder/Atmosphere/AirBuilder.cs @@ -1,8 +1,5 @@ -using NewHorizons.External; -using OWML.Utils; +using NewHorizons.External.Modules; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Builder.Atmosphere { public static class AirBuilder @@ -26,7 +23,7 @@ namespace NewHorizons.Builder.Atmosphere SFV._allowShipAutoroll = true; SFV._disableOnStart = false; - if(info.HasOxygen) + if (info.HasOxygen) { airGO.AddComponent(); } diff --git a/NewHorizons/Builder/Atmosphere/AtmosphereBuilder.cs b/NewHorizons/Builder/Atmosphere/AtmosphereBuilder.cs index d59c72d2..c26bac3c 100644 --- a/NewHorizons/Builder/Atmosphere/AtmosphereBuilder.cs +++ b/NewHorizons/Builder/Atmosphere/AtmosphereBuilder.cs @@ -1,7 +1,5 @@ -using NewHorizons.External; +using NewHorizons.External.Modules; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Builder.Atmosphere { public static class AtmosphereBuilder @@ -18,11 +16,11 @@ namespace NewHorizons.Builder.Atmosphere atmo.transform.parent = atmoGO.transform; atmo.transform.position = planetGO.transform.TransformPoint(Vector3.zero); atmo.transform.localScale = Vector3.one * atmosphereModule.Size * 1.2f; - foreach(var meshRenderer in atmo.GetComponentsInChildren()) + foreach (var meshRenderer in atmo.GetComponentsInChildren()) { meshRenderer.material.SetFloat("_InnerRadius", atmosphereModule.Cloud != null ? atmosphereModule.Size : surfaceSize); meshRenderer.material.SetFloat("_OuterRadius", atmosphereModule.Size * 1.2f); - if(atmosphereModule.AtmosphereTint != null) + if (atmosphereModule.AtmosphereTint != null) meshRenderer.material.SetColor("_SkyColor", atmosphereModule.AtmosphereTint.ToColor()); } diff --git a/NewHorizons/Builder/Atmosphere/CloudsBuilder.cs b/NewHorizons/Builder/Atmosphere/CloudsBuilder.cs index 93e47105..5abf1deb 100644 --- a/NewHorizons/Builder/Atmosphere/CloudsBuilder.cs +++ b/NewHorizons/Builder/Atmosphere/CloudsBuilder.cs @@ -1,11 +1,9 @@ -using NewHorizons.External; +using NewHorizons.External.Modules; using NewHorizons.Utility; using OWML.Common; -using OWML.Utils; using System; using UnityEngine; using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Builder.Atmosphere { public static class CloudsBuilder @@ -95,7 +93,7 @@ namespace NewHorizons.Builder.Atmosphere // Fix the rotations once the rest is done cloudsMainGO.transform.rotation = planetGO.transform.TransformRotation(Quaternion.Euler(0, 0, 0)); // 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); cloudsBottomGO.transform.position = planetGO.transform.TransformPoint(Vector3.zero); diff --git a/NewHorizons/Builder/Atmosphere/EffectsBuilder.cs b/NewHorizons/Builder/Atmosphere/EffectsBuilder.cs index 17b7a36a..f3254ba2 100644 --- a/NewHorizons/Builder/Atmosphere/EffectsBuilder.cs +++ b/NewHorizons/Builder/Atmosphere/EffectsBuilder.cs @@ -1,9 +1,6 @@ -using NewHorizons.External; +using NewHorizons.External.Modules; using NewHorizons.Utility; -using OWML.Utils; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Builder.Atmosphere { public static class EffectsBuilder @@ -22,30 +19,30 @@ namespace NewHorizons.Builder.Atmosphere SCG._dynamicCullingBounds = 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); rainGO.transform.position = planetGO.transform.position; var pvc = rainGO.GetComponent(); - pvc._densityByHeight = new AnimationCurve(new Keyframe[] - { + pvc._densityByHeight = new AnimationCurve(new Keyframe[] + { new Keyframe(surfaceSize - 0.5f, 0), - new Keyframe(surfaceSize, 10f), - new Keyframe(info.Scale, 0f) + new Keyframe(surfaceSize, 10f), + new Keyframe(info.Scale, 0f) }); rainGO.GetComponent()._activeInSector = sector; rainGO.GetComponent()._exclusionSectors = new Sector[] { }; rainGO.SetActive(true); } - - if(info.IsSnowing) + + if (info.IsSnowing) { var snowGO = new GameObject("SnowEffects"); snowGO.transform.parent = effectsGO.transform; 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); snowEmitter.name = "SnowEmitter"; diff --git a/NewHorizons/Builder/Atmosphere/FogBuilder.cs b/NewHorizons/Builder/Atmosphere/FogBuilder.cs index 431be9f5..b7d3ef0f 100644 --- a/NewHorizons/Builder/Atmosphere/FogBuilder.cs +++ b/NewHorizons/Builder/Atmosphere/FogBuilder.cs @@ -1,13 +1,5 @@ -using NewHorizons.External; -using OWML.Utils; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using NewHorizons.External.Modules; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Builder.Atmosphere { public static class FogBuilder diff --git a/NewHorizons/Builder/Atmosphere/SunOverrideBuilder.cs b/NewHorizons/Builder/Atmosphere/SunOverrideBuilder.cs index a2de6f17..e1d07a84 100644 --- a/NewHorizons/Builder/Atmosphere/SunOverrideBuilder.cs +++ b/NewHorizons/Builder/Atmosphere/SunOverrideBuilder.cs @@ -1,8 +1,5 @@ -using NewHorizons.External; -using OWML.Utils; +using NewHorizons.External.Modules; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Builder.Atmosphere { public static class SunOverrideBuilder diff --git a/NewHorizons/Builder/Atmosphere/VolumesBuilder.cs b/NewHorizons/Builder/Atmosphere/VolumesBuilder.cs index bb27a514..41290d90 100644 --- a/NewHorizons/Builder/Atmosphere/VolumesBuilder.cs +++ b/NewHorizons/Builder/Atmosphere/VolumesBuilder.cs @@ -1,14 +1,10 @@ -using NewHorizons.External; -using NewHorizons.External.Configs; -using OWML.Utils; +using NewHorizons.External.Configs; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Builder.Atmosphere { 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 useMiniMap = config.Base.IsSatellite; @@ -39,7 +35,7 @@ namespace NewHorizons.Builder.Atmosphere EffectRuleset ER = rulesetGO.AddComponent(); ER._type = EffectRuleset.BubbleType.Underwater; var gdRuleset = GameObject.Find("GiantsDeep_Body/Sector_GD/Volumes_GD/RulesetVolumes_GD").GetComponent(); - + ER._material = gdRuleset._material; var cloudMaterial = new Material(gdRuleset._cloudMaterial); diff --git a/NewHorizons/Builder/Body/AsteroidBeltBuilder.cs b/NewHorizons/Builder/Body/AsteroidBeltBuilder.cs index 7d66192c..0c90222c 100644 --- a/NewHorizons/Builder/Body/AsteroidBeltBuilder.cs +++ b/NewHorizons/Builder/Body/AsteroidBeltBuilder.cs @@ -1,22 +1,15 @@ -using NewHorizons.External; +using NewHorizons.External.Configs; +using NewHorizons.External.Modules; +using NewHorizons.Handlers; using NewHorizons.Utility; using OWML.Common; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; -using NewHorizons.External.Configs; -using Logger = NewHorizons.Utility.Logger; using Random = UnityEngine.Random; -using NewHorizons.Handlers; - namespace NewHorizons.Builder.Body { 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; @@ -57,7 +50,7 @@ namespace NewHorizons.Builder.Body }; config.ProcGen = belt.ProcGen; - if(config.ProcGen == null) + if (config.ProcGen == null) { config.ProcGen = new ProcGenModule() { diff --git a/NewHorizons/Builder/Body/CloakBuilder.cs b/NewHorizons/Builder/Body/CloakBuilder.cs index 9a509517..54edf7d0 100644 --- a/NewHorizons/Builder/Body/CloakBuilder.cs +++ b/NewHorizons/Builder/Body/CloakBuilder.cs @@ -1,12 +1,6 @@ using NewHorizons.Components; using NewHorizons.Utility; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; - namespace NewHorizons.Builder.Body { public static class CloakBuilder diff --git a/NewHorizons/Builder/Body/CometTailBuilder.cs b/NewHorizons/Builder/Body/CometTailBuilder.cs index 89dfbdff..19e3f762 100644 --- a/NewHorizons/Builder/Body/CometTailBuilder.cs +++ b/NewHorizons/Builder/Body/CometTailBuilder.cs @@ -1,18 +1,10 @@ -using NewHorizons.External; -using NewHorizons.External.Configs; -using OWML.Utils; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using NewHorizons.External.Configs; using UnityEngine; - namespace NewHorizons.Builder.Body { 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); cometTail.transform.position = planetGO.transform.position; diff --git a/NewHorizons/Builder/Body/FunnelBuilder.cs b/NewHorizons/Builder/Body/FunnelBuilder.cs index 70d7b47b..0186404c 100644 --- a/NewHorizons/Builder/Body/FunnelBuilder.cs +++ b/NewHorizons/Builder/Body/FunnelBuilder.cs @@ -1,13 +1,8 @@ using NewHorizons.Components; -using NewHorizons.External.VariableSize; using NewHorizons.Utility; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; using Logger = NewHorizons.Utility.Logger; +using NewHorizons.External.Modules.VariableSize; 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().materials; 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]); if (module.Tint != null) @@ -126,7 +121,7 @@ namespace NewHorizons.Builder.Body lavaMaterial.mainTextureOffset = new Vector2(0.1f, 0.2f); lavaMaterial.mainTextureScale = new Vector2(1f, 3f); - if(module.Tint != null) + if (module.Tint != null) { lavaMaterial.SetColor("_EmissionColor", module.Tint.ToColor()); } @@ -158,7 +153,7 @@ namespace NewHorizons.Builder.Body var funnelSizeController = funnelGO.AddComponent(); - if(module.Curve != null) + if (module.Curve != null) { var curve = new AnimationCurve(); foreach (var pair in module.Curve) @@ -177,7 +172,7 @@ namespace NewHorizons.Builder.Body { var targetAO = AstroObjectLocator.GetAstroObject(module.Target); 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}"); else Logger.LogError($"Couldn't find the target ({module.Target}) for the funnel {funnelGO.name}"); diff --git a/NewHorizons/Builder/Body/Geometry/CubeSphere.cs b/NewHorizons/Builder/Body/Geometry/CubeSphere.cs index 113dfbbd..2e07b4dc 100644 --- a/NewHorizons/Builder/Body/Geometry/CubeSphere.cs +++ b/NewHorizons/Builder/Body/Geometry/CubeSphere.cs @@ -1,12 +1,6 @@ using NewHorizons.Utility; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Builder.Body.Geometry { 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) { // 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"); resolution = 100; diff --git a/NewHorizons/Builder/Body/Geometry/Icosphere.cs b/NewHorizons/Builder/Body/Geometry/Icosphere.cs index 48e394dd..67b634b7 100644 --- a/NewHorizons/Builder/Body/Geometry/Icosphere.cs +++ b/NewHorizons/Builder/Body/Geometry/Icosphere.cs @@ -1,11 +1,7 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; using Random = UnityEngine.Random; - namespace NewHorizons.Builder.Body.Geometry { public static class Icosphere @@ -75,13 +71,13 @@ namespace NewHorizons.Builder.Body.Geometry 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]; float latitude = Mathf.Repeat(Mathf.Rad2Deg * Mathf.Acos(v.z / Mathf.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z)), 180f); float longitude = Mathf.Repeat(Mathf.Rad2Deg * (v.x > 0 ? Mathf.Atan(v.y / v.x) : Mathf.Atan(v.y / v.x) + Mathf.PI) + 90f, 360f); - + float height = Perlin.Noise(v + randomOffset) * (maxHeight - minHeight) + minHeight; newVertices[i] = verticesToCopy[i] * height; @@ -104,8 +100,8 @@ namespace NewHorizons.Builder.Body.Geometry private static void RefineFaces(int level) { 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 int[] oldTriangles = triangles[i]; @@ -118,7 +114,7 @@ namespace NewHorizons.Builder.Body.Geometry int v = oldVertices.Length; 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 var v0Ind = oldTriangles[j]; diff --git a/NewHorizons/Builder/Body/Geometry/Perlin.cs b/NewHorizons/Builder/Body/Geometry/Perlin.cs index d5e9738b..9e300248 100644 --- a/NewHorizons/Builder/Body/Geometry/Perlin.cs +++ b/NewHorizons/Builder/Body/Geometry/Perlin.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - +using UnityEngine; namespace NewHorizons.Builder.Body.Geometry { // Perlin noise generator for Unity diff --git a/NewHorizons/Builder/Body/GeometryBuilder.cs b/NewHorizons/Builder/Body/GeometryBuilder.cs index e3ba2d81..dc422e71 100644 --- a/NewHorizons/Builder/Body/GeometryBuilder.cs +++ b/NewHorizons/Builder/Body/GeometryBuilder.cs @@ -1,6 +1,4 @@ using UnityEngine; -using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Builder.Body { public static class GeometryBuilder diff --git a/NewHorizons/Builder/Body/HeightMapBuilder.cs b/NewHorizons/Builder/Body/HeightMapBuilder.cs index b0034f88..c8fd1b1a 100644 --- a/NewHorizons/Builder/Body/HeightMapBuilder.cs +++ b/NewHorizons/Builder/Body/HeightMapBuilder.cs @@ -1,16 +1,10 @@ using NewHorizons.Builder.Body.Geometry; -using NewHorizons.Builder.Props; -using NewHorizons.External; +using NewHorizons.External.Modules; using NewHorizons.Utility; using OWML.Common; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Builder.Body { public static class HeightMapBuilder @@ -27,7 +21,7 @@ namespace NewHorizons.Builder.Body if (module.TextureMap == null) textureMap = Texture2D.whiteTexture; else textureMap = ImageUtilities.GetTexture(mod, module.TextureMap); } - catch(Exception e) + catch (Exception e) { Logger.LogError($"Couldn't load HeightMap textures, {e.Message}, {e.StackTrace}"); return; @@ -56,7 +50,7 @@ namespace NewHorizons.Builder.Body var cubeSphereMC = cubeSphere.AddComponent(); cubeSphereMC.sharedMesh = mesh; - if(planetGO.GetComponent() != null) cubeSphere.AddComponent(); + if (planetGO.GetComponent() != null) cubeSphere.AddComponent(); // Fix rotation in the end cubeSphere.transform.rotation = planetGO.transform.TransformRotation(Quaternion.Euler(90, 0, 0)); diff --git a/NewHorizons/Builder/Body/LavaBuilder.cs b/NewHorizons/Builder/Body/LavaBuilder.cs index df429bb1..82af7fd8 100644 --- a/NewHorizons/Builder/Body/LavaBuilder.cs +++ b/NewHorizons/Builder/Body/LavaBuilder.cs @@ -1,24 +1,18 @@ -using NewHorizons.External.VariableSize; -using OWML.Utils; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; +using NewHorizons.External.Modules.VariableSize; namespace NewHorizons.Builder.Body { public static class LavaBuilder { - 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; - if(module.Curve != null) + if (module.Curve != null) { var modifier = 1f; - foreach(var pair in module.Curve) + foreach (var pair in module.Curve) { if (pair.Value < modifier) modifier = pair.Value; } @@ -35,14 +29,14 @@ namespace NewHorizons.Builder.Body lavaSphere.transform.localScale = Vector3.one; lavaSphere.transform.name = "LavaSphere"; lavaSphere.GetComponent().material.SetFloat("_HeightScale", heightScale); - if(module.Tint != null) lavaSphere.GetComponent().material.SetColor("_EmissionColor", module.Tint.ToColor()); + if (module.Tint != null) lavaSphere.GetComponent().material.SetColor("_EmissionColor", module.Tint.ToColor()); var sectorCullGroup = lavaSphere.GetComponent(); sectorCullGroup.SetSector(sector); var moltenCoreProxy = GameObject.Instantiate(GameObject.Find("VolcanicMoon_Body/MoltenCore_VM/MoltenCore_Proxy"), moltenCore.transform); ; moltenCoreProxy.name = "MoltenCore_Proxy"; - + var proxyLavaSphere = moltenCoreProxy.transform.Find("LavaSphere (1)"); proxyLavaSphere.transform.localScale = Vector3.one; proxyLavaSphere.name = "LavaSphere_Proxy"; @@ -52,7 +46,7 @@ namespace NewHorizons.Builder.Body var sectorProxy = moltenCoreProxy.GetComponent(); sectorProxy._renderers = new List { proxyLavaSphere.GetComponent() }; sectorProxy.SetSector(sector); - + var destructionVolume = GameObject.Instantiate(GameObject.Find("VolcanicMoon_Body/MoltenCore_VM/DestructionVolume"), moltenCore.transform); destructionVolume.GetComponent().radius = 1; destructionVolume.SetActive(true); diff --git a/NewHorizons/Builder/Body/ProcGenBuilder.cs b/NewHorizons/Builder/Body/ProcGenBuilder.cs index 77f38d84..98e826c5 100644 --- a/NewHorizons/Builder/Body/ProcGenBuilder.cs +++ b/NewHorizons/Builder/Body/ProcGenBuilder.cs @@ -1,13 +1,7 @@ using NewHorizons.Builder.Body.Geometry; -using NewHorizons.External; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; +using NewHorizons.External.Modules; using NewHorizons.Utility; - +using UnityEngine; namespace NewHorizons.Builder.Body { public static class ProcGenBuilder @@ -17,8 +11,8 @@ namespace NewHorizons.Builder.Body public static void Make(GameObject planetGO, Sector sector, ProcGenModule module) { - if(quantumMaterial == null) quantumMaterial = SearchUtilities.FindResourceOfTypeAndName("Rock_QM_EyeRock_mat"); - if(iceMaterial == null) iceMaterial = SearchUtilities.FindResourceOfTypeAndName("Rock_BH_IceSpike_mat"); + if (quantumMaterial == null) quantumMaterial = SearchUtilities.FindResourceOfTypeAndName("Rock_QM_EyeRock_mat"); + if (iceMaterial == null) iceMaterial = SearchUtilities.FindResourceOfTypeAndName("Rock_BH_IceSpike_mat"); GameObject icosphere = new GameObject("Icosphere"); diff --git a/NewHorizons/Builder/Body/ProxyBuilder.cs b/NewHorizons/Builder/Body/ProxyBuilder.cs index 96c7f8e1..80626cd1 100644 --- a/NewHorizons/Builder/Body/ProxyBuilder.cs +++ b/NewHorizons/Builder/Body/ProxyBuilder.cs @@ -2,12 +2,11 @@ using NewHorizons.Builder.Props; using NewHorizons.Components; using NewHorizons.Components.SizeControllers; -using NewHorizons.External.VariableSize; using NewHorizons.Utility; -using OWML.Common; using System; using UnityEngine; using Logger = NewHorizons.Utility.Logger; +using NewHorizons.External.Modules.VariableSize; namespace NewHorizons.Builder.Body { diff --git a/NewHorizons/Builder/Body/RingBuilder.cs b/NewHorizons/Builder/Body/RingBuilder.cs index 10f3bc59..92c95c4d 100644 --- a/NewHorizons/Builder/Body/RingBuilder.cs +++ b/NewHorizons/Builder/Body/RingBuilder.cs @@ -1,16 +1,12 @@ -using NewHorizons.External; +using NewHorizons.Components; +using NewHorizons.Components.SizeControllers; +using NewHorizons.Utility; using OWML.Common; 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.External.Modules.VariableSize; namespace NewHorizons.Builder.Body { diff --git a/NewHorizons/Builder/Body/SandBuilder.cs b/NewHorizons/Builder/Body/SandBuilder.cs index d9abba3c..261a3434 100644 --- a/NewHorizons/Builder/Body/SandBuilder.cs +++ b/NewHorizons/Builder/Body/SandBuilder.cs @@ -1,11 +1,6 @@ -using NewHorizons.External.VariableSize; -using NewHorizons.Utility; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using NewHorizons.Utility; using UnityEngine; +using NewHorizons.External.Modules.VariableSize; namespace NewHorizons.Builder.Body { diff --git a/NewHorizons/Builder/Body/SingularityBuilder.cs b/NewHorizons/Builder/Body/SingularityBuilder.cs index 3db6cc24..af26b0b5 100644 --- a/NewHorizons/Builder/Body/SingularityBuilder.cs +++ b/NewHorizons/Builder/Body/SingularityBuilder.cs @@ -1,15 +1,9 @@ using NewHorizons.Components; -using NewHorizons.External; +using NewHorizons.External.Configs; using NewHorizons.Utility; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; -using NewHorizons.External.Configs; using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Builder.Body { public static class SingularityBuilder @@ -23,18 +17,8 @@ namespace NewHorizons.Builder.Body private static Shader blackHoleShader = 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 pairedSingularity = config.Singularity.PairedSingularity; @@ -63,10 +47,10 @@ namespace NewHorizons.Builder.Body } // Try to pair them - if(pairedSingularity != null && newSingularity != null) + if (pairedSingularity != null && newSingularity != null) { var pairedSingularityAO = AstroObjectLocator.GetAstroObject(pairedSingularity); - if(pairedSingularityAO != null) + if (pairedSingularityAO != null) { switch (polarity) { @@ -117,7 +101,7 @@ namespace NewHorizons.Builder.Body meshRenderer.material.SetFloat("_MassScale", 1); meshRenderer.material.SetFloat("_DistortFadeDist", size * 0.55f); - if(makeAudio) + if (makeAudio) { var blackHoleAmbience = GameObject.Instantiate(GameObject.Find("BrittleHollow_Body/BlackHole_BH/BlackHoleAmbience"), blackHole.transform); blackHoleAmbience.name = "BlackHoleAmbience"; @@ -196,7 +180,7 @@ namespace NewHorizons.Builder.Body ambientLight.name = "AmbientLight"; ambientLight.GetComponent().range = size * 7f; - GameObject whiteHoleVolumeGO = GameObject.Instantiate(GameObject.Find("WhiteHole_Body/WhiteHoleVolume")); + GameObject whiteHoleVolumeGO = GameObject.Instantiate(GameObject.Find("WhiteHole_Body/WhiteHoleVolume")); whiteHoleVolumeGO.transform.parent = whiteHole.transform; whiteHoleVolumeGO.transform.localPosition = Vector3.zero; whiteHoleVolumeGO.transform.localScale = Vector3.one; @@ -207,7 +191,7 @@ namespace NewHorizons.Builder.Body whiteHoleFluidVolume._innerRadius = size * 0.5f; whiteHoleFluidVolume._outerRadius = size; whiteHoleFluidVolume._attachedBody = OWRB; - + var whiteHoleVolume = whiteHoleVolumeGO.GetComponent(); whiteHoleVolume._debrisDistMax = size * 6.5f; whiteHoleVolume._debrisDistMin = size * 2f; @@ -216,13 +200,13 @@ namespace NewHorizons.Builder.Body whiteHoleVolume._whiteHoleBody = OWRB; whiteHoleVolume._whiteHoleProxyShadowSuperGroup = planetGO.GetComponent(); whiteHoleVolume._radius = size * 0.5f; - + whiteHoleVolumeGO.GetComponent().radius = size; whiteHoleVolume.enabled = true; whiteHoleFluidVolume.enabled = true; - if(makeZeroGVolume) + if (makeZeroGVolume) { var zeroGVolume = GameObject.Instantiate(GameObject.Find("WhiteHole_Body/ZeroGVolume"), whiteHole.transform); zeroGVolume.name = "ZeroGVolume"; diff --git a/NewHorizons/Builder/Body/StarBuilder.cs b/NewHorizons/Builder/Body/StarBuilder.cs index bd10bd3a..fb239008 100644 --- a/NewHorizons/Builder/Body/StarBuilder.cs +++ b/NewHorizons/Builder/Body/StarBuilder.cs @@ -1,16 +1,9 @@ -using NewHorizons.External; -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; using NewHorizons.Components.SizeControllers; +using NewHorizons.Utility; +using OWML.Utils; +using UnityEngine; +using NewHorizons.External.Modules.VariableSize; namespace NewHorizons.Builder.Body { diff --git a/NewHorizons/Builder/Body/WaterBuilder.cs b/NewHorizons/Builder/Body/WaterBuilder.cs index bdeb2f4e..cab3af31 100644 --- a/NewHorizons/Builder/Body/WaterBuilder.cs +++ b/NewHorizons/Builder/Body/WaterBuilder.cs @@ -1,11 +1,8 @@ -using NewHorizons.External; -using NewHorizons.External.VariableSize; -using OWML.Utils; -using UnityEngine; -using NewHorizons.Utility; -using Logger = NewHorizons.Utility.Logger; -using NewHorizons.Components; +using NewHorizons.Components; using NewHorizons.Components.SizeControllers; +using NewHorizons.Utility; +using UnityEngine; +using NewHorizons.External.Modules.VariableSize; namespace NewHorizons.Builder.Body { @@ -34,7 +31,7 @@ namespace NewHorizons.Builder.Body var GDSharedMaterials = GameObject.Find("Ocean_GD").GetComponent()._lowAltitudeMaterials; 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]); if (module.Tint != null) @@ -104,7 +101,7 @@ namespace NewHorizons.Builder.Body else { fogGO.GetComponent().material.SetFloat("_Radius", module.Size); - fogGO.GetComponent().material.SetFloat("_Radius2", module.Size/2f); + fogGO.GetComponent().material.SetFloat("_Radius2", module.Size / 2f); } // TODO: make LOD work diff --git a/NewHorizons/Builder/General/AmbientLightBuilder.cs b/NewHorizons/Builder/General/AmbientLightBuilder.cs index a3db71f3..932c6858 100644 --- a/NewHorizons/Builder/General/AmbientLightBuilder.cs +++ b/NewHorizons/Builder/General/AmbientLightBuilder.cs @@ -1,9 +1,4 @@ -using NewHorizons.External; -using NewHorizons.Utility; -using OWML.Utils; -using UnityEngine; -using Logger = NewHorizons.Utility.Logger; - +using UnityEngine; namespace NewHorizons.Builder.General { public static class AmbientLightBuilder diff --git a/NewHorizons/Builder/General/AstroObjectBuilder.cs b/NewHorizons/Builder/General/AstroObjectBuilder.cs index b0a84295..f64fb940 100644 --- a/NewHorizons/Builder/General/AstroObjectBuilder.cs +++ b/NewHorizons/Builder/General/AstroObjectBuilder.cs @@ -1,17 +1,12 @@ -using NewHorizons.External; -using NewHorizons.Utility; -using OWML.Utils; -using System; -using UnityEngine; +using NewHorizons.Components.Orbital; using NewHorizons.External.Configs; +using UnityEngine; using Logger = NewHorizons.Utility.Logger; -using NewHorizons.Components.Orbital; - namespace NewHorizons.Builder.General { 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(); astroObject.HideDisplayName = !config.Base.HasMapMarker; @@ -42,7 +37,7 @@ namespace NewHorizons.Builder.General var alignment = body.AddComponent(); alignment.SetTargetBody(primaryBody?.GetAttachedOWRigidbody()); alignment._usePhysicsToRotate = true; - if(config.Orbit.AlignmentAxis == null) + if (config.Orbit.AlignmentAxis == null) { alignment._localAlignmentAxis = new Vector3(0, -1, 0); } diff --git a/NewHorizons/Builder/General/DetectorBuilder.cs b/NewHorizons/Builder/General/DetectorBuilder.cs index 234981f0..b2809144 100644 --- a/NewHorizons/Builder/General/DetectorBuilder.cs +++ b/NewHorizons/Builder/General/DetectorBuilder.cs @@ -1,20 +1,12 @@ -using NewHorizons.Builder.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.Components.Orbital; using NewHorizons.External.Configs; - +using UnityEngine; +using Logger = NewHorizons.Utility.Logger; namespace NewHorizons.Builder.General { 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"); detectorGO.SetActive(false); @@ -27,7 +19,7 @@ namespace NewHorizons.Builder.General OWRB.RegisterAttachedForceDetector(forceDetector); // 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"); @@ -36,7 +28,7 @@ namespace NewHorizons.Builder.General sphereCollider.radius = config.Base.SurfaceSize; var owCollider = detectorGO.AddComponent(); - + fluidDetector._collider = sphereCollider; // Could copy the splash from the interloper as well some day diff --git a/NewHorizons/Builder/General/GravityBuilder.cs b/NewHorizons/Builder/General/GravityBuilder.cs index ae648ead..0affaee2 100644 --- a/NewHorizons/Builder/General/GravityBuilder.cs +++ b/NewHorizons/Builder/General/GravityBuilder.cs @@ -1,17 +1,11 @@ -using NewHorizons.External; -using NewHorizons.Utility; -using OWML.Utils; -using System; -using System.Reflection; +using NewHorizons.External.Configs; using UnityEngine; -using NewHorizons.External.Configs; using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Builder.General { 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 GM = config.Base.SurfaceGravity * Mathf.Pow(config.Base.SurfaceSize, exponent); diff --git a/NewHorizons/Builder/General/MarkerBuilder.cs b/NewHorizons/Builder/General/MarkerBuilder.cs index 208912b1..3abeb06b 100644 --- a/NewHorizons/Builder/General/MarkerBuilder.cs +++ b/NewHorizons/Builder/General/MarkerBuilder.cs @@ -1,16 +1,11 @@ -using NewHorizons.External; -using OWML.Utils; -using System.Reflection; -using UnityEngine; -using NewHorizons.External.Configs; -using Logger = NewHorizons.Utility.Logger; +using NewHorizons.External.Configs; using NewHorizons.Handlers; - +using UnityEngine; namespace NewHorizons.Builder.General { 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._labelID = (UITextType)TranslationHandler.AddUI(config.Name); @@ -29,7 +24,7 @@ namespace NewHorizons.Builder.General { markerType = MapMarker.MarkerType.HourglassTwins; } - else if(config.Base.IsSatellite) + else if (config.Base.IsSatellite) { markerType = MapMarker.MarkerType.Probe; } diff --git a/NewHorizons/Builder/General/RFVolumeBuilder.cs b/NewHorizons/Builder/General/RFVolumeBuilder.cs index d429748e..9ede61ea 100644 --- a/NewHorizons/Builder/General/RFVolumeBuilder.cs +++ b/NewHorizons/Builder/General/RFVolumeBuilder.cs @@ -1,8 +1,4 @@ -using NewHorizons.External; -using OWML.Utils; -using UnityEngine; -using Logger = NewHorizons.Utility.Logger; - +using UnityEngine; namespace NewHorizons.Builder.General { public static class RFVolumeBuilder @@ -26,7 +22,7 @@ namespace NewHorizons.Builder.General RV._maxTargetDistance = 0; RV._autopilotArrivalDistance = 2.0f * sphereOfInfluence; RV._autoAlignmentDistance = sphereOfInfluence * 1.5f; - + RV._hideLandingModePrompt = false; RV._matchAngularVelocity = true; RV._minMatchAngularVelocityDistance = 70; diff --git a/NewHorizons/Builder/General/RigidBodyBuilder.cs b/NewHorizons/Builder/General/RigidBodyBuilder.cs index 40f78df3..f6672314 100644 --- a/NewHorizons/Builder/General/RigidBodyBuilder.cs +++ b/NewHorizons/Builder/General/RigidBodyBuilder.cs @@ -1,16 +1,10 @@ using NewHorizons.External.Configs; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; - namespace NewHorizons.Builder.General { public static class RigidBodyBuilder { - public static OWRigidbody Make(GameObject body, IPlanetConfig config) + public static OWRigidbody Make(GameObject body, PlanetConfig config) { body.AddComponent(); diff --git a/NewHorizons/Builder/General/SectorBuilder.cs b/NewHorizons/Builder/General/SectorBuilder.cs index 346d0c15..ff10fb97 100644 --- a/NewHorizons/Builder/General/SectorBuilder.cs +++ b/NewHorizons/Builder/General/SectorBuilder.cs @@ -1,9 +1,5 @@ -using NewHorizons.External; -using OWML.Utils; -using System.Collections.Generic; +using System.Collections.Generic; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Builder.General { public static class MakeSector diff --git a/NewHorizons/Builder/General/SpawnPointBuilder.cs b/NewHorizons/Builder/General/SpawnPointBuilder.cs index 865ffea6..de26408e 100644 --- a/NewHorizons/Builder/General/SpawnPointBuilder.cs +++ b/NewHorizons/Builder/General/SpawnPointBuilder.cs @@ -1,10 +1,6 @@ -using NewHorizons.External; -using OWML.Utils; -using System; +using NewHorizons.External.Modules; using UnityEngine; -using NewHorizons.Utility; using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Builder.General { public static class SpawnPointBuilder @@ -13,7 +9,7 @@ namespace NewHorizons.Builder.General public static SpawnPoint Make(GameObject planetGO, SpawnModule module, OWRigidbody owRigidBody) { SpawnPoint playerSpawn = null; - if(!Main.Instance.IsWarping && module.PlayerSpawnPoint != null) + if (!Main.Instance.IsWarping && module.PlayerSpawnPoint != null) { GameObject spawnGO = new GameObject("PlayerSpawnPoint"); 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.position = spawnGO.transform.position + spawnGO.transform.TransformDirection(Vector3.up) * 4f; } - if(module.ShipSpawnPoint != null) + if (module.ShipSpawnPoint != null) { GameObject spawnGO = new GameObject("ShipSpawnPoint"); spawnGO.transform.parent = planetGO.transform; @@ -41,10 +37,10 @@ namespace NewHorizons.Builder.General ship.transform.rotation = Quaternion.FromToRotation(Vector3.up, (spawnPoint.transform.position - planetGO.transform.position).normalized); // Move it up a bit more ship.transform.position = ship.transform.position + ship.transform.TransformDirection(Vector3.up) * 4f; - + ship.GetRequiredComponent().SetBodyToMatch(owRigidBody); - if(Main.Instance.IsWarping) + if (Main.Instance.IsWarping) { Logger.Log("Overriding player spawn to be inside ship"); GameObject playerSpawnGO = new GameObject("PlayerSpawnPoint"); @@ -54,10 +50,10 @@ namespace NewHorizons.Builder.General playerSpawnGO.transform.localPosition = new Vector3(0, 0, 0); playerSpawn = playerSpawnGO.AddComponent(); - 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; Main.Instance.ModHelper.Events.Unity.RunWhen(() => Main.IsSystemReady, () => SuitUp()); @@ -90,18 +86,18 @@ namespace NewHorizons.Builder.General { spv._interactVolume.EnableSingleInteraction(false, spv._pickupSuitCommandIndex); } - + spv._timer = 0f; spv._index = 0; spv.OnSuitUp(); - + GameObject suitGeometry = spv._suitGeometry; if (suitGeometry != null) suitGeometry.SetActive(false); - + OWCollider suitOWCollider = spv._suitOWCollider; if (suitOWCollider != null) suitOWCollider.SetActivation(false); - + spv.enabled = true; } } diff --git a/NewHorizons/Builder/Orbital/FocalPointBuilder.cs b/NewHorizons/Builder/Orbital/FocalPointBuilder.cs index 0a8f0c90..c6b851bf 100644 --- a/NewHorizons/Builder/Orbital/FocalPointBuilder.cs +++ b/NewHorizons/Builder/Orbital/FocalPointBuilder.cs @@ -1,23 +1,16 @@ -using NewHorizons.Builder.General; -using NewHorizons.Components.Orbital; -using NewHorizons.External; +using NewHorizons.Components.Orbital; using NewHorizons.External.Configs; +using NewHorizons.External.Modules; using NewHorizons.Handlers; using NewHorizons.Utility; using OWML.Common; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Builder.Orbital { 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; @@ -30,23 +23,23 @@ namespace NewHorizons.Builder.Orbital // Grab the bodies from the main dictionary NewHorizonsBody primary = 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; } - else if(body.Config.Name == module.Secondary) + else if (body.Config.Name == module.Secondary) { secondary = body; } - if(primary != null && secondary != null) + if (primary != null && secondary != null) { 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}]"); return; @@ -74,7 +67,7 @@ namespace NewHorizons.Builder.Orbital 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 upperSurfaceRadius = config.Base.SurfaceSize; diff --git a/NewHorizons/Builder/Orbital/InitialMotionBuilder.cs b/NewHorizons/Builder/Orbital/InitialMotionBuilder.cs index b3383b32..6f152a1f 100644 --- a/NewHorizons/Builder/Orbital/InitialMotionBuilder.cs +++ b/NewHorizons/Builder/Orbital/InitialMotionBuilder.cs @@ -1,16 +1,7 @@ -using NewHorizons.External; -using OWML.Utils; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using NewHorizons.Components.Orbital; +using NewHorizons.External.Modules; using UnityEngine; using Logger = NewHorizons.Utility.Logger; -using System.Reflection; -using NewHorizons.Utility; -using NewHorizons.Components.Orbital; - namespace NewHorizons.Builder.Orbital { public static class InitialMotionBuilder diff --git a/NewHorizons/Builder/Orbital/OrbitlineBuilder.cs b/NewHorizons/Builder/Orbital/OrbitlineBuilder.cs index a4304dfc..6169ff0b 100644 --- a/NewHorizons/Builder/Orbital/OrbitlineBuilder.cs +++ b/NewHorizons/Builder/Orbital/OrbitlineBuilder.cs @@ -1,17 +1,11 @@ -using NewHorizons.External; -using NewHorizons.Utility; -using OWML.Utils; -using UnityEngine; +using NewHorizons.Components.Orbital; using NewHorizons.External.Configs; -using Logger = NewHorizons.Utility.Logger; -using NewHorizons.Components.Orbital; -using System; - +using UnityEngine; namespace NewHorizons.Builder.Orbital { 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"); orbitGO.transform.parent = planetGO.transform; @@ -21,7 +15,7 @@ namespace NewHorizons.Builder.Orbital lineRenderer.material = config.Orbit.DottedOrbitLine ? GameObject.Find("HearthianMapSatellite_Body/OrbitLine").GetComponent().material : GameObject.Find("OrbitLine_CO").GetComponent().material; lineRenderer.textureMode = config.Orbit.DottedOrbitLine ? LineTextureMode.RepeatPerSegment : LineTextureMode.Stretch; - + var width = config.Orbit.DottedOrbitLine ? 100 : 50; lineRenderer.startWidth = width; lineRenderer.endWidth = width; @@ -36,7 +30,7 @@ namespace NewHorizons.Builder.Orbital var parentGravity = astroObject.GetPrimaryBody()?.GetGravityVolume(); 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(); } @@ -67,12 +61,12 @@ namespace NewHorizons.Builder.Orbital var fade = isMoon; 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; orbitLine._fadeEndDist = 5000; orbitLine._fadeStartDist = 3000; } - + orbitLine._color = color; orbitLine._astroObject = astroObject; diff --git a/NewHorizons/Builder/Props/DetailBuilder.cs b/NewHorizons/Builder/Props/DetailBuilder.cs index f483436d..1484a41b 100644 --- a/NewHorizons/Builder/Props/DetailBuilder.cs +++ b/NewHorizons/Builder/Props/DetailBuilder.cs @@ -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.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; -using Random = UnityEngine.Random; using Logger = NewHorizons.Utility.Logger; -using NewHorizons.External; -using OWML.Common; -using NewHorizons.External.Configs; -using NewHorizons.Handlers; - namespace NewHorizons.Builder.Props { 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; @@ -185,7 +181,7 @@ namespace NewHorizons.Builder.Props 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}"); } diff --git a/NewHorizons/Builder/Props/DialogueBuilder.cs b/NewHorizons/Builder/Props/DialogueBuilder.cs index be687164..9a11c5c0 100644 --- a/NewHorizons/Builder/Props/DialogueBuilder.cs +++ b/NewHorizons/Builder/Props/DialogueBuilder.cs @@ -1,15 +1,8 @@ -using NewHorizons.External; +using NewHorizons.External.Modules; using NewHorizons.Handlers; using OWML.Common; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Xml; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Builder.Props { public static class DialogueBuilder @@ -46,7 +39,7 @@ namespace NewHorizons.Builder.Props prereqConditionType = RemoteDialogueTrigger.MultiConditionType.AND, prereqConditions = new string[]{ }, onTriggerEnterConditions = new string[]{ } - } + } }; remoteDialogueTrigger._activatedDialogues = new bool[1]; remoteDialogueTrigger._deactivateTriggerPostConversation = true; @@ -72,7 +65,7 @@ namespace NewHorizons.Builder.Props var owCollider = conversationZone.AddComponent(); var interact = conversationZone.AddComponent(); - if(info.radius <= 0) + if (info.radius <= 0) { sphere.enabled = false; owCollider.enabled = false; @@ -110,7 +103,7 @@ namespace NewHorizons.Builder.Props controller._dialogueTree = dialogue; controller.lookOnlyWhenTalking = lookOnlyWhenTalking; } - else if(nomaiController != null) + else if (nomaiController != null) { if (lookOnlyWhenTalking) { @@ -153,7 +146,7 @@ namespace NewHorizons.Builder.Props triggerVolume.OnExit += controller.OnZoneExit; } // Simpler for the Nomai - else if(nomaiController) + else if (nomaiController) { triggerVolume.OnEntry += (_) => nomaiController.StartWatchingPlayer(); triggerVolume.OnExit += (_) => nomaiController.StopWatchingPlayer(); diff --git a/NewHorizons/Builder/Props/GeyserBuilder.cs b/NewHorizons/Builder/Props/GeyserBuilder.cs index 5fbbbb62..bd177925 100644 --- a/NewHorizons/Builder/Props/GeyserBuilder.cs +++ b/NewHorizons/Builder/Props/GeyserBuilder.cs @@ -1,12 +1,6 @@ -using NewHorizons.External; +using NewHorizons.External.Modules; using NewHorizons.Utility; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; - namespace NewHorizons.Builder.Props { public static class GeyserBuilder diff --git a/NewHorizons/Builder/Props/NomaiTextBuilder.cs b/NewHorizons/Builder/Props/NomaiTextBuilder.cs index 60661940..eea5eb60 100644 --- a/NewHorizons/Builder/Props/NomaiTextBuilder.cs +++ b/NewHorizons/Builder/Props/NomaiTextBuilder.cs @@ -1,17 +1,13 @@ -using NewHorizons.External; +using NewHorizons.External.Modules; using NewHorizons.Handlers; using NewHorizons.Utility; using OWML.Common; -using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Xml; using UnityEngine; using Logger = NewHorizons.Utility.Logger; using Random = UnityEngine.Random; - namespace NewHorizons.Builder.Props { public static class NomaiTextBuilder diff --git a/NewHorizons/Builder/Props/ProjectionBuilder.cs b/NewHorizons/Builder/Props/ProjectionBuilder.cs index 1c1e5c62..5cbee144 100644 --- a/NewHorizons/Builder/Props/ProjectionBuilder.cs +++ b/NewHorizons/Builder/Props/ProjectionBuilder.cs @@ -1,16 +1,11 @@ -using NewHorizons.External; +using NewHorizons.External.Modules; +using NewHorizons.Handlers; +using NewHorizons.Utility; +using OWML.Common; using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; -using NewHorizons.Utility; -using OWML.ModHelper; -using OWML.Common; -using NewHorizons.Handlers; using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Builder.Props { public static class ProjectionBuilder diff --git a/NewHorizons/Builder/Props/PropBuildManager.cs b/NewHorizons/Builder/Props/PropBuildManager.cs index 0c45045f..52410373 100644 --- a/NewHorizons/Builder/Props/PropBuildManager.cs +++ b/NewHorizons/Builder/Props/PropBuildManager.cs @@ -1,25 +1,14 @@ -using NewHorizons.External; -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.Builder.ShipLog; using NewHorizons.External.Configs; -using System.IO; - +using OWML.Common; +using System; +using UnityEngine; +using Logger = NewHorizons.Utility.Logger; namespace NewHorizons.Builder.Props { 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) { diff --git a/NewHorizons/Builder/Props/RaftBuilder.cs b/NewHorizons/Builder/Props/RaftBuilder.cs index 9a3e30f7..5632ad46 100644 --- a/NewHorizons/Builder/Props/RaftBuilder.cs +++ b/NewHorizons/Builder/Props/RaftBuilder.cs @@ -1,17 +1,9 @@ -using NewHorizons.Builder.General; -using NewHorizons.Components; -using NewHorizons.External; +using NewHorizons.Components; +using NewHorizons.External.Modules; using NewHorizons.Handlers; 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 Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Builder.Props { public static class RaftBuilder diff --git a/NewHorizons/Builder/Props/ScatterBuilder.cs b/NewHorizons/Builder/Props/ScatterBuilder.cs index 2df47932..200c53db 100644 --- a/NewHorizons/Builder/Props/ScatterBuilder.cs +++ b/NewHorizons/Builder/Props/ScatterBuilder.cs @@ -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.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; using Random = UnityEngine.Random; -using Logger = NewHorizons.Utility.Logger; -using NewHorizons.External; -using OWML.Common; -using NewHorizons.External.Configs; - namespace NewHorizons.Builder.Props { 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); } - 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; diff --git a/NewHorizons/Builder/Props/SignalBuilder.cs b/NewHorizons/Builder/Props/SignalBuilder.cs index 56a6fe28..56c46456 100644 --- a/NewHorizons/Builder/Props/SignalBuilder.cs +++ b/NewHorizons/Builder/Props/SignalBuilder.cs @@ -1,16 +1,11 @@ using NewHorizons.Components; -using NewHorizons.External; -using NewHorizons.Handlers; +using NewHorizons.External.Modules; using NewHorizons.Utility; using OWML.Common; using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Builder.Props { public static class SignalBuilder diff --git a/NewHorizons/Builder/Props/TornadoBuilder.cs b/NewHorizons/Builder/Props/TornadoBuilder.cs index b276a1ef..d4b06e1d 100644 --- a/NewHorizons/Builder/Props/TornadoBuilder.cs +++ b/NewHorizons/Builder/Props/TornadoBuilder.cs @@ -1,16 +1,10 @@ using NewHorizons.Components; -using NewHorizons.External; +using NewHorizons.External.Modules; using NewHorizons.Handlers; using NewHorizons.Utility; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; using Logger = NewHorizons.Utility.Logger; using Random = UnityEngine.Random; - namespace NewHorizons.Builder.Props { public static class TornadoBuilder diff --git a/NewHorizons/Builder/Props/VolcanoBuilder.cs b/NewHorizons/Builder/Props/VolcanoBuilder.cs index a7e1c80a..aa24bc10 100644 --- a/NewHorizons/Builder/Props/VolcanoBuilder.cs +++ b/NewHorizons/Builder/Props/VolcanoBuilder.cs @@ -1,8 +1,6 @@ -using NewHorizons.External; +using NewHorizons.External.Modules; using NewHorizons.Utility; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Builder.Props { public static class VolcanoBuilder diff --git a/NewHorizons/Builder/ShipLog/EntryLocationBuilder.cs b/NewHorizons/Builder/ShipLog/EntryLocationBuilder.cs index 8781c10b..4efd3ca1 100644 --- a/NewHorizons/Builder/ShipLog/EntryLocationBuilder.cs +++ b/NewHorizons/Builder/ShipLog/EntryLocationBuilder.cs @@ -1,15 +1,7 @@ -using NewHorizons.Components; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Xml.Linq; -using NewHorizons.External; -using NewHorizons.Utility; +using NewHorizons.External.Modules; using OWML.Common; +using System.Collections.Generic; using UnityEngine; -using UnityEngine.UI; -using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Builder.ShipLog { public static class EntryLocationBuilder diff --git a/NewHorizons/Builder/ShipLog/MapModeBuilder.cs b/NewHorizons/Builder/ShipLog/MapModeBuilder.cs index 8563b632..78387fcd 100644 --- a/NewHorizons/Builder/ShipLog/MapModeBuilder.cs +++ b/NewHorizons/Builder/ShipLog/MapModeBuilder.cs @@ -1,17 +1,13 @@ using NewHorizons.Components; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Xml.Linq; -using NewHorizons.External; +using NewHorizons.External.Modules; +using NewHorizons.Handlers; using NewHorizons.Utility; -using OWML.Common; +using System; +using System.Collections.Generic; +using System.Linq; using UnityEngine; using UnityEngine.UI; using Logger = NewHorizons.Utility.Logger; -using System; -using NewHorizons.Handlers; - namespace NewHorizons.Builder.ShipLog { public static class MapModeBuilder @@ -44,7 +40,7 @@ namespace NewHorizons.Builder.ShipLog } } - if(flagManualPositionUsed) + if (flagManualPositionUsed) { if (flagAutoPositionUsed && flagManualPositionUsed) Logger.LogWarning("Can't mix manual and automatic layout of ship log map mode, defaulting to manual"); @@ -101,15 +97,15 @@ namespace NewHorizons.Builder.ShipLog private static ShipLogAstroObject AddShipLogAstroObject(GameObject gameObject, NewHorizonsBody body, Material greyScaleMaterial, int layer) { const float unviewedIconOffset = 15; - + GameObject unviewedReference = SearchUtilities.CachedFind(ShipLogHandler.PAN_ROOT_PATH + "/TimberHearth/UnviewedIcon"); - + ShipLogAstroObject astroObject = gameObject.AddComponent(); astroObject._id = ShipLogHandler.GetAstroObjectId(body); Texture2D image; Texture2D outline; - + string imagePath = body.Config.ShipLog?.mapMode?.revealedSprite; string outlinePath = body.Config.ShipLog?.mapMode?.outlineSprite; @@ -138,8 +134,8 @@ namespace NewHorizons.Builder.ShipLog return astroObject; } #endregion - - # region Details + + #region Details private static void MakeDetail(ShipLogModule.ShipLogDetailInfo info, Transform parent, NewHorizonsBody body, Material greyScaleMaterial) { GameObject detailGameObject = new GameObject("Detail"); @@ -207,18 +203,18 @@ namespace NewHorizons.Builder.ShipLog if (Main.Instance.CurrentStarSystem == "SolarSystem") { - + for (int y = 0; y < currentNav.Length; y++) { for (int x = 0; x < currentNav[y].Length; 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; @@ -291,7 +287,7 @@ namespace NewHorizons.Builder.ShipLog return navMatrix; } #endregion - + #region Automatic Map Mode private class MapModeObject { @@ -316,7 +312,7 @@ namespace NewHorizons.Builder.ShipLog parent?.IncrementHeight(); } } - + private static ShipLogAstroObject[][] ConstructMapModeAuto(List bodies, GameObject transformParent, Material greyScaleMaterial, int layer) { MapModeObject rootObject = ConstructPrimaryNode(bodies); @@ -328,7 +324,7 @@ namespace NewHorizons.Builder.ShipLog int maxAmount = bodies.Count; ShipLogAstroObject[][] navMatrix = new ShipLogAstroObject[maxAmount][]; for (int i = 0; i < maxAmount; i++) - { + { navMatrix[i] = new ShipLogAstroObject[maxAmount]; } @@ -363,7 +359,7 @@ namespace NewHorizons.Builder.ShipLog parentNode.children[i] = child; } } - + private static MapModeObject ConstructPrimaryNode(List bodies) { foreach (NewHorizonsBody body in bodies.Where(b => b.Config.Base.CenterOfSolarSystem)) @@ -390,7 +386,7 @@ namespace NewHorizons.Builder.ShipLog int newY = parent.y; int newLevel = parent.level + 1; MapModeObject lastSibling = parent; - + foreach (NewHorizonsBody body in searchList.Where(b => b.Config.Orbit.PrimaryBody == parent.mainBody.Config.Name || b.Config.Name == secondaryName)) { bool even = newLevel % 2 == 0; @@ -429,7 +425,7 @@ namespace NewHorizons.Builder.ShipLog } return children; } - + private static void ConnectNodeToLastSibling(MapModeObject node, Material greyScaleMaterial) { Vector2 fromPosition = node.astroObject.transform.localPosition; @@ -494,13 +490,13 @@ namespace NewHorizons.Builder.ShipLog MakeDetails(node.mainBody, newNodeGO.transform, greyScaleMaterial); } #endregion - + private static Texture2D AutoGenerateMapModePicture(NewHorizonsBody body) { Texture2D texture; - 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"); + 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 texture = ImageUtilities.GetTexture(Main.Instance, "AssetBundle/DefaultMapModePlanet.png"); var color = GetDominantPlanetColor(body); @@ -544,7 +540,7 @@ namespace NewHorizons.Builder.ShipLog var sandColor = body.Config.Sand?.Tint; 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."); } diff --git a/NewHorizons/Builder/ShipLog/RevealBuilder.cs b/NewHorizons/Builder/ShipLog/RevealBuilder.cs index 69df7055..7dceadc6 100644 --- a/NewHorizons/Builder/ShipLog/RevealBuilder.cs +++ b/NewHorizons/Builder/ShipLog/RevealBuilder.cs @@ -1,15 +1,7 @@ -using NewHorizons.Components; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Xml.Linq; -using NewHorizons.External; -using NewHorizons.Utility; +using NewHorizons.External.Modules; using OWML.Common; using UnityEngine; -using UnityEngine.UI; using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Builder.ShipLog { public static class RevealBuilder diff --git a/NewHorizons/Builder/ShipLog/RumorModeBuilder.cs b/NewHorizons/Builder/ShipLog/RumorModeBuilder.cs index 3f674c66..4dfa478b 100644 --- a/NewHorizons/Builder/ShipLog/RumorModeBuilder.cs +++ b/NewHorizons/Builder/ShipLog/RumorModeBuilder.cs @@ -1,17 +1,11 @@ -using System; -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.External.Modules; 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 { public static class RumorModeBuilder diff --git a/NewHorizons/Builder/StarSystem/SkyboxBuilder.cs b/NewHorizons/Builder/StarSystem/SkyboxBuilder.cs index df52bd55..02437a83 100644 --- a/NewHorizons/Builder/StarSystem/SkyboxBuilder.cs +++ b/NewHorizons/Builder/StarSystem/SkyboxBuilder.cs @@ -1,11 +1,8 @@ -using System; -using NewHorizons.External.Configs; +using NewHorizons.External.Configs; using NewHorizons.Utility; using OWML.Common; using UnityEngine; using Logger = NewHorizons.Utility.Logger; -using Object = System.Object; - namespace NewHorizons.Builder.StarSystem { public class SkyboxBuilder diff --git a/NewHorizons/Components/BlackHoleDestructionVolume.cs b/NewHorizons/Components/BlackHoleDestructionVolume.cs index 8c2d9ffc..8a24f510 100644 --- a/NewHorizons/Components/BlackHoleDestructionVolume.cs +++ b/NewHorizons/Components/BlackHoleDestructionVolume.cs @@ -1,28 +1,21 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Logger = NewHorizons.Utility.Logger; - -namespace NewHorizons.Components +namespace NewHorizons.Components { - public class BlackHoleDestructionVolume : DestructionVolume - { + public class BlackHoleDestructionVolume : DestructionVolume + { public override void Awake() { - base.Awake(); - _deathType = DeathType.BlackHole; + base.Awake(); + _deathType = DeathType.BlackHole; } public override void VanishProbe(OWRigidbody probeBody, RelativeLocationData entryLocation) - { - SurveyorProbe requiredComponent = probeBody.GetRequiredComponent(); - if (requiredComponent.IsLaunched()) - { - UnityEngine.Object.Destroy(requiredComponent.gameObject); - } - } - } + { + SurveyorProbe requiredComponent = probeBody.GetRequiredComponent(); + if (requiredComponent.IsLaunched()) + { + UnityEngine.Object.Destroy(requiredComponent.gameObject); + } + } + } } diff --git a/NewHorizons/Components/ChangeStarSystemVolume.cs b/NewHorizons/Components/ChangeStarSystemVolume.cs index 76bd3375..ea57c53f 100644 --- a/NewHorizons/Components/ChangeStarSystemVolume.cs +++ b/NewHorizons/Components/ChangeStarSystemVolume.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace NewHorizons.Components +namespace NewHorizons.Components { public class ChangeStarSystemVolume : BlackHoleDestructionVolume { @@ -18,7 +12,7 @@ namespace NewHorizons.Components 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) diff --git a/NewHorizons/Components/CloakSectorController.cs b/NewHorizons/Components/CloakSectorController.cs index 37cfc663..844a1a15 100644 --- a/NewHorizons/Components/CloakSectorController.cs +++ b/NewHorizons/Components/CloakSectorController.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; - namespace NewHorizons.Components { public class CloakSectorController : MonoBehaviour @@ -33,7 +29,7 @@ namespace NewHorizons.Components void OnDestroy() { - if(_isInitialized) + if (_isInitialized) { _cloak.OnPlayerEnter -= OnPlayerEnter; _cloak.OnPlayerExit -= OnPlayerExit; diff --git a/NewHorizons/Components/CloakedAudioSignal.cs b/NewHorizons/Components/CloakedAudioSignal.cs index a27fd795..1a26de62 100644 --- a/NewHorizons/Components/CloakedAudioSignal.cs +++ b/NewHorizons/Components/CloakedAudioSignal.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - +using UnityEngine; namespace NewHorizons.Components { public class CloakedAudioSignal : AudioSignal diff --git a/NewHorizons/Components/FunnelController.cs b/NewHorizons/Components/FunnelController.cs index 28857ad3..5e625e54 100644 --- a/NewHorizons/Components/FunnelController.cs +++ b/NewHorizons/Components/FunnelController.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - +using UnityEngine; namespace NewHorizons.Components { public class FunnelController : MonoBehaviour diff --git a/NewHorizons/Components/MapSatelliteOrbitFix.cs b/NewHorizons/Components/MapSatelliteOrbitFix.cs index fdb0ef59..46e1007e 100644 --- a/NewHorizons/Components/MapSatelliteOrbitFix.cs +++ b/NewHorizons/Components/MapSatelliteOrbitFix.cs @@ -1,12 +1,6 @@ using NewHorizons.Builder.General; using NewHorizons.External.Configs; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; - namespace NewHorizons.Components { public class MapSatelliteOrbitFix : MonoBehaviour diff --git a/NewHorizons/Components/NHFluidVolume.cs b/NewHorizons/Components/NHFluidVolume.cs index 3f01a0d1..3b19f04d 100644 --- a/NewHorizons/Components/NHFluidVolume.cs +++ b/NewHorizons/Components/NHFluidVolume.cs @@ -1,19 +1,13 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - +using UnityEngine; namespace NewHorizons.Components { public class NHFluidVolume : RadialFluidVolume { - public override float GetDepthAtPosition(Vector3 worldPosition) - { - Vector3 vector = transform.InverseTransformPoint(worldPosition); - float dist = Mathf.Sqrt(vector.x * vector.x + vector.z * vector.z + vector.y * vector.y); - return dist - _radius; - } - } + public override float GetDepthAtPosition(Vector3 worldPosition) + { + Vector3 vector = transform.InverseTransformPoint(worldPosition); + float dist = Mathf.Sqrt(vector.x * vector.x + vector.z * vector.z + vector.y * vector.y); + return dist - _radius; + } + } } diff --git a/NewHorizons/Components/NHProxy.cs b/NewHorizons/Components/NHProxy.cs index f71d3b25..6628a28b 100644 --- a/NewHorizons/Components/NHProxy.cs +++ b/NewHorizons/Components/NHProxy.cs @@ -1,7 +1,5 @@ using NewHorizons.Utility; -using System.Collections.Generic; using UnityEngine; - namespace NewHorizons.Components { public class NHProxy : ProxyPlanet diff --git a/NewHorizons/Components/NHTornadoWanderController.cs b/NewHorizons/Components/NHTornadoWanderController.cs index abb59c2e..89f1ffe8 100644 --- a/NewHorizons/Components/NHTornadoWanderController.cs +++ b/NewHorizons/Components/NHTornadoWanderController.cs @@ -1,11 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; +using UnityEngine; using Random = UnityEngine.Random; - namespace NewHorizons.Components { public class NHTornadoWanderController : MonoBehaviour diff --git a/NewHorizons/Components/Orbital/BinaryFocalPoint.cs b/NewHorizons/Components/Orbital/BinaryFocalPoint.cs index 45ba70f3..f1ce6d84 100644 --- a/NewHorizons/Components/Orbital/BinaryFocalPoint.cs +++ b/NewHorizons/Components/Orbital/BinaryFocalPoint.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - +using UnityEngine; namespace NewHorizons.Components.Orbital { public class BinaryFocalPoint : MonoBehaviour @@ -20,7 +14,7 @@ namespace NewHorizons.Components.Orbital void Start() { // Make sure its active but maybe it hasn't been set yet - if(FakeMassBody) FakeMassBody.SetActive(true); + if (FakeMassBody) FakeMassBody.SetActive(true); } void Update() @@ -28,7 +22,7 @@ namespace NewHorizons.Components.Orbital if (Primary == null || Secondary == null) return; // 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(); if (component.GetReferenceFrame(true) != null && component.GetReferenceFrame(true).GetOWRigidBody() == gameObject) diff --git a/NewHorizons/Components/Orbital/Gravity.cs b/NewHorizons/Components/Orbital/Gravity.cs index 2f733cd0..4cbd050c 100644 --- a/NewHorizons/Components/Orbital/Gravity.cs +++ b/NewHorizons/Components/Orbital/Gravity.cs @@ -1,11 +1,5 @@ -using NewHorizons.External; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using NewHorizons.External.Modules; using UnityEngine; - namespace NewHorizons.Components.Orbital { public class Gravity @@ -19,7 +13,7 @@ namespace NewHorizons.Components.Orbital Mass = mass; } - public Gravity(BaseModule module) + public Gravity(BaseModule module) { var surfaceAcceleration = module.SurfaceGravity; var upperSurfaceRadius = module.SurfaceSize; @@ -31,7 +25,7 @@ namespace NewHorizons.Components.Orbital public Gravity(GravityVolume gv) { - if(gv == null) + if (gv == null) { Mass = 0; Power = 2; diff --git a/NewHorizons/Components/Orbital/IOrbitalParameters.cs b/NewHorizons/Components/Orbital/IOrbitalParameters.cs index ddbb2a28..420e21f9 100644 --- a/NewHorizons/Components/Orbital/IOrbitalParameters.cs +++ b/NewHorizons/Components/Orbital/IOrbitalParameters.cs @@ -1,10 +1,4 @@ -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 interface IOrbitalParameters { diff --git a/NewHorizons/Components/Orbital/NHAstroObject.cs b/NewHorizons/Components/Orbital/NHAstroObject.cs index 45becab3..b16ec603 100644 --- a/NewHorizons/Components/Orbital/NHAstroObject.cs +++ b/NewHorizons/Components/Orbital/NHAstroObject.cs @@ -1,10 +1,4 @@ -using NewHorizons.External; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - +using NewHorizons.External.Modules; namespace NewHorizons.Components.Orbital { public class NHAstroObject : AstroObject, IOrbitalParameters diff --git a/NewHorizons/Components/Orbital/NHOrbitLine.cs b/NewHorizons/Components/Orbital/NHOrbitLine.cs index 44af0e11..bf894e77 100644 --- a/NewHorizons/Components/Orbital/NHOrbitLine.cs +++ b/NewHorizons/Components/Orbital/NHOrbitLine.cs @@ -1,119 +1,114 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Components.Orbital { public class NHOrbitLine : OrbitLine { - public Vector3 SemiMajorAxis { get; set; } - public Vector3 SemiMinorAxis { get; set; } + public Vector3 SemiMajorAxis { get; set; } + public Vector3 SemiMinorAxis { get; set; } - private Vector3 _upAxis; - private float _fociDistance; - private Vector3[] _verts; + private Vector3 _upAxis; + private float _fociDistance; + private Vector3[] _verts; - private float semiMajorAxis; - private float semiMinorAxis; + private float semiMajorAxis; + private float semiMinorAxis; - public override void InitializeLineRenderer() - { - base.GetComponent().positionCount = this._numVerts; - } + public override void InitializeLineRenderer() + { + base.GetComponent().positionCount = this._numVerts; + } - public override void OnValidate() - { - if (_numVerts < 0 || _numVerts > 4096) - { - _numVerts = Mathf.Clamp(_numVerts, 0, 4096); - } - if (base.GetComponent().positionCount != this._numVerts) - { - InitializeLineRenderer(); - } - } + public override void OnValidate() + { + if (_numVerts < 0 || _numVerts > 4096) + { + _numVerts = Mathf.Clamp(_numVerts, 0, 4096); + } + if (base.GetComponent().positionCount != this._numVerts) + { + InitializeLineRenderer(); + } + } - public override void Start() - { - base.Start(); + public override void Start() + { + base.Start(); - var a = SemiMajorAxis.magnitude; - var b = SemiMinorAxis.magnitude; + var a = SemiMajorAxis.magnitude; + var b = SemiMinorAxis.magnitude; - _upAxis = Vector3.Cross(SemiMajorAxis.normalized, SemiMinorAxis.normalized); + _upAxis = Vector3.Cross(SemiMajorAxis.normalized, SemiMinorAxis.normalized); - _fociDistance = Mathf.Sqrt(a * a - b * b); - if (float.IsNaN(_fociDistance)) _fociDistance = 0f; + _fociDistance = Mathf.Sqrt(a * a - b * b); + if (float.IsNaN(_fociDistance)) _fociDistance = 0f; - _verts = new Vector3[this._numVerts]; + _verts = new Vector3[this._numVerts]; - transform.localRotation = Quaternion.Euler(270, 90, 0); + transform.localRotation = Quaternion.Euler(270, 90, 0); - semiMajorAxis = SemiMajorAxis.magnitude; - semiMinorAxis = SemiMinorAxis.magnitude; + semiMajorAxis = SemiMajorAxis.magnitude; + semiMinorAxis = SemiMinorAxis.magnitude; - base.enabled = false; - } + base.enabled = false; + } - public override void Update() - { + public override void Update() + { try { - AstroObject primary = _astroObject?.GetPrimaryBody(); + AstroObject primary = _astroObject?.GetPrimaryBody(); - // If it has nothing to orbit then why is this here - if (primary == null) - { - base.enabled = false; - return; - } + // If it has nothing to orbit then why is this here + if (primary == null) + { + base.enabled = false; + return; + } - Vector3 origin = primary.transform.position + SemiMajorAxis.normalized * _fociDistance; + Vector3 origin = primary.transform.position + SemiMajorAxis.normalized * _fociDistance; - float num = CalcProjectedAngleToCenter(origin, SemiMajorAxis, SemiMinorAxis, _astroObject.transform.position); + float num = CalcProjectedAngleToCenter(origin, SemiMajorAxis, SemiMinorAxis, _astroObject.transform.position); - for (int i = 0; i < _numVerts; i++) - { - var stepSize = 2f * Mathf.PI / (float)(_numVerts - 1); - float f = num + stepSize * i; - _verts[i] = SemiMajorAxis * Mathf.Cos(f) + SemiMinorAxis * Mathf.Sin(f); - } - _lineRenderer.SetPositions(_verts); + for (int i = 0; i < _numVerts; i++) + { + var stepSize = 2f * Mathf.PI / (float)(_numVerts - 1); + float f = num + stepSize * i; + _verts[i] = SemiMajorAxis * Mathf.Cos(f) + SemiMinorAxis * Mathf.Sin(f); + } + _lineRenderer.SetPositions(_verts); - transform.position = origin; - transform.rotation = Quaternion.Euler(0, 0, 0); //Quaternion.LookRotation(-SemiMajorAxis, _upAxis); + transform.position = origin; + transform.rotation = Quaternion.Euler(0, 0, 0); //Quaternion.LookRotation(-SemiMajorAxis, _upAxis); - float num2 = DistanceToEllipticalOrbitLine(origin, SemiMajorAxis, SemiMinorAxis, _upAxis, Locator.GetActiveCamera().transform.position); - float widthMultiplier = Mathf.Min(num2 * (_lineWidth / 1000f), _maxLineWidth); - float num3 = _fade ? (1f - Mathf.Clamp01((num2 - _fadeStartDist) / (_fadeEndDist - _fadeStartDist))) : 1f; + float num2 = DistanceToEllipticalOrbitLine(origin, SemiMajorAxis, SemiMinorAxis, _upAxis, Locator.GetActiveCamera().transform.position); + float widthMultiplier = Mathf.Min(num2 * (_lineWidth / 1000f), _maxLineWidth); + float num3 = _fade ? (1f - Mathf.Clamp01((num2 - _fadeStartDist) / (_fadeEndDist - _fadeStartDist))) : 1f; - _lineRenderer.widthMultiplier = widthMultiplier; - _lineRenderer.startColor = new Color(_color.r, _color.g, _color.b, num3 * num3); - } - catch(Exception ex) - { - Logger.LogError($"Exception in OrbitLine for [{_astroObject?.name}] : {ex.Message}, {ex.StackTrace}"); - enabled = false; + _lineRenderer.widthMultiplier = widthMultiplier; + _lineRenderer.startColor = new Color(_color.r, _color.g, _color.b, num3 * num3); } - } + catch (Exception ex) + { + Logger.LogError($"Exception in OrbitLine for [{_astroObject?.name}] : {ex.Message}, {ex.StackTrace}"); + enabled = false; + } + } - private float CalcProjectedAngleToCenter(Vector3 foci, Vector3 semiMajorAxis, Vector3 semiMinorAxis, Vector3 point) - { - Vector3 lhs = point - foci; - Vector3 vector = new Vector3(Vector3.Dot(lhs, semiMajorAxis.normalized), 0f, Vector3.Dot(lhs, semiMinorAxis.normalized)); - vector.x *= semiMinorAxis.magnitude / semiMajorAxis.magnitude; - return Mathf.Atan2(vector.z, vector.x); - } + private float CalcProjectedAngleToCenter(Vector3 foci, Vector3 semiMajorAxis, Vector3 semiMinorAxis, Vector3 point) + { + Vector3 lhs = point - foci; + Vector3 vector = new Vector3(Vector3.Dot(lhs, semiMajorAxis.normalized), 0f, Vector3.Dot(lhs, semiMinorAxis.normalized)); + vector.x *= semiMinorAxis.magnitude / semiMajorAxis.magnitude; + return Mathf.Atan2(vector.z, vector.x); + } - private float DistanceToEllipticalOrbitLine(Vector3 foci, Vector3 semiMajorAxis, Vector3 semiMinorAxis, Vector3 upAxis, Vector3 point) - { - float f = CalcProjectedAngleToCenter(foci, semiMajorAxis, semiMinorAxis, point); - Vector3 b = foci + SemiMajorAxis * Mathf.Cos(f) + SemiMinorAxis * Mathf.Sin(f); - return Vector3.Distance(point, b); - } - } + private float DistanceToEllipticalOrbitLine(Vector3 foci, Vector3 semiMajorAxis, Vector3 semiMinorAxis, Vector3 upAxis, Vector3 point) + { + float f = CalcProjectedAngleToCenter(foci, semiMajorAxis, semiMinorAxis, point); + Vector3 b = foci + SemiMajorAxis * Mathf.Cos(f) + SemiMinorAxis * Mathf.Sin(f); + return Vector3.Distance(point, b); + } + } } diff --git a/NewHorizons/Components/Orbital/OrbitalParameters.cs b/NewHorizons/Components/Orbital/OrbitalParameters.cs index e3ad1b70..f7a3bf3a 100644 --- a/NewHorizons/Components/Orbital/OrbitalParameters.cs +++ b/NewHorizons/Components/Orbital/OrbitalParameters.cs @@ -1,11 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Components.Orbital { public class OrbitalParameters : IOrbitalParameters @@ -25,14 +19,14 @@ namespace NewHorizons.Components.Orbital public static OrbitalParameters FromTrueAnomaly(Gravity primaryGravity, Gravity secondaryGravity, float eccentricity, float semiMajorAxis, float inclination, float argumentOfPeriapsis, float longitudeOfAscendingNode, float trueAnomaly) { var orbitalParameters = new OrbitalParameters(); - orbitalParameters.Inclination = inclination; + orbitalParameters.Inclination = inclination; orbitalParameters.SemiMajorAxis = semiMajorAxis; orbitalParameters.LongitudeOfAscendingNode = longitudeOfAscendingNode; orbitalParameters.Eccentricity = eccentricity; - 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(primaryGravity.Power == 1 && eccentricity != 0) + if (primaryGravity.Power == 1 && eccentricity != 0) { trueAnomaly = 0; } @@ -45,7 +39,7 @@ namespace NewHorizons.Components.Orbital var secondaryMass = secondaryGravity.Mass; 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; @@ -63,10 +57,10 @@ namespace NewHorizons.Components.Orbital float v; // For linear - if(primaryGravity.Power == 1) + if (primaryGravity.Power == 1) { // Have to deal with a limit - if(eccentricity == 0) + if (eccentricity == 0) { var v2 = 2 * mu * (Mathf.Log(r_a / r) + (1 / 2f)); v = Mathf.Sqrt(v2); diff --git a/NewHorizons/Components/Orbital/TrackingOrbitLine.cs b/NewHorizons/Components/Orbital/TrackingOrbitLine.cs index fb10f0bc..11169460 100644 --- a/NewHorizons/Components/Orbital/TrackingOrbitLine.cs +++ b/NewHorizons/Components/Orbital/TrackingOrbitLine.cs @@ -1,125 +1,120 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Components.Orbital { - public class TrackingOrbitLine : OrbitLine - { - private Vector3[] _vertices; - private float _timer; - private bool _firstTimeEnabled = true; + public class TrackingOrbitLine : OrbitLine + { + private Vector3[] _vertices; + private float _timer; + private bool _firstTimeEnabled = true; - public float TrailTime = 120f; + public float TrailTime = 120f; - public override void InitializeLineRenderer() - { - _lineRenderer.positionCount = this._numVerts; - } + public override void InitializeLineRenderer() + { + _lineRenderer.positionCount = this._numVerts; + } - public override void OnValidate() - { - if (_numVerts < 0 || _numVerts > 4096) - { - _numVerts = Mathf.Clamp(this._numVerts, 0, 4096); - } - if (_lineRenderer.positionCount != _numVerts) - { - InitializeLineRenderer(); - } - } + public override void OnValidate() + { + if (_numVerts < 0 || _numVerts > 4096) + { + _numVerts = Mathf.Clamp(this._numVerts, 0, 4096); + } + if (_lineRenderer.positionCount != _numVerts) + { + InitializeLineRenderer(); + } + } - public override void Start() - { - base.Start(); - _vertices = new Vector3[_numVerts]; + public override void Start() + { + base.Start(); + _vertices = new Vector3[_numVerts]; - base.enabled = true; - _lineRenderer.enabled = false; - } + base.enabled = true; + _lineRenderer.enabled = false; + } - public override void OnEnterMapView() - { - if (_firstTimeEnabled) - { - ResetLineVertices(); - _firstTimeEnabled = false; - } - _lineRenderer.enabled = true; - } + public override void OnEnterMapView() + { + if (_firstTimeEnabled) + { + ResetLineVertices(); + _firstTimeEnabled = false; + } + _lineRenderer.enabled = true; + } - public override void OnExitMapView() - { - _lineRenderer.enabled = false; - } + public override void OnExitMapView() + { + _lineRenderer.enabled = false; + } - public override void Update() - { - try - { - var primary = _astroObject.GetPrimaryBody(); - Vector3 origin = primary == null ? Locator.GetRootTransform().position : primary.transform.position; + public override void Update() + { + try + { + var primary = _astroObject.GetPrimaryBody(); + Vector3 origin = primary == null ? Locator.GetRootTransform().position : primary.transform.position; - _timer += Time.deltaTime; - var updateTime = (TrailTime / (float)_numVerts); + _timer += Time.deltaTime; + var updateTime = (TrailTime / (float)_numVerts); - if (_timer > updateTime) - { - for (int i = _numVerts - 1; i > 0; i--) - { - var v = _vertices[i - 1]; - _vertices[i] = new Vector3(v.x, v.y, v.z); - } - _timer = 0; - } - _vertices[0] = transform.parent.position - origin; - _lineRenderer.SetPositions(_vertices); + if (_timer > updateTime) + { + for (int i = _numVerts - 1; i > 0; i--) + { + var v = _vertices[i - 1]; + _vertices[i] = new Vector3(v.x, v.y, v.z); + } + _timer = 0; + } + _vertices[0] = transform.parent.position - origin; + _lineRenderer.SetPositions(_vertices); - base.transform.position = origin; - base.transform.rotation = Quaternion.AngleAxis(0f, Vector3.up); + base.transform.position = origin; + base.transform.rotation = Quaternion.AngleAxis(0f, Vector3.up); - float num2 = DistanceToTrackingOrbitLine(Locator.GetActiveCamera().transform.position); - float widthMultiplier = Mathf.Min(num2 * (_lineWidth / 1000f), _maxLineWidth); - float num3 = _fade ? (1f - Mathf.Clamp01((num2 - _fadeStartDist) / (_fadeEndDist - _fadeStartDist))) : 1f; - _lineRenderer.widthMultiplier = widthMultiplier; - _lineRenderer.startColor = new Color(_color.r, _color.g, _color.b, num3 * num3); - } - catch (Exception ex) - { - Logger.LogError($"Exception in OrbitLine for [{_astroObject?.name}] : {ex.Message}, {ex.StackTrace}"); - enabled = false; - } - } + float num2 = DistanceToTrackingOrbitLine(Locator.GetActiveCamera().transform.position); + float widthMultiplier = Mathf.Min(num2 * (_lineWidth / 1000f), _maxLineWidth); + float num3 = _fade ? (1f - Mathf.Clamp01((num2 - _fadeStartDist) / (_fadeEndDist - _fadeStartDist))) : 1f; + _lineRenderer.widthMultiplier = widthMultiplier; + _lineRenderer.startColor = new Color(_color.r, _color.g, _color.b, num3 * num3); + } + catch (Exception ex) + { + Logger.LogError($"Exception in OrbitLine for [{_astroObject?.name}] : {ex.Message}, {ex.StackTrace}"); + enabled = false; + } + } - private float DistanceToTrackingOrbitLine(Vector3 point) - { - // Check against 3 points on the line - var primary = _astroObject.GetPrimaryBody(); - point -= primary.transform.position; - var dist1 = Vector3.Distance(point, _vertices[0]); - var dist2 = Vector3.Distance(point, _vertices[(int)(_numVerts / 2)]); - var dist3 = Vector3.Distance(point, _vertices[_numVerts - 1]); + private float DistanceToTrackingOrbitLine(Vector3 point) + { + // Check against 3 points on the line + var primary = _astroObject.GetPrimaryBody(); + point -= primary.transform.position; + var dist1 = Vector3.Distance(point, _vertices[0]); + var dist2 = Vector3.Distance(point, _vertices[(int)(_numVerts / 2)]); + var dist3 = Vector3.Distance(point, _vertices[_numVerts - 1]); - return Mathf.Min(new float[] { dist1, dist2, dist3 }); - } + return Mathf.Min(new float[] { dist1, dist2, dist3 }); + } - public void ResetLineVertices() - { - var primary = _astroObject.GetPrimaryBody(); - Vector3 origin = primary == null ? Locator.GetRootTransform().position : primary.transform.position; + public void ResetLineVertices() + { + var primary = _astroObject.GetPrimaryBody(); + Vector3 origin = primary == null ? Locator.GetRootTransform().position : primary.transform.position; - base.transform.position = origin; - base.transform.rotation = Quaternion.AngleAxis(0f, Vector3.up); + base.transform.position = origin; + base.transform.rotation = Quaternion.AngleAxis(0f, Vector3.up); - for (int i = _numVerts - 1; i > 0; i--) - { - _vertices[i] = transform.parent.position - origin; - } - _lineRenderer.SetPositions(_vertices); - } - } + for (int i = _numVerts - 1; i > 0; i--) + { + _vertices[i] = transform.parent.position - origin; + } + _lineRenderer.SetPositions(_vertices); + } + } } \ No newline at end of file diff --git a/NewHorizons/Components/QuantumPlanet.cs b/NewHorizons/Components/QuantumPlanet.cs index eac3fa39..2a32e6b3 100644 --- a/NewHorizons/Components/QuantumPlanet.cs +++ b/NewHorizons/Components/QuantumPlanet.cs @@ -1,18 +1,12 @@ using NewHorizons.Builder.General; -using NewHorizons.Builder.Orbital; using NewHorizons.Components.Orbital; -using NewHorizons.External; +using NewHorizons.External.Modules; using NewHorizons.Handlers; using NewHorizons.Utility; -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 Random = UnityEngine.Random; namespace NewHorizons.Components { public class QuantumPlanet : QuantumObject @@ -64,7 +58,7 @@ namespace NewHorizons.Components var canChange = false; var oldState = states[_currentIndex]; - + // This will all get set in the for loop State newState = oldState; int newIndex = _currentIndex; @@ -106,7 +100,7 @@ namespace NewHorizons.Components } } - if(canChange) + if (canChange) { if (newState.sector != null && newState.sector != oldState.sector) SetNewSector(oldState, newState); if (newState.orbit != null && newState.orbit != oldState.orbit) SetNewOrbit(primaryBody, orbitalParams); diff --git a/NewHorizons/Components/RingShape.cs b/NewHorizons/Components/RingShape.cs index cb35b9e2..e8d30478 100644 --- a/NewHorizons/Components/RingShape.cs +++ b/NewHorizons/Components/RingShape.cs @@ -1,7 +1,5 @@ using System.Collections.Generic; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Components { public class RingShape : Shape diff --git a/NewHorizons/Components/ShipLogDetail.cs b/NewHorizons/Components/ShipLogDetail.cs index e1936a30..a2ce809d 100644 --- a/NewHorizons/Components/ShipLogDetail.cs +++ b/NewHorizons/Components/ShipLogDetail.cs @@ -1,10 +1,7 @@ -using System; -using NewHorizons.External; -using OWML.Common; +using NewHorizons.External.Modules; using UnityEngine; using UnityEngine.UI; using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Components { public class ShipLogDetail : MonoBehaviour @@ -13,7 +10,7 @@ namespace NewHorizons.Components private Image _outlineImage; private Material _greyScaleMaterial; private ShipLogModule.ShipLogDetailInfo _detailInfo; - + public void Init(ShipLogModule.ShipLogDetailInfo info, Image revealed, Image outline, Material greyScale) { _detailInfo = info; diff --git a/NewHorizons/Components/ShipLogStarChartMode.cs b/NewHorizons/Components/ShipLogStarChartMode.cs index a5025bd2..7797ff07 100644 --- a/NewHorizons/Components/ShipLogStarChartMode.cs +++ b/NewHorizons/Components/ShipLogStarChartMode.cs @@ -1,15 +1,10 @@ -using System; +using NewHorizons.Handlers; +using NewHorizons.Utility; +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 UnityEngine.UI; -using OWML.Common; -using NewHorizons.Handlers; - namespace NewHorizons.Components { public class ShipLogStarChartMode : ShipLogMode @@ -112,7 +107,7 @@ namespace NewHorizons.Components private void OnEnterFlightConsole(OWRigidbody _) { _isAtFlightConsole = true; - if(_target != null) + if (_target != null) { _warpPrompt.SetVisibility(true); } @@ -131,7 +126,7 @@ namespace NewHorizons.Components private void OnGameUnpaused() { - if(_target != null && _isAtFlightConsole) + if (_target != null && _isAtFlightConsole) { _warpPrompt.SetVisibility(true); } @@ -175,7 +170,7 @@ namespace NewHorizons.Components } catch (Exception) { } - if(texture != null) + if (texture != null) { shipLogEntryCard._photo.sprite = MakeSprite((Texture2D)texture); newCard.transform.Find("EntryCardRoot/EntryCardBackground/PhotoImage").gameObject.SetActive(true); @@ -321,9 +316,9 @@ namespace NewHorizons.Components 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(playSound) _oneShotSource.PlayOneShot(global::AudioType.ShipLogMarkLocation, 1f); + if (playSound) _oneShotSource.PlayOneShot(global::AudioType.ShipLogMarkLocation, 1f); _target.SetMarkedOnHUD(false); _target = null; diff --git a/NewHorizons/Components/ShipWarpController.cs b/NewHorizons/Components/ShipWarpController.cs index 8ea1c31d..470dc432 100644 --- a/NewHorizons/Components/ShipWarpController.cs +++ b/NewHorizons/Components/ShipWarpController.cs @@ -1,13 +1,6 @@ using NewHorizons.Builder.General; -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; - namespace NewHorizons.Components { public class ShipWarpController : MonoBehaviour @@ -124,7 +117,7 @@ namespace NewHorizons.Components public void Update() { - if(_isWarpingIn && LateInitializerManager.isDoneInitializing) + if (_isWarpingIn && LateInitializerManager.isDoneInitializing) { Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => StartWarpInEffect(), 1); _isWarpingIn = false; @@ -188,7 +181,7 @@ namespace NewHorizons.Components Locator.GetDeathManager()._invincible = false; // 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(); var atmoVolume = GameObject.Find("Ship_Body/Volumes/ShipAtmosphereVolume").GetComponent(); diff --git a/NewHorizons/Components/SizeControllers/SizeController.cs b/NewHorizons/Components/SizeControllers/SizeController.cs index 4a071a2f..0b426a7b 100644 --- a/NewHorizons/Components/SizeControllers/SizeController.cs +++ b/NewHorizons/Components/SizeControllers/SizeController.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - +using UnityEngine; namespace NewHorizons.Components.SizeControllers { public class SizeController : MonoBehaviour diff --git a/NewHorizons/Components/SizeControllers/StarAtmosphereSizeController.cs b/NewHorizons/Components/SizeControllers/StarAtmosphereSizeController.cs index be295f0b..54df36e1 100644 --- a/NewHorizons/Components/SizeControllers/StarAtmosphereSizeController.cs +++ b/NewHorizons/Components/SizeControllers/StarAtmosphereSizeController.cs @@ -1,11 +1,5 @@ using NewHorizons.Builder.Body; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; - namespace NewHorizons.Components.SizeControllers { public class StarAtmosphereSizeController : SizeController diff --git a/NewHorizons/Components/SizeControllers/WaterSizeController.cs b/NewHorizons/Components/SizeControllers/WaterSizeController.cs index 9cb70903..a7d5d43c 100644 --- a/NewHorizons/Components/SizeControllers/WaterSizeController.cs +++ b/NewHorizons/Components/SizeControllers/WaterSizeController.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - +using UnityEngine; namespace NewHorizons.Components.SizeControllers { public class WaterSizeController : SizeController diff --git a/NewHorizons/Components/StarController.cs b/NewHorizons/Components/StarController.cs index a0a0dbb1..4090a0f9 100644 --- a/NewHorizons/Components/StarController.cs +++ b/NewHorizons/Components/StarController.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - +using UnityEngine; namespace NewHorizons.Components { public class StarController : MonoBehaviour @@ -15,7 +9,7 @@ namespace NewHorizons.Components public CSMTextureCacher CSMTextureCacher; public ProxyShadowLight ProxyShadowLight; public float Intensity; - public Color SunColor; + public Color SunColor; public void Awake() { diff --git a/NewHorizons/Components/StarLightController.cs b/NewHorizons/Components/StarLightController.cs index fabe441e..7e46459d 100644 --- a/NewHorizons/Components/StarLightController.cs +++ b/NewHorizons/Components/StarLightController.cs @@ -1,12 +1,6 @@ -using NewHorizons.Utility; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; using UnityEngine; using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Components { [RequireComponent(typeof(SunLightController))] @@ -46,7 +40,7 @@ namespace NewHorizons.Components if (Instance._activeStar != null && Instance._activeStar.Equals(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 { @@ -66,7 +60,7 @@ namespace NewHorizons.Components return; } - foreach(var star in _stars) + foreach (var star in _stars) { if (star == null) continue; @@ -89,7 +83,7 @@ namespace NewHorizons.Components { if (_sunLightController == null || _sunLightParamUpdater == null) return; - if(_activeStar != null) _activeStar.Disable(); + if (_activeStar != null) _activeStar.Disable(); Logger.Log($"Switching active star: {star.gameObject.name}"); @@ -101,7 +95,7 @@ namespace NewHorizons.Components _sunLightController._sunBaseIntensity = star.Intensity; _sunLightController._sunLight = star.Light; _sunLightController._ambientLight = star.AmbientLight; - + _sunLightParamUpdater.sunLight = star.Light; _sunLightParamUpdater._sunController = star.transform.GetComponent(); _sunLightParamUpdater._propID_SunPosition = Shader.PropertyToID("_SunPosition"); diff --git a/NewHorizons/Components/TimeLoopController.cs b/NewHorizons/Components/TimeLoopController.cs index 0ad6a7ef..2e739b2a 100644 --- a/NewHorizons/Components/TimeLoopController.cs +++ b/NewHorizons/Components/TimeLoopController.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - +using UnityEngine; namespace NewHorizons.Components { public class TimeLoopController : MonoBehaviour @@ -21,7 +15,7 @@ namespace NewHorizons.Components { // Stock gives like 33 seconds after the sun collapses // 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); } diff --git a/NewHorizons/Components/TornadoFix.cs b/NewHorizons/Components/TornadoFix.cs index 0968451e..a0283013 100644 --- a/NewHorizons/Components/TornadoFix.cs +++ b/NewHorizons/Components/TornadoFix.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace NewHorizons.Components +namespace NewHorizons.Components { public class TornadoFix : SectoredMonoBehaviour { @@ -19,7 +12,7 @@ namespace NewHorizons.Components tornadoController._formationDuration = 1f; tornadoController._collapseDuration = 1f; - if(_sector != null) + if (_sector != null) { _sector.OnOccupantEnterSector += OnOccupantEnterSector; _sector.OnOccupantExitSector += OnOccupantExitSector; @@ -28,7 +21,7 @@ namespace NewHorizons.Components public new void SetSector(Sector sector) { - if(_sector != null) + if (_sector != null) { _sector.OnOccupantEnterSector -= OnOccupantEnterSector; _sector.OnOccupantExitSector -= OnOccupantExitSector; diff --git a/NewHorizons/External/Configs/Config.cs b/NewHorizons/External/Configs/Config.cs index a16d6ec5..e2b971a7 100644 --- a/NewHorizons/External/Configs/Config.cs +++ b/NewHorizons/External/Configs/Config.cs @@ -1,10 +1,7 @@ -using NewHorizons.Utility; +using NewHorizons.External.Modules; +using NewHorizons.Utility; using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace NewHorizons.External.Configs { public class Config diff --git a/NewHorizons/External/Configs/IPlanetConfig.cs b/NewHorizons/External/Configs/IPlanetConfig.cs deleted file mode 100644 index 6bdf8764..00000000 --- a/NewHorizons/External/Configs/IPlanetConfig.cs +++ /dev/null @@ -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; } - } -} diff --git a/NewHorizons/External/Configs/PlanetConfig.cs b/NewHorizons/External/Configs/PlanetConfig.cs index f72e3d92..d0e2831f 100644 --- a/NewHorizons/External/Configs/PlanetConfig.cs +++ b/NewHorizons/External/Configs/PlanetConfig.cs @@ -1,14 +1,13 @@ -using NewHorizons.External.VariableSize; -using NewHorizons.Utility; -using System; +using NewHorizons.External.Modules; +using NewHorizons.External.Modules.VariableSize; using System.Collections.Generic; -using System.Globalization; namespace NewHorizons.External.Configs { - public class PlanetConfig : Config, IPlanetConfig + public class PlanetConfig : Config { public string Name { get; set; } + public string Version { get; set; } public string StarSystem { get; set; } = "SolarSystem"; public bool Destroy { get; set; } public string[] ChildrenToDestroy { get; set; } @@ -37,9 +36,39 @@ namespace NewHorizons.External.Configs public PlanetConfig(Dictionary dict) : base(dict) { // Always have to have a base module - if(Base == null) Base = new BaseModule(); - if(Orbit == null) Orbit = new OrbitModule(); + if (Base == null) Base = new BaseModule(); + if (Orbit == null) Orbit = new OrbitModule(); 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; + } + } } } diff --git a/NewHorizons/External/Configs/StarSystemConfig.cs b/NewHorizons/External/Configs/StarSystemConfig.cs index 1447dd8d..669728a3 100644 --- a/NewHorizons/External/Configs/StarSystemConfig.cs +++ b/NewHorizons/External/Configs/StarSystemConfig.cs @@ -1,10 +1,4 @@ -using NewHorizons.Utility; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - +using System.Collections.Generic; namespace NewHorizons.External.Configs { public class StarSystemConfig : Config @@ -32,6 +26,6 @@ namespace NewHorizons.External.Configs } public StarSystemConfig(Dictionary dict) : base(dict) { } - + } } diff --git a/NewHorizons/External/Configs/TranslationConfig.cs b/NewHorizons/External/Configs/TranslationConfig.cs index db1d17b7..b74de998 100644 --- a/NewHorizons/External/Configs/TranslationConfig.cs +++ b/NewHorizons/External/Configs/TranslationConfig.cs @@ -1,12 +1,6 @@ using Newtonsoft.Json.Linq; -using System; using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.External.Configs { public class TranslationConfig @@ -19,7 +13,7 @@ namespace NewHorizons.External.Configs { Dictionary dict = JObject.Parse(File.ReadAllText(filename)).ToObject>(); - if(dict.ContainsKey(nameof(DialogueDictionary))) + if (dict.ContainsKey(nameof(DialogueDictionary))) { DialogueDictionary = (Dictionary)(dict[nameof(DialogueDictionary)] as Newtonsoft.Json.Linq.JObject).ToObject(typeof(Dictionary)); } diff --git a/NewHorizons/External/FocalPointModule.cs b/NewHorizons/External/FocalPointModule.cs deleted file mode 100644 index 41a5de50..00000000 --- a/NewHorizons/External/FocalPointModule.cs +++ /dev/null @@ -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; } - } -} diff --git a/NewHorizons/External/AsteroidBeltModule.cs b/NewHorizons/External/Modules/AsteroidBeltModule.cs similarity index 76% rename from NewHorizons/External/AsteroidBeltModule.cs rename to NewHorizons/External/Modules/AsteroidBeltModule.cs index 42cf1a64..404adb6e 100644 --- a/NewHorizons/External/AsteroidBeltModule.cs +++ b/NewHorizons/External/Modules/AsteroidBeltModule.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace NewHorizons.External +namespace NewHorizons.External.Modules { public class AsteroidBeltModule : Module { diff --git a/NewHorizons/External/AtmosphereModule.cs b/NewHorizons/External/Modules/AtmosphereModule.cs similarity index 87% rename from NewHorizons/External/AtmosphereModule.cs rename to NewHorizons/External/Modules/AtmosphereModule.cs index 79d723dc..77e2bd93 100644 --- a/NewHorizons/External/AtmosphereModule.cs +++ b/NewHorizons/External/Modules/AtmosphereModule.cs @@ -1,11 +1,5 @@ using NewHorizons.Utility; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace NewHorizons.External +namespace NewHorizons.External.Modules { public class AtmosphereModule : Module { diff --git a/NewHorizons/External/BaseModule.cs b/NewHorizons/External/Modules/BaseModule.cs similarity index 68% rename from NewHorizons/External/BaseModule.cs rename to NewHorizons/External/Modules/BaseModule.cs index 7f735305..6a60b0b7 100644 --- a/NewHorizons/External/BaseModule.cs +++ b/NewHorizons/External/Modules/BaseModule.cs @@ -1,11 +1,5 @@ using NewHorizons.Utility; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace NewHorizons.External +namespace NewHorizons.External.Modules { public class BaseModule : Module { @@ -20,14 +14,16 @@ namespace NewHorizons.External public MVector3 CometTailRotation { get; set; } public bool HasReferenceFrame { get; set; } = true; public bool CenterOfSolarSystem { get; set; } = false; - public bool IsSatellite { get; set; } public float CloakRadius { get; set; } = 0f; public bool InvulnerableToSun { get; set; } + public bool ShowMinimap { get; set; } = true; - // Old, see SingularityModule instead - public float BlackHoleSize { get; set; } - public float LavaSize { get; set; } - public float WaterSize { get; set; } - public MColor WaterTint { get; set; } + + // Obsolete + public bool IsSatellite { get; set; } + public float BlackHoleSize { get; set; } + public float LavaSize { get; set; } + public float WaterSize { get; set; } + public MColor WaterTint { get; set; } } } diff --git a/NewHorizons/External/Modules/FocalPointModule.cs b/NewHorizons/External/Modules/FocalPointModule.cs new file mode 100644 index 00000000..02bca3e0 --- /dev/null +++ b/NewHorizons/External/Modules/FocalPointModule.cs @@ -0,0 +1,8 @@ +namespace NewHorizons.External.Modules +{ + public class FocalPointModule + { + public string Primary { get; set; } + public string Secondary { get; set; } + } +} diff --git a/NewHorizons/External/HeightMapModule.cs b/NewHorizons/External/Modules/HeightMapModule.cs similarity index 86% rename from NewHorizons/External/HeightMapModule.cs rename to NewHorizons/External/Modules/HeightMapModule.cs index f859e949..b552ae38 100644 --- a/NewHorizons/External/HeightMapModule.cs +++ b/NewHorizons/External/Modules/HeightMapModule.cs @@ -1,7 +1,5 @@ using NewHorizons.Utility; -using UnityEngine; - -namespace NewHorizons.External +namespace NewHorizons.External.Modules { public class HeightMapModule : Module { diff --git a/NewHorizons/External/Module.cs b/NewHorizons/External/Modules/Module.cs similarity index 79% rename from NewHorizons/External/Module.cs rename to NewHorizons/External/Modules/Module.cs index 922ffcd7..b02c63a0 100644 --- a/NewHorizons/External/Module.cs +++ b/NewHorizons/External/Modules/Module.cs @@ -1,11 +1,6 @@ -using NewHorizons.Utility; -using System; +using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace NewHorizons.External +namespace NewHorizons.External.Modules { public abstract class Module { diff --git a/NewHorizons/External/NewHorizonsData.cs b/NewHorizons/External/Modules/NewHorizonsData.cs similarity index 91% rename from NewHorizons/External/NewHorizonsData.cs rename to NewHorizons/External/Modules/NewHorizonsData.cs index 124729b2..5cc5e25f 100644 --- a/NewHorizons/External/NewHorizonsData.cs +++ b/NewHorizons/External/Modules/NewHorizonsData.cs @@ -1,12 +1,7 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using NewHorizons.Handlers; using Logger = NewHorizons.Utility.Logger; - -namespace NewHorizons.External +namespace NewHorizons.External.Modules { public static class NewHorizonsData { @@ -30,7 +25,7 @@ namespace NewHorizons.External _activeProfile = _saveFile.Profiles[_activeProfileName]; Logger.Log($"Loaded save data for {_activeProfileName}"); } - catch(Exception) + catch (Exception) { try { @@ -41,7 +36,7 @@ namespace NewHorizons.External Main.Instance.ModHelper.Storage.Save(_saveFile, _fileName); Logger.Log($"Loaded save data for {_activeProfileName}"); } - catch(Exception e) + catch (Exception e) { Logger.LogError($"Couldn't create save data {e.Message}, {e.StackTrace}"); } @@ -66,8 +61,8 @@ namespace NewHorizons.External Save(); } - - # region Frequencies + + #region Frequencies public static bool KnowsFrequency(string frequency) { @@ -84,16 +79,16 @@ namespace NewHorizons.External Save(); } } - + public static bool KnowsMultipleFrequencies() { return (_activeProfile != null && _activeProfile.KnownFrequencies.Count > 0); } - - # endregion - # region Signals - + #endregion + + #region Signals + public static bool KnowsSignal(string signal) { if (_activeProfile == null) return true; @@ -109,10 +104,10 @@ namespace NewHorizons.External Save(); } } - - # endregion - - # region Newly Revealed Facts + + #endregion + + #region Newly Revealed Facts public static void AddNewlyRevealedFactID(string id) { @@ -130,8 +125,8 @@ namespace NewHorizons.External _activeProfile?.NewlyRevealedFactIDs.Clear(); Save(); } - - # endregion + + #endregion private class NewHorizonsSaveFile { @@ -154,7 +149,7 @@ namespace NewHorizons.External public List KnownFrequencies { get; set; } public List KnownSignals { get; set; } - + public List NewlyRevealedFactIDs { get; set; } } } diff --git a/NewHorizons/External/OrbitModule.cs b/NewHorizons/External/Modules/OrbitModule.cs similarity index 89% rename from NewHorizons/External/OrbitModule.cs rename to NewHorizons/External/Modules/OrbitModule.cs index 038be883..224202cb 100644 --- a/NewHorizons/External/OrbitModule.cs +++ b/NewHorizons/External/Modules/OrbitModule.cs @@ -1,12 +1,6 @@ using NewHorizons.Components.Orbital; using NewHorizons.Utility; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace NewHorizons.External +namespace NewHorizons.External.Modules { public class OrbitModule : Module, IOrbitalParameters { diff --git a/NewHorizons/External/ProcGenModule.cs b/NewHorizons/External/Modules/ProcGenModule.cs similarity index 53% rename from NewHorizons/External/ProcGenModule.cs rename to NewHorizons/External/Modules/ProcGenModule.cs index 45813262..8d0e9bd8 100644 --- a/NewHorizons/External/ProcGenModule.cs +++ b/NewHorizons/External/Modules/ProcGenModule.cs @@ -1,11 +1,5 @@ using NewHorizons.Utility; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace NewHorizons.External +namespace NewHorizons.External.Modules { public class ProcGenModule : Module { diff --git a/NewHorizons/External/PropModule.cs b/NewHorizons/External/Modules/PropModule.cs similarity index 96% rename from NewHorizons/External/PropModule.cs rename to NewHorizons/External/Modules/PropModule.cs index 8c4de295..af470ff2 100644 --- a/NewHorizons/External/PropModule.cs +++ b/NewHorizons/External/Modules/PropModule.cs @@ -1,11 +1,5 @@ using NewHorizons.Utility; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace NewHorizons.External +namespace NewHorizons.External.Modules { public class PropModule : Module { @@ -108,7 +102,7 @@ namespace NewHorizons.External public bool cloaked; public MVector3 position; } - + public class NomaiTextInfo { public MVector3 position; @@ -118,7 +112,7 @@ namespace NewHorizons.External public string xmlFile; public int seed; // For randomizing arcs public NomaiTextArcInfo[] arcInfo; - } + } public class NomaiTextArcInfo { diff --git a/NewHorizons/External/ShipLogModule.cs b/NewHorizons/External/Modules/ShipLogModule.cs similarity index 97% rename from NewHorizons/External/ShipLogModule.cs rename to NewHorizons/External/Modules/ShipLogModule.cs index dfd17be1..7e1bb676 100644 --- a/NewHorizons/External/ShipLogModule.cs +++ b/NewHorizons/External/Modules/ShipLogModule.cs @@ -1,6 +1,5 @@ using NewHorizons.Utility; - -namespace NewHorizons.External +namespace NewHorizons.External.Modules { public class ShipLogModule : Module { diff --git a/NewHorizons/External/SignalModule.cs b/NewHorizons/External/Modules/SignalModule.cs similarity index 81% rename from NewHorizons/External/SignalModule.cs rename to NewHorizons/External/Modules/SignalModule.cs index 906e3411..61687912 100644 --- a/NewHorizons/External/SignalModule.cs +++ b/NewHorizons/External/Modules/SignalModule.cs @@ -1,11 +1,5 @@ using NewHorizons.Utility; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace NewHorizons.External +namespace NewHorizons.External.Modules { public class SignalModule : Module { diff --git a/NewHorizons/External/SpawnModule.cs b/NewHorizons/External/Modules/SpawnModule.cs similarity index 61% rename from NewHorizons/External/SpawnModule.cs rename to NewHorizons/External/Modules/SpawnModule.cs index 8547366e..8d5f113a 100644 --- a/NewHorizons/External/SpawnModule.cs +++ b/NewHorizons/External/Modules/SpawnModule.cs @@ -1,11 +1,5 @@ using NewHorizons.Utility; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace NewHorizons.External +namespace NewHorizons.External.Modules { public class SpawnModule : Module { diff --git a/NewHorizons/External/VariableSize/FunnelModule.cs b/NewHorizons/External/Modules/VariableSize/FunnelModule.cs similarity index 59% rename from NewHorizons/External/VariableSize/FunnelModule.cs rename to NewHorizons/External/Modules/VariableSize/FunnelModule.cs index 33039ae3..057b85a5 100644 --- a/NewHorizons/External/VariableSize/FunnelModule.cs +++ b/NewHorizons/External/Modules/VariableSize/FunnelModule.cs @@ -1,11 +1,5 @@ using NewHorizons.Utility; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace NewHorizons.External.VariableSize +namespace NewHorizons.External.Modules.VariableSize { public class FunnelModule : VariableSizeModule { diff --git a/NewHorizons/External/VariableSize/LavaModule.cs b/NewHorizons/External/Modules/VariableSize/LavaModule.cs similarity index 52% rename from NewHorizons/External/VariableSize/LavaModule.cs rename to NewHorizons/External/Modules/VariableSize/LavaModule.cs index 0b393504..558336e8 100644 --- a/NewHorizons/External/VariableSize/LavaModule.cs +++ b/NewHorizons/External/Modules/VariableSize/LavaModule.cs @@ -1,11 +1,5 @@ using NewHorizons.Utility; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace NewHorizons.External.VariableSize +namespace NewHorizons.External.Modules.VariableSize { public class LavaModule : VariableSizeModule { diff --git a/NewHorizons/External/VariableSize/RingModule.cs b/NewHorizons/External/Modules/VariableSize/RingModule.cs similarity index 66% rename from NewHorizons/External/VariableSize/RingModule.cs rename to NewHorizons/External/Modules/VariableSize/RingModule.cs index 86cda68c..7cb32e48 100644 --- a/NewHorizons/External/VariableSize/RingModule.cs +++ b/NewHorizons/External/Modules/VariableSize/RingModule.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace NewHorizons.External.VariableSize +namespace NewHorizons.External.Modules.VariableSize { public class RingModule : VariableSizeModule { @@ -15,6 +9,6 @@ namespace NewHorizons.External.VariableSize public string Texture { get; set; } public bool Unlit { get; set; } = false; public float RotationSpeed { get; set; } = 0f; - public string FluidType { get; set; } + public string FluidType { get; set; } } } diff --git a/NewHorizons/External/VariableSize/SandModule.cs b/NewHorizons/External/Modules/VariableSize/SandModule.cs similarity index 52% rename from NewHorizons/External/VariableSize/SandModule.cs rename to NewHorizons/External/Modules/VariableSize/SandModule.cs index 1dd9bfec..ee056aa5 100644 --- a/NewHorizons/External/VariableSize/SandModule.cs +++ b/NewHorizons/External/Modules/VariableSize/SandModule.cs @@ -1,11 +1,5 @@ using NewHorizons.Utility; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace NewHorizons.External.VariableSize +namespace NewHorizons.External.Modules.VariableSize { public class SandModule : VariableSizeModule { diff --git a/NewHorizons/External/VariableSize/SingularityModule.cs b/NewHorizons/External/Modules/VariableSize/SingularityModule.cs similarity index 67% rename from NewHorizons/External/VariableSize/SingularityModule.cs rename to NewHorizons/External/Modules/VariableSize/SingularityModule.cs index 19f27023..4f4b0804 100644 --- a/NewHorizons/External/VariableSize/SingularityModule.cs +++ b/NewHorizons/External/Modules/VariableSize/SingularityModule.cs @@ -1,11 +1,5 @@ using NewHorizons.Utility; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace NewHorizons.External.VariableSize +namespace NewHorizons.External.Modules.VariableSize { public class SingularityModule : VariableSizeModule { diff --git a/NewHorizons/External/VariableSize/StarModule.cs b/NewHorizons/External/Modules/VariableSize/StarModule.cs similarity index 63% rename from NewHorizons/External/VariableSize/StarModule.cs rename to NewHorizons/External/Modules/VariableSize/StarModule.cs index 7808f880..29e9084a 100644 --- a/NewHorizons/External/VariableSize/StarModule.cs +++ b/NewHorizons/External/Modules/VariableSize/StarModule.cs @@ -1,16 +1,10 @@ using NewHorizons.Utility; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace NewHorizons.External.VariableSize +namespace NewHorizons.External.Modules.VariableSize { public class StarModule : VariableSizeModule { public float Size { get; set; } = 2000f; - public MColor Tint { get; set; } + public MColor Tint { get; set; } public MColor SolarFlareTint { get; set; } public MColor LightTint { get; set; } public float SolarLuminosity { get; set; } = 1f; diff --git a/NewHorizons/External/VariableSize/VariableSizeModule.cs b/NewHorizons/External/Modules/VariableSize/VariableSizeModule.cs similarity index 75% rename from NewHorizons/External/VariableSize/VariableSizeModule.cs rename to NewHorizons/External/Modules/VariableSize/VariableSizeModule.cs index 1901c7c8..45b81690 100644 --- a/NewHorizons/External/VariableSize/VariableSizeModule.cs +++ b/NewHorizons/External/Modules/VariableSize/VariableSizeModule.cs @@ -1,11 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace NewHorizons.External.VariableSize +using UnityEngine; +namespace NewHorizons.External.Modules.VariableSize { public class VariableSizeModule : Module { diff --git a/NewHorizons/External/VariableSize/WaterModule.cs b/NewHorizons/External/Modules/VariableSize/WaterModule.cs similarity index 52% rename from NewHorizons/External/VariableSize/WaterModule.cs rename to NewHorizons/External/Modules/VariableSize/WaterModule.cs index 937cd63d..28221d6c 100644 --- a/NewHorizons/External/VariableSize/WaterModule.cs +++ b/NewHorizons/External/Modules/VariableSize/WaterModule.cs @@ -1,11 +1,5 @@ using NewHorizons.Utility; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace NewHorizons.External.VariableSize +namespace NewHorizons.External.Modules.VariableSize { public class WaterModule : VariableSizeModule { diff --git a/NewHorizons/Handlers/OWAssetHandler.cs b/NewHorizons/Handlers/OWAssetHandler.cs index 723a8545..3297255b 100644 --- a/NewHorizons/Handlers/OWAssetHandler.cs +++ b/NewHorizons/Handlers/OWAssetHandler.cs @@ -1,11 +1,6 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Handlers { public static class OWAssetHandler diff --git a/NewHorizons/Handlers/PlanetCreationHandler.cs b/NewHorizons/Handlers/PlanetCreationHandler.cs index 449a75b6..9907dbad 100644 --- a/NewHorizons/Handlers/PlanetCreationHandler.cs +++ b/NewHorizons/Handlers/PlanetCreationHandler.cs @@ -5,16 +5,14 @@ using NewHorizons.Builder.Orbital; using NewHorizons.Builder.Props; using NewHorizons.Components; using NewHorizons.Components.Orbital; -using NewHorizons.External; -using NewHorizons.External.VariableSize; +using NewHorizons.External.Modules; using NewHorizons.Utility; using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; using Logger = NewHorizons.Utility.Logger; +using NewHorizons.External.Modules.VariableSize; namespace NewHorizons.Handlers { @@ -65,7 +63,7 @@ namespace NewHorizons.Handlers // Load all planets var toLoad = bodies.ToList(); var newPlanetGraph = new PlanetGraphHandler(toLoad); - + foreach (var node in newPlanetGraph) { LoadBody(node.body); @@ -80,11 +78,11 @@ namespace NewHorizons.Handlers toLoad.Remove(focal.secondary.body); } } - + // Remaining planets are orphaned and either are stock bodies or just incorrectly set up var planetGraphs = PlanetGraphHandler.ConstructStockGraph(toLoad.ToArray()); - foreach(var planetGraph in planetGraphs) + foreach (var planetGraph in planetGraphs) { foreach (var node in planetGraph) { @@ -103,7 +101,7 @@ namespace NewHorizons.Handlers } // Are there more? - foreach(var body in toLoad) + foreach (var body in toLoad) { LoadBody(body); } @@ -132,7 +130,7 @@ namespace NewHorizons.Handlers public static bool LoadBody(NewHorizonsBody body, bool defaultPrimaryToSun = false) { // I don't remember doing this why is it exceptions what am I doing - GameObject existingPlanet = null; + GameObject existingPlanet = null; try { existingPlanet = AstroObjectLocator.GetAstroObject(body.Config.Name).gameObject; @@ -194,7 +192,7 @@ namespace NewHorizons.Handlers quantumPlanet.states.Add(new QuantumPlanet.State(sector, orbit)); } - catch(Exception ex) + catch (Exception ex) { Logger.LogError($"Couldn't make quantum state for [{body.Config.Name}] : {ex.Message}, {ex.StackTrace}"); return false; @@ -213,7 +211,7 @@ namespace NewHorizons.Handlers } else { - if(body.Config.IsQuantumState) + if (body.Config.IsQuantumState) { // If the ground state object isn't made yet do it later NextPassBodies.Add(body); @@ -421,28 +419,11 @@ namespace NewHorizons.Handlers CometTailBuilder.Make(go, sector, body.Config); } - // Backwards compatability - if (body.Config.Base.LavaSize != 0) - { - var lava = new LavaModule(); - lava.Size = body.Config.Base.LavaSize; - LavaBuilder.Make(go, sector, rb, lava); - } - if (body.Config.Lava != null) { LavaBuilder.Make(go, sector, rb, body.Config.Lava); } - // Backwards compatability - if (body.Config.Base.WaterSize != 0) - { - var water = new WaterModule(); - water.Size = body.Config.Base.WaterSize; - water.Tint = body.Config.Base.WaterTint; - WaterBuilder.Make(go, sector, rb, water); - } - if (body.Config.Water != null) { WaterBuilder.Make(go, sector, rb, body.Config.Water); @@ -492,7 +473,7 @@ namespace NewHorizons.Handlers SignalBuilder.Make(go, sector, body.Config.Signal, body.Mod); } - if (body.Config.Base.BlackHoleSize != 0 || body.Config.Singularity != null) + if (body.Config.Singularity != null) { SingularityBuilder.Make(go, sector, rb, body.Config); } @@ -559,7 +540,7 @@ namespace NewHorizons.Handlers GameObject.Destroy(go.GetComponentInChildren().gameObject); var isMoon = newAO.GetAstroObjectType() == AstroObject.Type.Moon || newAO.GetAstroObjectType() == AstroObject.Type.Satellite; - if(body.Config.Orbit.ShowOrbitLine) OrbitlineBuilder.Make(go, newAO, isMoon, body.Config); + if (body.Config.Orbit.ShowOrbitLine) OrbitlineBuilder.Make(go, newAO, isMoon, body.Config); DetectorBuilder.SetDetector(primary, newAO, go.GetComponentInChildren()); @@ -631,7 +612,7 @@ namespace NewHorizons.Handlers if (primaryBody != null) { var primaryGravity = new Gravity(primaryBody.GetGravityVolume()); - var secondaryGravity = new Gravity(secondaryBody.GetGravityVolume());; + var secondaryGravity = new Gravity(secondaryBody.GetGravityVolume()); ; go.transform.position = orbit.GetOrbitalParameters(primaryGravity, secondaryGravity).InitialPosition + primaryBody.transform.position; } diff --git a/NewHorizons/Handlers/PlanetDestructionHandler.cs b/NewHorizons/Handlers/PlanetDestructionHandler.cs index 8ecfe562..8e0d43d2 100644 --- a/NewHorizons/Handlers/PlanetDestructionHandler.cs +++ b/NewHorizons/Handlers/PlanetDestructionHandler.cs @@ -3,12 +3,8 @@ 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 Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Handlers { public static class PlanetDestructionHandler @@ -213,9 +209,9 @@ namespace NewHorizons.Handlers if (distantProxy != null) GameObject.Destroy(distantProxy.gameObject); if (distantProxyClone != null) GameObject.Destroy(distantProxyClone.gameObject); - + if (distantProxy == null && distantProxyClone == null) - Logger.Log($"Couldn't find proxy for {name}"); + Logger.Log($"Couldn't find proxy for {name}"); } } } diff --git a/NewHorizons/Handlers/PlanetGraphHandler.cs b/NewHorizons/Handlers/PlanetGraphHandler.cs index c5a8274b..de8471d4 100644 --- a/NewHorizons/Handlers/PlanetGraphHandler.cs +++ b/NewHorizons/Handlers/PlanetGraphHandler.cs @@ -1,13 +1,10 @@ -using System; +using NewHorizons.External.Configs; +using NewHorizons.Utility; +using System; using System.Collections; using System.Collections.Generic; using System.Linq; -using JetBrains.Annotations; -using NewHorizons.External.Configs; -using NewHorizons.Utility; -using UnityEngine; using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Handlers { public class PlanetGraphHandler : IEnumerable diff --git a/NewHorizons/Handlers/ShipLogHandler.cs b/NewHorizons/Handlers/ShipLogHandler.cs index 103e6d7d..98d323e7 100644 --- a/NewHorizons/Handlers/ShipLogHandler.cs +++ b/NewHorizons/Handlers/ShipLogHandler.cs @@ -1,15 +1,8 @@ -using NewHorizons.Components; +using NewHorizons.Utility; 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; - namespace NewHorizons.Handlers { public static class ShipLogHandler diff --git a/NewHorizons/Handlers/StarChartHandler.cs b/NewHorizons/Handlers/StarChartHandler.cs index 45411941..ee1f724a 100644 --- a/NewHorizons/Handlers/StarChartHandler.cs +++ b/NewHorizons/Handlers/StarChartHandler.cs @@ -1,14 +1,8 @@ using NewHorizons.Components; -using NewHorizons.External.Configs; using NewHorizons.Utility; -using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Handlers { public static class StarChartHandler @@ -72,7 +66,7 @@ namespace NewHorizons.Handlers public static bool CanWarp() { - foreach(var system in _systems) + foreach (var system in _systems) { if (system.Config.canEnterViaWarpDrive && system.Spawn?.ShipSpawnPoint != null && HasUnlockedSystem(system.Name)) { @@ -101,7 +95,7 @@ namespace NewHorizons.Handlers public static void OnRevealFact(string factID) { - if(_factIDToStarSystem.TryGetValue(factID, out var systemUnlocked)) + if (_factIDToStarSystem.TryGetValue(factID, out var systemUnlocked)) { Logger.Log($"Just learned [{factID}] and unlocked [{systemUnlocked}]"); if (!Main.HasWarpDrive) Main.Instance.EnableWarpDrive(); diff --git a/NewHorizons/Handlers/SystemCreationHandler.cs b/NewHorizons/Handlers/SystemCreationHandler.cs index 60208699..fa020c5d 100644 --- a/NewHorizons/Handlers/SystemCreationHandler.cs +++ b/NewHorizons/Handlers/SystemCreationHandler.cs @@ -1,16 +1,8 @@ -using NewHorizons.External.Configs; -using NewHorizons.Utility; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using NewHorizons.Builder.StarSystem; -using UnityEngine; -using Logger = NewHorizons.Utility.Logger; -using Object = UnityEngine.Object; +using NewHorizons.Builder.StarSystem; using NewHorizons.Components; - +using NewHorizons.Utility; +using UnityEngine; +using Object = UnityEngine.Object; namespace NewHorizons.Handlers { public static class SystemCreationHandler @@ -29,7 +21,7 @@ namespace NewHorizons.Handlers SkyboxBuilder.Make(system.Config.skybox, system.Mod); } - if(system.Config.enableTimeLoop) + if (system.Config.enableTimeLoop) { var timeLoopController = new GameObject("TimeLoopController"); timeLoopController.AddComponent(); diff --git a/NewHorizons/Handlers/TitleSceneHandler.cs b/NewHorizons/Handlers/TitleSceneHandler.cs index 1a4c2795..b2dfee2b 100644 --- a/NewHorizons/Handlers/TitleSceneHandler.cs +++ b/NewHorizons/Handlers/TitleSceneHandler.cs @@ -1,14 +1,11 @@ using NewHorizons.Builder.Body; -using NewHorizons.External; -using NewHorizons.External.VariableSize; +using NewHorizons.External.Modules; using NewHorizons.Utility; -using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; using Logger = NewHorizons.Utility.Logger; +using NewHorizons.External.Modules.VariableSize; namespace NewHorizons.Handlers { diff --git a/NewHorizons/Handlers/TranslationHandler.cs b/NewHorizons/Handlers/TranslationHandler.cs index efa2fd5b..3562f404 100644 --- a/NewHorizons/Handlers/TranslationHandler.cs +++ b/NewHorizons/Handlers/TranslationHandler.cs @@ -2,11 +2,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; -using NewHorizons.Utility; -using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Handlers { public static class TranslationHandler @@ -29,7 +24,7 @@ namespace NewHorizons.Handlers switch (type) { - case TextType.SHIPLOG: + case TextType.SHIPLOG: dictionary = _shipLogTranslationDictionary; break; case TextType.DIALOGUE: @@ -42,16 +37,16 @@ namespace NewHorizons.Handlers return text; } - if(dictionary.TryGetValue(language, out var table)) + if (dictionary.TryGetValue(language, out var table)) { - if(table.TryGetValue(text, out var translatedText)) + if (table.TryGetValue(text, out var translatedText)) { return translatedText; } } // Try to default to English - if(dictionary.TryGetValue(TextTranslation.Language.ENGLISH, out var englishTable)) + if (dictionary.TryGetValue(TextTranslation.Language.ENGLISH, out var englishTable)) { if (englishTable.TryGetValue(text, out var englishText)) diff --git a/NewHorizons/Main.cs b/NewHorizons/Main.cs index f3636d43..15543cd1 100644 --- a/NewHorizons/Main.cs +++ b/NewHorizons/Main.cs @@ -1,32 +1,21 @@ -using NewHorizons.Builder.Body; -using NewHorizons.Builder.General; -using NewHorizons.Builder.Orbital; +using HarmonyLib; using NewHorizons.Builder.Props; -using NewHorizons.Builder.ShipLog; using NewHorizons.Components; -using NewHorizons.External; using NewHorizons.External.Configs; -using NewHorizons.External.VariableSize; +using NewHorizons.External.Modules; using NewHorizons.Handlers; using NewHorizons.Utility; -using Newtonsoft.Json.Linq; using OWML.Common; using OWML.ModHelper; -using OWML.Utils; using System; -using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; -using OWML.Common.Menus; +using System.Reflection; using UnityEngine; +using UnityEngine.Events; using UnityEngine.SceneManagement; using Logger = NewHorizons.Utility.Logger; -using NewHorizons.Builder.Atmosphere; -using UnityEngine.Events; -using HarmonyLib; -using System.Reflection; - namespace NewHorizons { public class Main : ModBehaviour @@ -390,8 +379,10 @@ namespace NewHorizons try { var config = mod.ModHelper.Storage.Load(relativeDirectory); + config.Validate(); + Logger.Log($"Loaded {config.Name}"); - if (config.Base.CenterOfSolarSystem) config.Orbit.IsStatic = true; + if (!SystemDict.ContainsKey(config.StarSystem)) { // Since we didn't load it earlier there shouldn't be a star system config diff --git a/NewHorizons/NewHorizonsApi.cs b/NewHorizons/NewHorizonsApi.cs index 2a4e6dc9..76fcd5bb 100644 --- a/NewHorizons/NewHorizonsApi.cs +++ b/NewHorizons/NewHorizonsApi.cs @@ -5,12 +5,9 @@ using OWML.Common; using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; using UnityEngine.Events; using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons { public class NewHorizonsApi diff --git a/NewHorizons/Patches/AudioSignalPatches.cs b/NewHorizons/Patches/AudioSignalPatches.cs index ed7cbdde..814a5b77 100644 --- a/NewHorizons/Patches/AudioSignalPatches.cs +++ b/NewHorizons/Patches/AudioSignalPatches.cs @@ -1,15 +1,10 @@ using HarmonyLib; using NewHorizons.Builder.Props; using NewHorizons.Components; -using NewHorizons.External; +using NewHorizons.External.Modules; using NewHorizons.Handlers; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; - namespace NewHorizons.Patches { [HarmonyPatch] diff --git a/NewHorizons/Patches/EyeOfTheUniversePatches.cs b/NewHorizons/Patches/EyeOfTheUniversePatches.cs index 94b6616d..bde6a789 100644 --- a/NewHorizons/Patches/EyeOfTheUniversePatches.cs +++ b/NewHorizons/Patches/EyeOfTheUniversePatches.cs @@ -1,24 +1,5 @@ -using NewHorizons.Builder.General; -using NewHorizons.Builder.Props; -using NewHorizons.Components; -using NewHorizons.External; -using OWML.Common; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Xml.Linq; -using HarmonyLib; -using NewHorizons.Utility; -using OWML.Utils; +using HarmonyLib; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; -using Object = UnityEngine.Object; -using NewHorizons.Handlers; -using NewHorizons.Builder.ShipLog; - namespace NewHorizons.Patches { [HarmonyPatch] diff --git a/NewHorizons/Patches/LocatorPatches.cs b/NewHorizons/Patches/LocatorPatches.cs index 2ec5ffbc..eb933baf 100644 --- a/NewHorizons/Patches/LocatorPatches.cs +++ b/NewHorizons/Patches/LocatorPatches.cs @@ -1,15 +1,4 @@ using HarmonyLib; -using NewHorizons.Builder.Props; -using NewHorizons.Components; -using NewHorizons.External; -using NewHorizons.Handlers; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - namespace NewHorizons.Patches { [HarmonyPatch] diff --git a/NewHorizons/Patches/MapControllerPatches.cs b/NewHorizons/Patches/MapControllerPatches.cs index c3bda603..eb775ca5 100644 --- a/NewHorizons/Patches/MapControllerPatches.cs +++ b/NewHorizons/Patches/MapControllerPatches.cs @@ -1,11 +1,4 @@ using HarmonyLib; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - namespace NewHorizons.Patches { [HarmonyPatch] diff --git a/NewHorizons/Patches/OWCameraPatch.cs b/NewHorizons/Patches/OWCameraPatch.cs index 917ba797..863b56bd 100644 --- a/NewHorizons/Patches/OWCameraPatch.cs +++ b/NewHorizons/Patches/OWCameraPatch.cs @@ -1,12 +1,4 @@ using HarmonyLib; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using UnityEngine.Rendering; - namespace NewHorizons.Patches { [HarmonyPatch] diff --git a/NewHorizons/Patches/PlayerDataPatches.cs b/NewHorizons/Patches/PlayerDataPatches.cs index f7e5317d..b9b968ad 100644 --- a/NewHorizons/Patches/PlayerDataPatches.cs +++ b/NewHorizons/Patches/PlayerDataPatches.cs @@ -1,13 +1,9 @@ using HarmonyLib; using NewHorizons.Builder.Props; -using NewHorizons.External; +using NewHorizons.External.Modules; using NewHorizons.Handlers; -using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace NewHorizons.Patches { [HarmonyPatch] diff --git a/NewHorizons/Patches/PlayerSpawnerPatches.cs b/NewHorizons/Patches/PlayerSpawnerPatches.cs index dab43313..e6dec94d 100644 --- a/NewHorizons/Patches/PlayerSpawnerPatches.cs +++ b/NewHorizons/Patches/PlayerSpawnerPatches.cs @@ -1,24 +1,5 @@ -using NewHorizons.Builder.General; -using NewHorizons.Builder.Props; -using NewHorizons.Components; -using NewHorizons.External; -using OWML.Common; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Xml.Linq; -using HarmonyLib; -using NewHorizons.Utility; -using OWML.Utils; -using UnityEngine; +using HarmonyLib; using Logger = NewHorizons.Utility.Logger; -using Object = UnityEngine.Object; -using NewHorizons.Handlers; -using NewHorizons.Builder.ShipLog; - namespace NewHorizons.Patches { [HarmonyPatch] diff --git a/NewHorizons/Patches/PlayerStatePatches.cs b/NewHorizons/Patches/PlayerStatePatches.cs index a279bc9a..0fe13918 100644 --- a/NewHorizons/Patches/PlayerStatePatches.cs +++ b/NewHorizons/Patches/PlayerStatePatches.cs @@ -1,15 +1,5 @@ using HarmonyLib; -using NewHorizons.Builder.Props; -using NewHorizons.Components; -using NewHorizons.External; -using NewHorizons.Handlers; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; - namespace NewHorizons.Patches { [HarmonyPatch] diff --git a/NewHorizons/Patches/ProbeLauncherPatches.cs b/NewHorizons/Patches/ProbeLauncherPatches.cs index 40407e93..0f1ef17e 100644 --- a/NewHorizons/Patches/ProbeLauncherPatches.cs +++ b/NewHorizons/Patches/ProbeLauncherPatches.cs @@ -1,15 +1,4 @@ using HarmonyLib; -using NewHorizons.Builder.Props; -using NewHorizons.Components; -using NewHorizons.External; -using NewHorizons.Handlers; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - namespace NewHorizons.Patches { [HarmonyPatch] diff --git a/NewHorizons/Patches/ProxyBodyPatches.cs b/NewHorizons/Patches/ProxyBodyPatches.cs index 4ab32d5f..ecc7ef7b 100644 --- a/NewHorizons/Patches/ProxyBodyPatches.cs +++ b/NewHorizons/Patches/ProxyBodyPatches.cs @@ -1,10 +1,4 @@ using HarmonyLib; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace NewHorizons.Patches { [HarmonyPatch] diff --git a/NewHorizons/Patches/RaftPatches.cs b/NewHorizons/Patches/RaftPatches.cs index b15fa859..3ecdf0f7 100644 --- a/NewHorizons/Patches/RaftPatches.cs +++ b/NewHorizons/Patches/RaftPatches.cs @@ -1,13 +1,6 @@ using HarmonyLib; using NewHorizons.Components; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Patches { [HarmonyPatch] diff --git a/NewHorizons/Patches/ShipLogPatches.cs b/NewHorizons/Patches/ShipLogPatches.cs index 81dfe5ba..acc1c021 100644 --- a/NewHorizons/Patches/ShipLogPatches.cs +++ b/NewHorizons/Patches/ShipLogPatches.cs @@ -1,15 +1,14 @@ -using NewHorizons.Components; +using HarmonyLib; +using NewHorizons.Builder.ShipLog; +using NewHorizons.Components; +using NewHorizons.Handlers; +using NewHorizons.Utility; using System; using System.Collections.Generic; using System.Linq; -using NewHorizons.Utility; using UnityEngine; using Logger = NewHorizons.Utility.Logger; using Object = UnityEngine.Object; -using NewHorizons.Builder.ShipLog; -using NewHorizons.Handlers; -using HarmonyLib; - namespace NewHorizons.Patches { [HarmonyPatch] diff --git a/NewHorizons/Patches/SignalScopePatches.cs b/NewHorizons/Patches/SignalScopePatches.cs index dc40b22e..b6230c64 100644 --- a/NewHorizons/Patches/SignalScopePatches.cs +++ b/NewHorizons/Patches/SignalScopePatches.cs @@ -1,12 +1,5 @@ using HarmonyLib; using NewHorizons.Builder.Props; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - namespace NewHorizons.Patches { [HarmonyPatch] diff --git a/NewHorizons/Patches/SingularityPatches.cs b/NewHorizons/Patches/SingularityPatches.cs index eaf64dd4..e172c9e1 100644 --- a/NewHorizons/Patches/SingularityPatches.cs +++ b/NewHorizons/Patches/SingularityPatches.cs @@ -1,15 +1,6 @@ using HarmonyLib; -using NewHorizons.Builder.Props; -using NewHorizons.Components; -using NewHorizons.External; -using NewHorizons.Handlers; using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - namespace NewHorizons.Patches { [HarmonyPatch] diff --git a/NewHorizons/Patches/SunPatches.cs b/NewHorizons/Patches/SunPatches.cs index d8cc13a0..ba57ffee 100644 --- a/NewHorizons/Patches/SunPatches.cs +++ b/NewHorizons/Patches/SunPatches.cs @@ -1,15 +1,5 @@ using HarmonyLib; -using NewHorizons.Builder.Props; -using NewHorizons.Components; -using NewHorizons.External; -using NewHorizons.Handlers; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; - namespace NewHorizons.Patches { [HarmonyPatch] diff --git a/NewHorizons/Patches/TranslationPatches.cs b/NewHorizons/Patches/TranslationPatches.cs index 4bc1bf11..b938e8f6 100644 --- a/NewHorizons/Patches/TranslationPatches.cs +++ b/NewHorizons/Patches/TranslationPatches.cs @@ -2,13 +2,7 @@ using NewHorizons.Components.Orbital; using NewHorizons.Handlers; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Patches { [HarmonyPatch] diff --git a/NewHorizons/Patches/WarpDrivePatches.cs b/NewHorizons/Patches/WarpDrivePatches.cs index b358a855..ff5aec3a 100644 --- a/NewHorizons/Patches/WarpDrivePatches.cs +++ b/NewHorizons/Patches/WarpDrivePatches.cs @@ -1,13 +1,6 @@ using HarmonyLib; -using NewHorizons.Builder.General; using NewHorizons.Handlers; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; - namespace NewHorizons.Patches { [HarmonyPatch] diff --git a/NewHorizons/Utility/AddDebugShape.cs b/NewHorizons/Utility/AddDebugShape.cs index 010d6474..7d2d6343 100644 --- a/NewHorizons/Utility/AddDebugShape.cs +++ b/NewHorizons/Utility/AddDebugShape.cs @@ -1,5 +1,4 @@ using UnityEngine; - namespace NewHorizons.Utility { public static class AddDebugShape diff --git a/NewHorizons/Utility/AssetBundleUtilities.cs b/NewHorizons/Utility/AssetBundleUtilities.cs index fc4cd0ed..3e1ddf37 100644 --- a/NewHorizons/Utility/AssetBundleUtilities.cs +++ b/NewHorizons/Utility/AssetBundleUtilities.cs @@ -2,11 +2,7 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; - namespace NewHorizons.Utility { public static class AssetBundleUtilities diff --git a/NewHorizons/Utility/AstroObjectLocator.cs b/NewHorizons/Utility/AstroObjectLocator.cs index 76c5e579..b002f62c 100644 --- a/NewHorizons/Utility/AstroObjectLocator.cs +++ b/NewHorizons/Utility/AstroObjectLocator.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; - namespace NewHorizons.Utility { public static class AstroObjectLocator @@ -133,7 +129,7 @@ namespace NewHorizons.Utility break; // For some dumb reason the sun station doesn't use AstroObject.Name.SunStation case AstroObject.Name.CustomString: - if(primary._customName.Equals("Sun Station")) otherChildren.Add(GameObject.Find("SS_Debris_Body")); + if (primary._customName.Equals("Sun Station")) otherChildren.Add(GameObject.Find("SS_Debris_Body")); break; default: break; diff --git a/NewHorizons/Utility/AudioUtilities.cs b/NewHorizons/Utility/AudioUtilities.cs index ec2204fe..129cbdc4 100644 --- a/NewHorizons/Utility/AudioUtilities.cs +++ b/NewHorizons/Utility/AudioUtilities.cs @@ -1,12 +1,8 @@ -using System; -using System.Collections.Generic; -using System.IO; +using System.Collections.Generic; using System.Linq; -using System.Text; using System.Threading.Tasks; using UnityEngine; using UnityEngine.Networking; - namespace NewHorizons.Utility { public static class AudioUtilities diff --git a/NewHorizons/Utility/CollectionUtilities.cs b/NewHorizons/Utility/CollectionUtilities.cs index e4b49e6d..c70f7507 100644 --- a/NewHorizons/Utility/CollectionUtilities.cs +++ b/NewHorizons/Utility/CollectionUtilities.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - +using System.Collections.Generic; namespace NewHorizons.Utility { public static class CollectionUtilities diff --git a/NewHorizons/Utility/CoordinateUtilities.cs b/NewHorizons/Utility/CoordinateUtilities.cs index 7ab2066d..7d7fac9b 100644 --- a/NewHorizons/Utility/CoordinateUtilities.cs +++ b/NewHorizons/Utility/CoordinateUtilities.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - +using UnityEngine; namespace NewHorizons.Utility { public static class CoordinateUtilities diff --git a/NewHorizons/Utility/DebugRaycaster.cs b/NewHorizons/Utility/DebugRaycaster.cs index 8060f2ec..7091d658 100644 --- a/NewHorizons/Utility/DebugRaycaster.cs +++ b/NewHorizons/Utility/DebugRaycaster.cs @@ -1,13 +1,5 @@ -using NewHorizons; -using NewHorizons.Builder.Body; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; +using UnityEngine; using UnityEngine.InputSystem; - namespace NewHorizons.Utility { [RequireComponent(typeof(OWRigidbody))] @@ -41,9 +33,9 @@ namespace NewHorizons.Utility var posText = $"{{\"x\": {pos.x}, \"y\": {pos.y}, \"z\": {pos.z}}}"; var normText = $"{{\"x\": {norm.x}, \"y\": {norm.y}, \"z\": {norm.z}}}"; - if(_surfaceSphere != null) GameObject.Destroy(_surfaceSphere); - if(_normalSphere1 != null) GameObject.Destroy(_normalSphere1); - if(_normalSphere2 != null) GameObject.Destroy(_normalSphere2); + if (_surfaceSphere != null) GameObject.Destroy(_surfaceSphere); + if (_normalSphere1 != null) GameObject.Destroy(_normalSphere1); + if (_normalSphere2 != null) GameObject.Destroy(_normalSphere2); _surfaceSphere = AddDebugShape.AddSphere(hitInfo.transform.gameObject, 0.1f, Color.green); _normalSphere1 = AddDebugShape.AddSphere(hitInfo.transform.gameObject, 0.01f, Color.red); diff --git a/NewHorizons/Utility/DebugReload.cs b/NewHorizons/Utility/DebugReload.cs index 2dc0a2cc..e6be142c 100644 --- a/NewHorizons/Utility/DebugReload.cs +++ b/NewHorizons/Utility/DebugReload.cs @@ -1,11 +1,8 @@ -using System; -using System.Collections.Generic; -using NewHorizons.External.Configs; -using NewHorizons.Handlers; +using NewHorizons.Handlers; using OWML.Common; using OWML.Common.Menus; +using System; using UnityEngine; - namespace NewHorizons.Utility { public static class DebugReload @@ -32,7 +29,7 @@ namespace NewHorizons.Utility private static void ReloadConfigs() { Logger.Log("Begin reload of config files...", Logger.LogType.Log); - + Main.ResetConfigs(); try @@ -46,9 +43,9 @@ namespace NewHorizons.Utility { Logger.LogWarning("Error While Reloading"); } - + GameObject.Find("/PauseMenu/PauseMenuManagers").GetComponent().OnSkipToNextTimeLoop(); - + Main.Instance.ChangeCurrentStarSystem(Main.Instance.CurrentStarSystem); Main.SecondsLeftInLoop = -1f; diff --git a/NewHorizons/Utility/ImageUtilities.cs b/NewHorizons/Utility/ImageUtilities.cs index c46019cb..d1e4df08 100644 --- a/NewHorizons/Utility/ImageUtilities.cs +++ b/NewHorizons/Utility/ImageUtilities.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; using System.IO; using UnityEngine; - namespace NewHorizons.Utility { public static class ImageUtilities diff --git a/NewHorizons/Utility/Logger.cs b/NewHorizons/Utility/Logger.cs index 06a6d91b..0ef837d2 100644 --- a/NewHorizons/Utility/Logger.cs +++ b/NewHorizons/Utility/Logger.cs @@ -2,7 +2,6 @@ using System; using System.ComponentModel; using UnityEngine; - namespace NewHorizons.Utility { public static class Logger @@ -25,11 +24,11 @@ namespace NewHorizons.Utility { value = descriptor.GetValue(obj); } - catch(Exception) + catch (Exception) { value = null; } - + Log($"{obj.name} {name}={value}"); } } @@ -42,7 +41,7 @@ namespace NewHorizons.Utility public static void Log(string text, LogType type) { - if ((int) type < (int) _logLevel) return; + if ((int)type < (int)_logLevel) return; Main.Instance.ModHelper.Console.WriteLine(Enum.GetName(typeof(LogType), type) + " : " + text, LogTypeToMessageType(type)); } @@ -65,9 +64,9 @@ namespace NewHorizons.Utility Warning, Error, } - private static MessageType LogTypeToMessageType(LogType t) + private static MessageType LogTypeToMessageType(LogType t) { - switch(t) + switch (t) { case LogType.Error: return MessageType.Error; diff --git a/NewHorizons/Utility/MColor.cs b/NewHorizons/Utility/MColor.cs index e18e6b66..fd77c349 100644 --- a/NewHorizons/Utility/MColor.cs +++ b/NewHorizons/Utility/MColor.cs @@ -1,5 +1,4 @@ using UnityEngine; - namespace NewHorizons.Utility { public class MColor diff --git a/NewHorizons/Utility/MVector2.cs b/NewHorizons/Utility/MVector2.cs index 4d6ccf84..f8bc789a 100644 --- a/NewHorizons/Utility/MVector2.cs +++ b/NewHorizons/Utility/MVector2.cs @@ -1,5 +1,4 @@ using UnityEngine; - namespace NewHorizons.Utility { public class MVector2 diff --git a/NewHorizons/Utility/MVector3.cs b/NewHorizons/Utility/MVector3.cs index 2621b488..60250a90 100644 --- a/NewHorizons/Utility/MVector3.cs +++ b/NewHorizons/Utility/MVector3.cs @@ -1,5 +1,4 @@ using UnityEngine; - namespace NewHorizons.Utility { public class MVector3 diff --git a/NewHorizons/Utility/MakeMeshDoubleFaced.cs b/NewHorizons/Utility/MakeMeshDoubleFaced.cs index 81524728..ce3e036c 100644 --- a/NewHorizons/Utility/MakeMeshDoubleFaced.cs +++ b/NewHorizons/Utility/MakeMeshDoubleFaced.cs @@ -1,5 +1,4 @@ using UnityEngine; - namespace NewHorizons.Utility { public class MakeMeshDoubleFaced : MonoBehaviour diff --git a/NewHorizons/Utility/NewHorizonBody.cs b/NewHorizons/Utility/NewHorizonBody.cs index f7c88f17..9a64d2a0 100644 --- a/NewHorizons/Utility/NewHorizonBody.cs +++ b/NewHorizons/Utility/NewHorizonBody.cs @@ -1,19 +1,17 @@ -using NewHorizons.External; +using NewHorizons.External.Configs; using OWML.Common; using UnityEngine; -using NewHorizons.External.Configs; - namespace NewHorizons.Utility { public class NewHorizonsBody { - public NewHorizonsBody(IPlanetConfig config, IModBehaviour mod) + public NewHorizonsBody(PlanetConfig config, IModBehaviour mod) { Config = config; Mod = mod; } - public IPlanetConfig Config; + public PlanetConfig Config; public IModBehaviour Mod; public GameObject Object; diff --git a/NewHorizons/Utility/NewHorizonExtensions.cs b/NewHorizons/Utility/NewHorizonExtensions.cs index 4264ab5d..3f0ecc83 100644 --- a/NewHorizons/Utility/NewHorizonExtensions.cs +++ b/NewHorizons/Utility/NewHorizonExtensions.cs @@ -4,7 +4,6 @@ using System.Reflection; using System.Text; using System.Text.RegularExpressions; using UnityEngine; - namespace NewHorizons.Utility { public static class NewHorizonsExtensions @@ -85,7 +84,8 @@ namespace NewHorizons.Utility try { targetProperty.SetValue(destination, srcProp.GetValue(source, null), null); - } catch(Exception) + } + catch (Exception) { Logger.LogWarning($"Couldn't copy property {targetProperty.Name} from {source} to {destination}"); } diff --git a/NewHorizons/Utility/NewHorizonsSystem.cs b/NewHorizons/Utility/NewHorizonsSystem.cs index 129d621b..4d22a946 100644 --- a/NewHorizons/Utility/NewHorizonsSystem.cs +++ b/NewHorizons/Utility/NewHorizonsSystem.cs @@ -1,12 +1,6 @@ -using NewHorizons.External; +using NewHorizons.External.Configs; +using NewHorizons.External.Modules; using OWML.Common; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using NewHorizons.External.Configs; - namespace NewHorizons.Utility { public class NewHorizonsSystem diff --git a/NewHorizons/Utility/RandomUtility.cs b/NewHorizons/Utility/RandomUtility.cs index 820bf3be..efd073f2 100644 --- a/NewHorizons/Utility/RandomUtility.cs +++ b/NewHorizons/Utility/RandomUtility.cs @@ -1,10 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; using UnityEngine; - namespace NewHorizons.Utility { public static class RandomUtility diff --git a/NewHorizons/Utility/SearchUtilities.cs b/NewHorizons/Utility/SearchUtilities.cs index f6eafbce..4cd5e2c1 100644 --- a/NewHorizons/Utility/SearchUtilities.cs +++ b/NewHorizons/Utility/SearchUtilities.cs @@ -1,11 +1,8 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; using Object = UnityEngine.Object; - namespace NewHorizons.Utility { public static class SearchUtilities @@ -29,7 +26,7 @@ namespace NewHorizons.Utility GameObject foundObject = GameObject.Find(path); if (foundObject != null) { - CachedGameObjects.Add(path, foundObject); + CachedGameObjects.Add(path, foundObject); } return foundObject; } @@ -191,7 +188,7 @@ namespace NewHorizons.Utility return go; } - catch(Exception) + catch (Exception) { return null; }