Organize + validate

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

View File

@ -1,8 +1,5 @@
using NewHorizons.External;
using 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<OxygenVolume>();
}

View File

@ -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<MeshRenderer>())
foreach (var meshRenderer in atmo.GetComponentsInChildren<MeshRenderer>())
{
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());
}

View File

@ -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);

View File

@ -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<PlanetaryVectionController>();
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<PlanetaryVectionController>()._activeInSector = sector;
rainGO.GetComponent<PlanetaryVectionController>()._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";

View File

@ -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

View File

@ -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

View File

@ -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<EffectRuleset>();
ER._type = EffectRuleset.BubbleType.Underwater;
var gdRuleset = GameObject.Find("GiantsDeep_Body/Sector_GD/Volumes_GD/RulesetVolumes_GD").GetComponent<EffectRuleset>();
ER._material = gdRuleset._material;
var cloudMaterial = new Material(gdRuleset._cloudMaterial);

View File

@ -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()
{

View File

@ -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

View File

@ -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;

View File

@ -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<MeshRenderer>().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<FunnelController>();
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}");

View File

@ -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;

View File

@ -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];

View File

@ -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

View File

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

View File

@ -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<MeshCollider>();
cubeSphereMC.sharedMesh = mesh;
if(planetGO.GetComponent<ProxyShadowCasterSuperGroup>() != null) cubeSphere.AddComponent<ProxyShadowCaster>();
if (planetGO.GetComponent<ProxyShadowCasterSuperGroup>() != null) cubeSphere.AddComponent<ProxyShadowCaster>();
// Fix rotation in the end
cubeSphere.transform.rotation = planetGO.transform.TransformRotation(Quaternion.Euler(90, 0, 0));

View File

@ -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<MeshRenderer>().material.SetFloat("_HeightScale", heightScale);
if(module.Tint != null) lavaSphere.GetComponent<MeshRenderer>().material.SetColor("_EmissionColor", module.Tint.ToColor());
if (module.Tint != null) lavaSphere.GetComponent<MeshRenderer>().material.SetColor("_EmissionColor", module.Tint.ToColor());
var sectorCullGroup = lavaSphere.GetComponent<SectorCullGroup>();
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>();
sectorProxy._renderers = new List<Renderer> { proxyLavaSphere.GetComponent<MeshRenderer>() };
sectorProxy.SetSector(sector);
var destructionVolume = GameObject.Instantiate(GameObject.Find("VolcanicMoon_Body/MoltenCore_VM/DestructionVolume"), moltenCore.transform);
destructionVolume.GetComponent<SphereCollider>().radius = 1;
destructionVolume.SetActive(true);

View File

@ -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<Material>("Rock_QM_EyeRock_mat");
if(iceMaterial == null) iceMaterial = SearchUtilities.FindResourceOfTypeAndName<Material>("Rock_BH_IceSpike_mat");
if (quantumMaterial == null) quantumMaterial = SearchUtilities.FindResourceOfTypeAndName<Material>("Rock_QM_EyeRock_mat");
if (iceMaterial == null) iceMaterial = SearchUtilities.FindResourceOfTypeAndName<Material>("Rock_BH_IceSpike_mat");
GameObject icosphere = new GameObject("Icosphere");

View File

@ -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
{

View File

@ -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
{

View File

@ -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
{

View File

@ -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<Light>().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>();
whiteHoleVolume._debrisDistMax = size * 6.5f;
whiteHoleVolume._debrisDistMin = size * 2f;
@ -216,13 +200,13 @@ namespace NewHorizons.Builder.Body
whiteHoleVolume._whiteHoleBody = OWRB;
whiteHoleVolume._whiteHoleProxyShadowSuperGroup = planetGO.GetComponent<ProxyShadowCasterSuperGroup>();
whiteHoleVolume._radius = size * 0.5f;
whiteHoleVolumeGO.GetComponent<SphereCollider>().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";

View File

@ -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
{

View File

@ -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<TessellatedSphereLOD>()._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<MeshRenderer>().material.SetFloat("_Radius", module.Size);
fogGO.GetComponent<MeshRenderer>().material.SetFloat("_Radius2", module.Size/2f);
fogGO.GetComponent<MeshRenderer>().material.SetFloat("_Radius2", module.Size / 2f);
}
// TODO: make LOD work

View File

@ -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

View File

@ -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<NHAstroObject>();
astroObject.HideDisplayName = !config.Base.HasMapMarker;
@ -42,7 +37,7 @@ namespace NewHorizons.Builder.General
var alignment = body.AddComponent<AlignWithTargetBody>();
alignment.SetTargetBody(primaryBody?.GetAttachedOWRigidbody());
alignment._usePhysicsToRotate = true;
if(config.Orbit.AlignmentAxis == null)
if (config.Orbit.AlignmentAxis == null)
{
alignment._localAlignmentAxis = new Vector3(0, -1, 0);
}

View File

@ -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<OWCollider>();
fluidDetector._collider = sphereCollider;
// Could copy the splash from the interloper as well some day

View File

@ -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);

View File

@ -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>();
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;
}

View File

@ -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;

View File

@ -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<ProxyShadowCasterSuperGroup>();

View File

@ -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

View File

@ -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<MatchInitialMotion>().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<SpawnPoint>();
playerSpawnGO.transform.localRotation = Quaternion.Euler(0,0,0);
playerSpawnGO.transform.localRotation = Quaternion.Euler(0, 0, 0);
}
}
if(!Main.Instance.IsWarping && module.StartWithSuit && !suitUpQueued)
if (!Main.Instance.IsWarping && module.StartWithSuit && !suitUpQueued)
{
suitUpQueued = true;
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;
}
}

