mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Merge remote-tracking branch 'origin/schema-integration' into schema-integration
# Conflicts: # NewHorizons/External/Modules/OrbitModule.cs
This commit is contained in:
commit
10b71a4a6c
@ -24,7 +24,7 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
meshRenderer.material.SetFloat(InnerRadius, atmosphereModule.clouds != null ? atmosphereModule.size : surfaceSize);
|
||||
meshRenderer.material.SetFloat(OuterRadius, atmosphereModule.size * 1.2f);
|
||||
if (atmosphereModule.atmosphereTint != null)
|
||||
meshRenderer.material.SetColor(SkyColor, atmosphereModule.atmosphereTint.ToColor());
|
||||
meshRenderer.material.SetColor(SkyColor, atmosphereModule.atmosphereTint);
|
||||
}
|
||||
|
||||
atmo.SetActive(true);
|
||||
|
||||
@ -39,7 +39,7 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
// If they set a colour apply it to all the materials else keep the default QM one
|
||||
if (atmo.clouds.tint != null)
|
||||
{
|
||||
var bottomColor = atmo.clouds.tint.ToColor();
|
||||
var bottomColor = atmo.clouds.tint;
|
||||
|
||||
var bottomTSRTempArray = new Material[2];
|
||||
|
||||
@ -119,7 +119,7 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
for(int i = 0; i < atmo.clouds.lightningGradient.Length; i++)
|
||||
{
|
||||
var pair = atmo.clouds.lightningGradient[i];
|
||||
gradient[i] = new GradientColorKey(pair.Tint.ToColor(), pair.Time);
|
||||
gradient[i] = new GradientColorKey(pair.Tint, pair.Time);
|
||||
}
|
||||
|
||||
lightningGenerator._lightColor.colorKeys = gradient;
|
||||
@ -138,7 +138,7 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
|
||||
public static GameObject MakeTopClouds(GameObject rootObject, AtmosphereModule atmo, IModBehaviour mod)
|
||||
{
|
||||
Color cloudTint = atmo.clouds.tint?.ToColor() ?? Color.white;
|
||||
Color cloudTint = atmo.clouds.tint ?? Color.white;
|
||||
|
||||
Texture2D image, cap, ramp;
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
PFC.fogExponent = 1f;
|
||||
PFC.fogColorRampTexture = dbPlanetaryFogController.fogColorRampTexture;
|
||||
PFC.fogColorRampIntensity = 1f;
|
||||
PFC.fogTint = atmo.fogTint.ToColor();
|
||||
PFC.fogTint = atmo.fogTint;
|
||||
|
||||
GameObject lodFogGO = new GameObject("LODFogSphere");
|
||||
lodFogGO.SetActive(false);
|
||||
@ -42,7 +42,7 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
|
||||
MeshRenderer lodMR = lodFogGO.AddComponent<MeshRenderer>();
|
||||
lodMR.material = new Material(brambleLODFog.GetComponent<MeshRenderer>().material);
|
||||
lodMR.material.color = atmo.fogTint.ToColor();
|
||||
lodMR.material.color = atmo.fogTint;
|
||||
lodMR.material.renderQueue = 1000;
|
||||
|
||||
/*
|
||||
|
||||
@ -44,7 +44,7 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
var cloudMaterial = new Material(gdRuleset._cloudMaterial);
|
||||
if (config.Atmosphere?.clouds?.tint != null)
|
||||
{
|
||||
cloudMaterial.SetColor(FogColor, config.Atmosphere.clouds.tint.ToColor32());
|
||||
cloudMaterial.SetColor(FogColor, config.Atmosphere.clouds.tint);
|
||||
}
|
||||
ER._cloudMaterial = cloudMaterial;
|
||||
|
||||
|
||||
@ -41,11 +41,11 @@ namespace NewHorizons.Builder.Body
|
||||
config.Orbit = new OrbitModule()
|
||||
{
|
||||
IsMoon = true,
|
||||
Inclination = belt.inclination + Random.Range(-2f, 2f),
|
||||
LongitudeOfAscendingNode = belt.longitudeOfAscendingNode,
|
||||
TrueAnomaly = 360f * (i + Random.Range(-0.2f, 0.2f)) / (float)count,
|
||||
inclination = belt.inclination + Random.Range(-2f, 2f),
|
||||
longitudeOfAscendingNode = belt.longitudeOfAscendingNode,
|
||||
trueAnomaly = 360f * (i + Random.Range(-0.2f, 0.2f)) / (float)count,
|
||||
PrimaryBody = bodyName,
|
||||
SemiMajorAxis = Random.Range(belt.innerRadius, belt.outerRadius),
|
||||
semiMajorAxis = Random.Range(belt.innerRadius, belt.outerRadius),
|
||||
ShowOrbitLine = false
|
||||
};
|
||||
|
||||
|
||||
@ -70,7 +70,7 @@ namespace NewHorizons.Builder.Body
|
||||
materials[i] = new Material(waterMaterials[i]);
|
||||
if (module.tint != null)
|
||||
{
|
||||
materials[i].SetColor(FogColor, module.tint.ToColor());
|
||||
materials[i].SetColor(FogColor, module.tint);
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,7 +117,7 @@ namespace NewHorizons.Builder.Body
|
||||
|
||||
if (module.tint != null)
|
||||
{
|
||||
lavaMaterial.SetColor(EmissionColor, module.tint.ToColor());
|
||||
lavaMaterial.SetColor(EmissionColor, module.tint);
|
||||
}
|
||||
|
||||
proxyGO.GetComponentInChildren<MeshRenderer>().material = lavaMaterial;
|
||||
|
||||
@ -32,7 +32,7 @@ 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);
|
||||
|
||||
var sectorCullGroup = lavaSphere.GetComponent<SectorCullGroup>();
|
||||
sectorCullGroup.SetSector(sector);
|
||||
@ -44,7 +44,7 @@ namespace NewHorizons.Builder.Body
|
||||
proxyLavaSphere.transform.localScale = Vector3.one;
|
||||
proxyLavaSphere.name = "LavaSphere_Proxy";
|
||||
proxyLavaSphere.GetComponent<MeshRenderer>().material.SetFloat(HeightScale, heightScale);
|
||||
if (module.tint != null) proxyLavaSphere.GetComponent<MeshRenderer>().material.SetColor(EmissionColor, module.tint.ToColor());
|
||||
if (module.tint != null) proxyLavaSphere.GetComponent<MeshRenderer>().material.SetColor(EmissionColor, module.tint);
|
||||
|
||||
var sectorProxy = moltenCoreProxy.GetComponent<SectorProxy>();
|
||||
sectorProxy._renderers = new List<Renderer> { proxyLavaSphere.GetComponent<MeshRenderer>() };
|
||||
|
||||
@ -27,7 +27,7 @@ namespace NewHorizons.Builder.Body
|
||||
|
||||
var cubeSphereMR = icosphere.AddComponent<MeshRenderer>();
|
||||
cubeSphereMR.material = new Material(Shader.Find("Standard"));
|
||||
cubeSphereMR.material.color = module.color != null ? module.color.ToColor() : Color.white;
|
||||
cubeSphereMR.material.color = module.color != null ? module.color : Color.white;
|
||||
|
||||
var cubeSphereMC = icosphere.AddComponent<MeshCollider>();
|
||||
cubeSphereMC.sharedMesh = mesh;
|
||||
|
||||
@ -77,18 +77,18 @@ namespace NewHorizons.Builder.Body
|
||||
if (realSize < body.Config.Lava.size) realSize = body.Config.Lava.size;
|
||||
|
||||
var material = new Material(lavaMaterial);
|
||||
if (body.Config.Lava.tint != null) material.SetColor(EmissionColor, body.Config.Lava.tint.ToColor());
|
||||
if (body.Config.Lava.tint != null) material.SetColor(EmissionColor, body.Config.Lava.tint);
|
||||
sphere.GetComponent<MeshRenderer>().material = material;
|
||||
}
|
||||
if (body.Config.Water != null)
|
||||
{
|
||||
var colour = body.Config.Water.tint?.ToColor() ?? Color.blue;
|
||||
var colour = body.Config.Water.tint ?? Color.blue;
|
||||
AddColouredSphere(newProxy, body.Config.Water.size, body.Config.Water.Curve, colour);
|
||||
if (realSize < body.Config.Water.size) realSize = body.Config.Water.size;
|
||||
}
|
||||
if (body.Config.Sand != null)
|
||||
{
|
||||
var colour = body.Config.Sand.Tint?.ToColor() ?? Color.yellow;
|
||||
var colour = body.Config.Sand.Tint ?? Color.yellow;
|
||||
AddColouredSphere(newProxy, body.Config.Sand.Size, body.Config.Sand.Curve, colour);
|
||||
if (realSize < body.Config.Sand.Size) realSize = body.Config.Sand.Size;
|
||||
}
|
||||
|
||||
@ -24,8 +24,8 @@ namespace NewHorizons.Builder.Body
|
||||
new Material(sandMaterials[1])
|
||||
};
|
||||
GameObject.Destroy(oldMR);
|
||||
sandMR.sharedMaterials[0].color = module.Tint.ToColor32();
|
||||
sandMR.sharedMaterials[1].color = module.Tint.ToColor32();
|
||||
sandMR.sharedMaterials[0].color = module.Tint;
|
||||
sandMR.sharedMaterials[1].color = module.Tint;
|
||||
}
|
||||
|
||||
var collider = GameObject.Instantiate(GameObject.Find("TowerTwin_Body/SandSphere_Draining/Collider"), sandGO.transform);
|
||||
|
||||
@ -42,13 +42,13 @@ namespace NewHorizons.Builder.Body
|
||||
PlanetaryFogController fog = sunAtmosphere.transform.Find("FogSphere").GetComponent<PlanetaryFogController>();
|
||||
if (starModule.tint != null)
|
||||
{
|
||||
fog.fogTint = starModule.tint.ToColor();
|
||||
fog.fogTint = starModule.tint;
|
||||
sunAtmosphere.transform.Find("AtmoSphere").transform.localScale = Vector3.one;
|
||||
foreach (var lod in sunAtmosphere.transform.Find("AtmoSphere").GetComponentsInChildren<MeshRenderer>())
|
||||
{
|
||||
lod.material.SetColor(SkyColor, starModule.tint.ToColor());
|
||||
lod.material.SetColor(AtmosFar, starModule.tint.ToColor());
|
||||
lod.material.SetColor(AtmosNear, starModule.tint.ToColor());
|
||||
lod.material.SetColor(SkyColor, starModule.tint);
|
||||
lod.material.SetColor(AtmosFar, starModule.tint);
|
||||
lod.material.SetColor(AtmosNear, starModule.tint);
|
||||
lod.material.SetFloat(InnerRadius, starModule.size);
|
||||
lod.material.SetFloat(OuterRadius, starModule.size * OuterRadiusRatio);
|
||||
}
|
||||
@ -90,7 +90,7 @@ namespace NewHorizons.Builder.Body
|
||||
light.range *= Mathf.Sqrt(starModule.solarLuminosity);
|
||||
|
||||
Color lightColour = light.color;
|
||||
if (starModule.lightTint != null) lightColour = starModule.lightTint.ToColor();
|
||||
if (starModule.lightTint != null) lightColour = starModule.lightTint;
|
||||
|
||||
light.color = lightColour;
|
||||
ambientLight.color = lightColour;
|
||||
@ -177,7 +177,7 @@ namespace NewHorizons.Builder.Body
|
||||
|
||||
if (starModule.tint != null)
|
||||
{
|
||||
var flareTint = starModule.tint.ToColor();
|
||||
var flareTint = starModule.tint;
|
||||
var emitter = solarFlareEmitter.GetComponent<SolarFlareEmitter>();
|
||||
emitter.tint = flareTint;
|
||||
foreach (var controller in solarFlareEmitter.GetComponentsInChildren<SolarFlareController>())
|
||||
@ -195,7 +195,7 @@ namespace NewHorizons.Builder.Body
|
||||
{
|
||||
TessellatedSphereRenderer surface = sunSurface.GetComponent<TessellatedSphereRenderer>();
|
||||
|
||||
var colour = starModule.tint.ToColor();
|
||||
var colour = starModule.tint;
|
||||
|
||||
var sun = GameObject.Find("Sun_Body");
|
||||
var mainSequenceMaterial = sun.GetComponent<SunController>().GetValue<Material>("_startSurfaceMaterial");
|
||||
@ -211,7 +211,7 @@ namespace NewHorizons.Builder.Body
|
||||
|
||||
if (starModule.endTint != null)
|
||||
{
|
||||
var endColour = starModule.endTint.ToColor();
|
||||
var endColour = starModule.endTint;
|
||||
darkenedColor = new Color(endColour.r * mod, endColour.g * mod, endColour.b * mod);
|
||||
}
|
||||
|
||||
@ -233,7 +233,7 @@ namespace NewHorizons.Builder.Body
|
||||
|
||||
if (starModule.supernovaTint != null)
|
||||
{
|
||||
var colour = starModule.supernovaTint.ToColor();
|
||||
var colour = starModule.supernovaTint;
|
||||
|
||||
var supernovaMaterial = new Material(supernova._supernovaMaterial);
|
||||
var ramp = ImageUtilities.LerpGreyscaleImage(ImageUtilities.GetTexture(Main.Instance, "AssetBundle/Effects_SUN_Supernova_d.png"), Color.white, colour);
|
||||
|
||||
@ -40,8 +40,8 @@ namespace NewHorizons.Builder.Body
|
||||
tempArray[i] = new Material(GDSharedMaterials[i]);
|
||||
if (module.tint != null)
|
||||
{
|
||||
tempArray[i].color = module.tint.ToColor();
|
||||
tempArray[i].SetColor("_FogColor", module.tint.ToColor());
|
||||
tempArray[i].color = module.tint;
|
||||
tempArray[i].SetColor("_FogColor", module.tint);
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ namespace NewHorizons.Builder.Body
|
||||
|
||||
if (module.tint != null)
|
||||
{
|
||||
var adjustedColour = module.tint.ToColor() / 4f;
|
||||
var adjustedColour = (Color)module.tint / 4f;
|
||||
adjustedColour.a = adjustedColour.a * 4f;
|
||||
fogGO.GetComponent<MeshRenderer>().material.color = adjustedColour;
|
||||
}
|
||||
|
||||
@ -28,8 +28,8 @@ namespace NewHorizons.Builder.General
|
||||
if (primaryBody?.gameObject?.GetComponent<SphereCollider>() != null && !config.Orbit.IsStatic)
|
||||
{
|
||||
var primarySphereOfInfluence = primaryBody.GetGravityVolume().gameObject.GetComponent<SphereCollider>();
|
||||
if (primarySphereOfInfluence.radius < config.Orbit.SemiMajorAxis)
|
||||
primarySphereOfInfluence.radius = config.Orbit.SemiMajorAxis * 1.5f;
|
||||
if (primarySphereOfInfluence.radius < config.Orbit.semiMajorAxis)
|
||||
primarySphereOfInfluence.radius = config.Orbit.semiMajorAxis * 1.5f;
|
||||
}
|
||||
|
||||
if (config.Orbit.IsTidallyLocked)
|
||||
|
||||
@ -108,18 +108,18 @@ namespace NewHorizons.Builder.Orbital
|
||||
}
|
||||
|
||||
// Update the positions
|
||||
var distance = secondaryBody.SemiMajorAxis + primaryBody.SemiMajorAxis;
|
||||
var distance = secondaryBody.semiMajorAxis + primaryBody.semiMajorAxis;
|
||||
var m1 = primaryGravity.Mass;
|
||||
var m2 = secondaryGravity.Mass;
|
||||
|
||||
var r1 = distance * m2 / (m1 + m2);
|
||||
var r2 = distance * m1 / (m1 + m2);
|
||||
|
||||
var ecc = secondaryBody.Eccentricity;
|
||||
var inc = secondaryBody.Inclination;
|
||||
var arg = secondaryBody.ArgumentOfPeriapsis;
|
||||
var lon = secondaryBody.LongitudeOfAscendingNode;
|
||||
var tru = secondaryBody.TrueAnomaly;
|
||||
var ecc = secondaryBody.eccentricity;
|
||||
var inc = secondaryBody.inclination;
|
||||
var arg = secondaryBody.argumentOfPeriapsis;
|
||||
var lon = secondaryBody.longitudeOfAscendingNode;
|
||||
var tru = secondaryBody.trueAnomaly;
|
||||
|
||||
// Update their astro objects
|
||||
primaryBody.SetOrbitalParametersFromTrueAnomaly(ecc, r1, inc, arg, lon, tru - 180);
|
||||
|
||||
@ -32,7 +32,7 @@ namespace NewHorizons.Builder.Orbital
|
||||
var numVerts = config.Orbit.DottedOrbitLine ? 128 : 256;
|
||||
lineRenderer.positionCount = numVerts;
|
||||
|
||||
var ecc = config.Orbit.Eccentricity;
|
||||
var ecc = config.Orbit.eccentricity;
|
||||
|
||||
var parentGravity = astroObject.GetPrimaryBody()?.GetGravityVolume();
|
||||
|
||||
@ -45,25 +45,25 @@ namespace NewHorizons.Builder.Orbital
|
||||
{
|
||||
orbitLine = orbitGO.AddComponent<NHOrbitLine>();
|
||||
|
||||
var a = astroObject.SemiMajorAxis;
|
||||
var e = astroObject.Eccentricity;
|
||||
var a = astroObject.semiMajorAxis;
|
||||
var e = astroObject.eccentricity;
|
||||
var b = a * Mathf.Sqrt(1f - (e * e));
|
||||
var l = astroObject.LongitudeOfAscendingNode;
|
||||
var p = astroObject.ArgumentOfPeriapsis;
|
||||
var i = astroObject.Inclination;
|
||||
var l = astroObject.longitudeOfAscendingNode;
|
||||
var p = astroObject.argumentOfPeriapsis;
|
||||
var i = astroObject.inclination;
|
||||
|
||||
(orbitLine as NHOrbitLine).SemiMajorAxis = a * OrbitalParameters.Rotate(Vector3.left, l, i, p);
|
||||
(orbitLine as NHOrbitLine).SemiMinorAxis = b * OrbitalParameters.Rotate(Vector3.forward, l, i, p);
|
||||
}
|
||||
|
||||
var color = Color.white;
|
||||
if (config.Orbit.Tint != null) color = config.Orbit.Tint.ToColor32();
|
||||
else if (config.Star != null) color = config.Star.tint.ToColor32();
|
||||
else if (config.Atmosphere?.clouds?.tint != null) color = config.Atmosphere.clouds.tint.ToColor32();
|
||||
if (config.Orbit.Tint != null) color = config.Orbit.Tint;
|
||||
else if (config.Star != null) color = config.Star.tint;
|
||||
else if (config.Atmosphere?.clouds?.tint != null) color = config.Atmosphere.clouds.tint;
|
||||
else if (config.Singularity != null) color = new Color(1f, 0.5f, 1f);
|
||||
else if (config.Water != null) color = new Color(0.5f, 0.5f, 1f);
|
||||
else if (config.Lava != null) color = new Color(1f, 0.5f, 0.5f);
|
||||
else if (config.Atmosphere != null && config.Atmosphere.fogTint != null) color = config.Atmosphere.fogTint.ToColor32();
|
||||
else if (config.Atmosphere != null && config.Atmosphere.fogTint != null) color = config.Atmosphere.fogTint;
|
||||
|
||||
var fade = isMoon;
|
||||
|
||||
@ -84,7 +84,7 @@ namespace NewHorizons.Builder.Orbital
|
||||
|
||||
orbitLine._lineWidth = 0.2f;
|
||||
|
||||
orbitLine._numVerts = (int)Mathf.Clamp(config.Orbit.SemiMajorAxis / 1000f, numVerts, 4096);
|
||||
orbitLine._numVerts = (int)Mathf.Clamp(config.Orbit.semiMajorAxis / 1000f, numVerts, 4096);
|
||||
|
||||
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(orbitLine.InitializeLineRenderer);
|
||||
|
||||
|
||||
@ -185,7 +185,7 @@ namespace NewHorizons.Builder.Props
|
||||
var ambientLight = new SlideAmbientLightModule();
|
||||
ambientLight._intensity = slideInfo.ambientLightIntensity;
|
||||
ambientLight._range = slideInfo.ambientLightRange;
|
||||
ambientLight._color = slideInfo.ambientLightColor.ToColor();
|
||||
ambientLight._color = slideInfo.ambientLightColor;
|
||||
ambientLight._spotIntensityMod = slideInfo.spotIntensityMod;
|
||||
modules.Add(ambientLight);
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
if (info.tint != null)
|
||||
{
|
||||
ApplyTint(tornadoGO, info.tint.ToColor(), false, downwards);
|
||||
ApplyTint(tornadoGO, info.tint, false, downwards);
|
||||
}
|
||||
|
||||
if (info.wanderRate != 0)
|
||||
@ -205,7 +205,7 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
if (info.tint != null)
|
||||
{
|
||||
ApplyTint(hurricaneGO, info.tint.ToColor(), true, false);
|
||||
ApplyTint(hurricaneGO, info.tint, true, false);
|
||||
}
|
||||
|
||||
if (info.wanderRate != 0)
|
||||
|
||||
@ -50,8 +50,8 @@ namespace NewHorizons.Builder.Props
|
||||
meteor.transform.localScale = Vector3.one * info.scale;
|
||||
|
||||
var mat = meteor.GetComponentInChildren<MeshRenderer>().material;
|
||||
mat.SetColor(Color1, info.stoneTint?.ToColor() ?? defaultStoneTint);
|
||||
mat.SetColor(EmissionColor, info.lavaTint?.ToColor() ?? defaultLavaTint);
|
||||
mat.SetColor(Color1, info.stoneTint ?? defaultStoneTint);
|
||||
mat.SetColor(EmissionColor, info.lavaTint ?? defaultLavaTint);
|
||||
|
||||
var detectors = meteor.transform.Find("ConstantDetectors").gameObject;
|
||||
GameObject.Destroy(detectors.GetComponent<ConstantForceDetector>());
|
||||
|
||||
@ -365,7 +365,7 @@ namespace NewHorizons.Builder.ShipLog
|
||||
{
|
||||
foreach (NewHorizonsBody body in bodies.Where(b => b.Config.Base.centerOfSolarSystem))
|
||||
{
|
||||
bodies.Sort((b, o) => b.Config.Orbit.SemiMajorAxis.CompareTo(o.Config.Orbit.SemiMajorAxis));
|
||||
bodies.Sort((b, o) => b.Config.Orbit.semiMajorAxis.CompareTo(o.Config.Orbit.semiMajorAxis));
|
||||
MapModeObject newNode = new MapModeObject
|
||||
{
|
||||
mainBody = body,
|
||||
@ -521,10 +521,10 @@ namespace NewHorizons.Builder.ShipLog
|
||||
}
|
||||
|
||||
var starColor = body.Config?.Star?.tint;
|
||||
if (starColor != null) return starColor.ToColor();
|
||||
if (starColor != null) return starColor;
|
||||
|
||||
var atmoColor = body.Config.Atmosphere?.atmosphereTint;
|
||||
if (body.Config.Atmosphere?.clouds != null && atmoColor != null) return atmoColor.ToColor();
|
||||
if (body.Config.Atmosphere?.clouds != null && atmoColor != null) return atmoColor;
|
||||
|
||||
if (body.Config?.HeightMap?.textureMap != null)
|
||||
{
|
||||
@ -538,13 +538,13 @@ namespace NewHorizons.Builder.ShipLog
|
||||
}
|
||||
|
||||
var waterColor = body.Config.Water?.tint;
|
||||
if (waterColor != null) return waterColor.ToColor();
|
||||
if (waterColor != null) return waterColor;
|
||||
|
||||
var lavaColor = body.Config.Lava?.tint;
|
||||
if (lavaColor != null) return lavaColor.ToColor();
|
||||
if (lavaColor != null) return lavaColor;
|
||||
|
||||
var sandColor = body.Config.Sand?.Tint;
|
||||
if (sandColor != null) return sandColor.ToColor();
|
||||
if (sandColor != null) return sandColor;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
@ -31,8 +31,8 @@ namespace NewHorizons.Builder.ShipLog
|
||||
{
|
||||
CuriosityName newName = (CuriosityName)8 + _rawNameToCuriosityName.Count;
|
||||
_rawNameToCuriosityName.Add(newColor.id, newName);
|
||||
_curiosityColors.Add(newName, newColor.color.ToColor());
|
||||
_curiosityHighlightColors.Add(newName, newColor.highlightColor.ToColor());
|
||||
_curiosityColors.Add(newName, newColor.color);
|
||||
_curiosityHighlightColors.Add(newName, newColor.highlightColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,12 +2,13 @@
|
||||
{
|
||||
public interface IOrbitalParameters
|
||||
{
|
||||
float Inclination { get; set; }
|
||||
float SemiMajorAxis { get; set; }
|
||||
float LongitudeOfAscendingNode { get; set; }
|
||||
float Eccentricity { get; set; }
|
||||
float ArgumentOfPeriapsis { get; set; }
|
||||
float TrueAnomaly { get; set; }
|
||||
// lowercase cuz schema
|
||||
float inclination { get; set; }
|
||||
float semiMajorAxis { get; set; }
|
||||
float longitudeOfAscendingNode { get; set; }
|
||||
float eccentricity { get; set; }
|
||||
float argumentOfPeriapsis { get; set; }
|
||||
float trueAnomaly { get; set; }
|
||||
|
||||
OrbitalParameters GetOrbitalParameters(Gravity primaryGravity, Gravity secondaryGravity);
|
||||
}
|
||||
|
||||
@ -3,38 +3,38 @@ namespace NewHorizons.Components.Orbital
|
||||
{
|
||||
public class NHAstroObject : AstroObject, IOrbitalParameters
|
||||
{
|
||||
public float Inclination { get; set; }
|
||||
public float SemiMajorAxis { get; set; }
|
||||
public float LongitudeOfAscendingNode { get; set; }
|
||||
public float Eccentricity { get; set; }
|
||||
public float ArgumentOfPeriapsis { get; set; }
|
||||
public float TrueAnomaly { get; set; }
|
||||
public float inclination { get; set; }
|
||||
public float semiMajorAxis { get; set; }
|
||||
public float longitudeOfAscendingNode { get; set; }
|
||||
public float eccentricity { get; set; }
|
||||
public float argumentOfPeriapsis { get; set; }
|
||||
public float trueAnomaly { get; set; }
|
||||
public bool HideDisplayName { get; set; }
|
||||
|
||||
public void SetOrbitalParametersFromConfig(OrbitModule orbit)
|
||||
{
|
||||
SetOrbitalParametersFromTrueAnomaly(orbit.Eccentricity, orbit.SemiMajorAxis, orbit.Inclination, orbit.ArgumentOfPeriapsis, orbit.LongitudeOfAscendingNode, orbit.TrueAnomaly);
|
||||
SetOrbitalParametersFromTrueAnomaly(orbit.eccentricity, orbit.semiMajorAxis, orbit.inclination, orbit.argumentOfPeriapsis, orbit.longitudeOfAscendingNode, orbit.trueAnomaly);
|
||||
}
|
||||
|
||||
public void SetOrbitalParametersFromTrueAnomaly(float ecc, float a, float i, float p, float l, float trueAnomaly)
|
||||
{
|
||||
Inclination = ecc;
|
||||
SemiMajorAxis = a;
|
||||
LongitudeOfAscendingNode = l;
|
||||
Inclination = i;
|
||||
Eccentricity = ecc;
|
||||
ArgumentOfPeriapsis = p;
|
||||
TrueAnomaly = trueAnomaly;
|
||||
inclination = ecc;
|
||||
semiMajorAxis = a;
|
||||
longitudeOfAscendingNode = l;
|
||||
inclination = i;
|
||||
eccentricity = ecc;
|
||||
argumentOfPeriapsis = p;
|
||||
this.trueAnomaly = trueAnomaly;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"ParameterizedAstroObject: Eccentricity {Eccentricity}, SemiMajorAxis {SemiMajorAxis}, Inclination {Inclination}, ArgumentOfPeriapsis {ArgumentOfPeriapsis}, LongitudeOfAscendingNode {LongitudeOfAscendingNode}, TrueAnomaly {TrueAnomaly}";
|
||||
return $"ParameterizedAstroObject: Eccentricity {eccentricity}, SemiMajorAxis {semiMajorAxis}, Inclination {inclination}, ArgumentOfPeriapsis {argumentOfPeriapsis}, LongitudeOfAscendingNode {longitudeOfAscendingNode}, TrueAnomaly {trueAnomaly}";
|
||||
}
|
||||
|
||||
public OrbitalParameters GetOrbitalParameters(Gravity primaryGravity, Gravity secondaryGravity)
|
||||
{
|
||||
return OrbitalParameters.FromTrueAnomaly(primaryGravity, secondaryGravity, Eccentricity, SemiMajorAxis, Inclination, ArgumentOfPeriapsis, LongitudeOfAscendingNode, TrueAnomaly);
|
||||
return OrbitalParameters.FromTrueAnomaly(primaryGravity, secondaryGravity, eccentricity, semiMajorAxis, inclination, argumentOfPeriapsis, longitudeOfAscendingNode, trueAnomaly);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,12 +4,12 @@ namespace NewHorizons.Components.Orbital
|
||||
{
|
||||
public class OrbitalParameters : IOrbitalParameters
|
||||
{
|
||||
public float Inclination { get; set; }
|
||||
public float SemiMajorAxis { get; set; }
|
||||
public float LongitudeOfAscendingNode { get; set; }
|
||||
public float Eccentricity { get; set; }
|
||||
public float ArgumentOfPeriapsis { get; set; }
|
||||
public float TrueAnomaly { get; set; }
|
||||
public float inclination { get; set; }
|
||||
public float semiMajorAxis { get; set; }
|
||||
public float longitudeOfAscendingNode { get; set; }
|
||||
public float eccentricity { get; set; }
|
||||
public float argumentOfPeriapsis { get; set; }
|
||||
public float trueAnomaly { get; set; }
|
||||
public float Period { get; set; }
|
||||
|
||||
public Vector3 InitialPosition { get; private set; }
|
||||
@ -19,11 +19,11 @@ 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.SemiMajorAxis = semiMajorAxis;
|
||||
orbitalParameters.LongitudeOfAscendingNode = longitudeOfAscendingNode;
|
||||
orbitalParameters.Eccentricity = eccentricity;
|
||||
orbitalParameters.ArgumentOfPeriapsis = argumentOfPeriapsis;
|
||||
orbitalParameters.inclination = inclination;
|
||||
orbitalParameters.semiMajorAxis = semiMajorAxis;
|
||||
orbitalParameters.longitudeOfAscendingNode = longitudeOfAscendingNode;
|
||||
orbitalParameters.eccentricity = eccentricity;
|
||||
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)
|
||||
@ -31,7 +31,7 @@ namespace NewHorizons.Components.Orbital
|
||||
trueAnomaly = 0;
|
||||
}
|
||||
|
||||
orbitalParameters.TrueAnomaly = trueAnomaly;
|
||||
orbitalParameters.trueAnomaly = trueAnomaly;
|
||||
|
||||
// Have to calculate the rest
|
||||
|
||||
@ -110,7 +110,7 @@ namespace NewHorizons.Components.Orbital
|
||||
|
||||
public OrbitalParameters GetOrbitalParameters(Gravity primaryGravity, Gravity secondaryGravity)
|
||||
{
|
||||
return FromTrueAnomaly(primaryGravity, secondaryGravity, Eccentricity, SemiMajorAxis, Inclination, ArgumentOfPeriapsis, LongitudeOfAscendingNode, TrueAnomaly);
|
||||
return FromTrueAnomaly(primaryGravity, secondaryGravity, eccentricity, semiMajorAxis, inclination, argumentOfPeriapsis, longitudeOfAscendingNode, trueAnomaly);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ namespace NewHorizons.Components
|
||||
|
||||
// Figure out what the new orbit will be if we switch
|
||||
var newOrbit = newState.orbit ?? groundState.orbit;
|
||||
newOrbit.TrueAnomaly = Random.Range(0f, 360f);
|
||||
newOrbit.trueAnomaly = Random.Range(0f, 360f);
|
||||
|
||||
primaryBody = AstroObjectLocator.GetAstroObject(newOrbit.PrimaryBody);
|
||||
var primaryGravity = new Gravity(primaryBody.GetGravityVolume());
|
||||
@ -131,7 +131,7 @@ namespace NewHorizons.Components
|
||||
_detector._activeVolumes = new List<EffectVolume>() { primaryBody.GetGravityVolume() };
|
||||
if (_alignment != null) _alignment.SetTargetBody(primaryBody.GetComponent<OWRigidbody>());
|
||||
|
||||
_astroObject.SetOrbitalParametersFromTrueAnomaly(orbitalParameters.Eccentricity, orbitalParameters.SemiMajorAxis, orbitalParameters.Inclination, orbitalParameters.ArgumentOfPeriapsis, orbitalParameters.LongitudeOfAscendingNode, orbitalParameters.TrueAnomaly);
|
||||
_astroObject.SetOrbitalParametersFromTrueAnomaly(orbitalParameters.eccentricity, orbitalParameters.semiMajorAxis, orbitalParameters.inclination, orbitalParameters.argumentOfPeriapsis, orbitalParameters.longitudeOfAscendingNode, orbitalParameters.trueAnomaly);
|
||||
|
||||
PlanetCreationHandler.UpdatePosition(gameObject, orbitalParameters, primaryBody, _astroObject);
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ namespace NewHorizons.Components.SizeControllers
|
||||
}
|
||||
else
|
||||
{
|
||||
_startColour = startColour.ToColor();
|
||||
_startColour = startColour;
|
||||
_startSurfaceMaterial.color = _startColour;
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ namespace NewHorizons.Components.SizeControllers
|
||||
}
|
||||
else
|
||||
{
|
||||
_endColour = endColour.ToColor();
|
||||
_endColour = endColour;
|
||||
_endSurfaceMaterial.color = _endColour;
|
||||
}
|
||||
|
||||
|
||||
16
NewHorizons/External/Modules/OrbitModule.cs
vendored
16
NewHorizons/External/Modules/OrbitModule.cs
vendored
@ -69,40 +69,40 @@ namespace NewHorizons.External.Modules
|
||||
/// </summary>
|
||||
[Range(0f, double.MaxValue)]
|
||||
[DefaultValue(5000f)]
|
||||
public float SemiMajorAxis { get; set; }
|
||||
public float semiMajorAxis { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The angle (in degrees) between the body's orbit and the plane of the star system
|
||||
/// </summary>
|
||||
public float Inclination { get; set; }
|
||||
public float inclination { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// An angle (in degrees) defining the point where the orbit of the body rises above the orbital plane if it has
|
||||
/// nonzero inclination.
|
||||
/// </summary>
|
||||
public float LongitudeOfAscendingNode { get; set; }
|
||||
public float longitudeOfAscendingNode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// At 0 the orbit is a circle. The closer to 1 it is, the more oval-shaped the orbit is.
|
||||
/// </summary>
|
||||
[Range(0f, 0.9999999999f)]
|
||||
public float Eccentricity { get; set; }
|
||||
public float eccentricity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// An angle (in degrees) defining the location of the periapsis (the closest distance to it's primary body) if it has
|
||||
/// nonzero eccentricity.
|
||||
/// </summary>
|
||||
public float ArgumentOfPeriapsis { get; set; }
|
||||
public float argumentOfPeriapsis { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Where the planet should start off in its orbit in terms of the central angle.
|
||||
/// </summary>
|
||||
public float TrueAnomaly { get; set; }
|
||||
public float trueAnomaly { get; set; }
|
||||
|
||||
public OrbitalParameters GetOrbitalParameters(Gravity primaryGravity, Gravity secondaryGravity)
|
||||
{
|
||||
return OrbitalParameters.FromTrueAnomaly(primaryGravity, secondaryGravity, Eccentricity, SemiMajorAxis,
|
||||
Inclination, ArgumentOfPeriapsis, LongitudeOfAscendingNode, TrueAnomaly);
|
||||
return OrbitalParameters.FromTrueAnomaly(primaryGravity, secondaryGravity, eccentricity, semiMajorAxis,
|
||||
inclination, argumentOfPeriapsis, longitudeOfAscendingNode, trueAnomaly);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -187,7 +187,7 @@ namespace NewHorizons.Handlers
|
||||
if (sector.transform.childCount == 0) sector = quantumPlanet.groundState.sector;
|
||||
|
||||
// If semimajor axis is 0 then forget the orbit
|
||||
var orbit = body.Config.Orbit.SemiMajorAxis == 0 ? quantumPlanet.groundState.orbit : body.Config.Orbit;
|
||||
var orbit = body.Config.Orbit.semiMajorAxis == 0 ? quantumPlanet.groundState.orbit : body.Config.Orbit;
|
||||
|
||||
quantumPlanet.states.Add(new QuantumPlanet.State(sector, orbit));
|
||||
}
|
||||
@ -243,7 +243,7 @@ namespace NewHorizons.Handlers
|
||||
var rb = go.GetAttachedOWRigidbody();
|
||||
|
||||
// Since orbits are always there just check if they set a semi major axis
|
||||
if (body.Config.Orbit != null && body.Config.Orbit.SemiMajorAxis != 0f)
|
||||
if (body.Config.Orbit != null && body.Config.Orbit.semiMajorAxis != 0f)
|
||||
{
|
||||
UpdateBodyOrbit(body, go);
|
||||
}
|
||||
|
||||
@ -8,15 +8,14 @@
|
||||
<Copyright>Copyright © 2020</Copyright>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugType>portable</DebugType>
|
||||
<DocumentationFile>C:\Users\bwc67\AppData\Roaming\OuterWildsModManager\OWML\Mods\xen.NewHorizons\NewHorizons.xml</DocumentationFile>
|
||||
<NoWarn>1701;1702;1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>none</DebugType>
|
||||
<DocumentationFile>C:\Users\bwc67\AppData\Roaming\OuterWildsModManager\OWML\Mods\xen.NewHorizons\NewHorizons.xml</DocumentationFile>
|
||||
<NoWarn>1701;1702;1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@ -39,8 +39,6 @@ namespace NewHorizons.Utility
|
||||
[DefaultValue(255f)]
|
||||
public int a;
|
||||
|
||||
public Color32 ToColor32() => new Color32((byte)r, (byte)g, (byte)b, (byte)a);
|
||||
|
||||
public Color ToColor() => new Color(r / 255f, g / 255f, b / 255f, a / 255f);
|
||||
public static implicit operator Color(MColor c) => new Color(c.r / 255f, c.g / 255f, c.b / 255f, c.a / 255f);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user