View File

@ -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;

View File

@ -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

View File

@ -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<LineRenderer>().material : GameObject.Find("OrbitLine_CO").GetComponent<LineRenderer>().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<TrackingOrbitLine>();
}
@ -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;

View File

@ -1,22 +1,18 @@
using NewHorizons.Utility;
using NewHorizons.External.Configs;
using NewHorizons.External.Modules;
using NewHorizons.Handlers;
using NewHorizons.Utility;
using OWML.Common;
using System;
using System.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}");
}

View File

@ -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<OWCollider>();
var interact = conversationZone.AddComponent<InteractReceiver>();
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();

View File

@ -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

View File

@ -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

View File

@ -1,16 +1,11 @@
using NewHorizons.External;
using NewHorizons.External.Modules;
using NewHorizons.Handlers;
using NewHorizons.Utility;
using OWML.Common;
using System;
using System.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

View File

@ -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)
{

View File

@ -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

View File

@ -1,26 +1,20 @@
using NewHorizons.Utility;
using NewHorizons.External.Configs;
using NewHorizons.External.Modules;
using NewHorizons.Utility;
using OWML.Common;
using System;
using System.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;

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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<ShipLogAstroObject>();
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<NewHorizonsBody> 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<NewHorizonsBody> 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.");
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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<SurveyorProbe>();
if (requiredComponent.IsLaunched())
{
UnityEngine.Object.Destroy(requiredComponent.gameObject);
}
}
}
{
SurveyorProbe requiredComponent = probeBody.GetRequiredComponent<SurveyorProbe>();
if (requiredComponent.IsLaunched())
{
UnityEngine.Object.Destroy(requiredComponent.gameObject);
}
}
}
}

View File

@ -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)

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;
}
}
}

View File

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

View File

@ -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

View File

@ -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<ReferenceFrameTracker>();
if (component.GetReferenceFrame(true) != null && component.GetReferenceFrame(true).GetOWRigidBody() == gameObject)

View File

@ -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;

View File

@ -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
{

View File

@ -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

View File

@ -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<LineRenderer>().positionCount = this._numVerts;
}
public override void InitializeLineRenderer()
{
base.GetComponent<LineRenderer>().positionCount = this._numVerts;
}
public override void OnValidate()
{
if (_numVerts < 0 || _numVerts > 4096)
{
_numVerts = Mathf.Clamp(_numVerts, 0, 4096);
}
if (base.GetComponent<LineRenderer>().positionCount != this._numVerts)
{
InitializeLineRenderer();
}
}
public override void OnValidate()
{
if (_numVerts < 0 || _numVerts > 4096)
{
_numVerts = Mathf.Clamp(_numVerts, 0, 4096);
}
if (base.GetComponent<LineRenderer>().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);
}
}
}

View File

@ -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);

View File

@ -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);
}
}
}

View File

@ -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);

View File

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

View File

@ -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;

View File

@ -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;

View File

@ -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<OxygenVolume>();
var atmoVolume = GameObject.Find("Ship_Body/Volumes/ShipAtmosphereVolume").GetComponent<SimpleFluidVolume>();

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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()
{

View File

@ -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<SunController>();
_sunLightParamUpdater._propID_SunPosition = Shader.PropertyToID("_SunPosition");

View File

@ -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);
}

View File

@ -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;

View File

@ -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

View File

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

View File

@ -1,14 +1,13 @@
using NewHorizons.External.VariableSize;
using NewHorizons.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<string, object> 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;
}
}
}
}

View File

@ -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<string, object> dict) : base(dict) { }
}
}

View File

@ -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<string, object> dict = JObject.Parse(File.ReadAllText(filename)).ToObject<Dictionary<string, object>>();
if(dict.ContainsKey(nameof(DialogueDictionary)))
if (dict.ContainsKey(nameof(DialogueDictionary)))
{
DialogueDictionary = (Dictionary<string, string>)(dict[nameof(DialogueDictionary)] as Newtonsoft.Json.Linq.JObject).ToObject(typeof(Dictionary<string, string>));
}

View File

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

View File

@ -1,10 +1,4 @@
using System;
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
{

View File

@ -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
{

View File

@ -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; }
}
}

View File

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

View File

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

View File

@ -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
{

View File

@ -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<string> KnownFrequencies { get; set; }
public List<string> KnownSignals { get; set; }
public List<string> NewlyRevealedFactIDs { get; set; }
}
}

View File

@ -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
{

View File

@ -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
{

View File

@ -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
{

View File

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

View File

@ -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
{

View File

@ -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
{

View File

@ -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
{

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