Skip to content

Commit

Permalink
Sigma88 said I should ping him
Browse files Browse the repository at this point in the history
Use a semi-constant value instead of the stars luminosity
Dorian Stoll committed May 23, 2017
1 parent bde791d commit 2a44890
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion Kopernicus/Kopernicus.Components/KopernicusSolarPanel.cs
Original file line number Diff line number Diff line change
@@ -30,6 +30,7 @@
using UnityEngine;
using System;
using System.Linq;
using System.Reflection;

namespace Kopernicus
{
@@ -40,6 +41,19 @@ namespace Components
/// </summary>
public class KopernicusSolarPanel : ModuleDeployableSolarPanel
{
public static Double stockLuminosity;

static KopernicusSolarPanel()
{
String filename = (String) typeof(PhysicsGlobals).GetFields(BindingFlags.Instance | BindingFlags.NonPublic).First(f => f.FieldType == typeof(String)).GetValue(PhysicsGlobals.Instance);
ConfigNode node = ConfigNode.Load(filename);
String value = node.GetValue("solarLuminosityAtHome");
if (value != null)
{
stockLuminosity = Double.Parse(value);
}
}

public override void PostCalculateTracking(Boolean trackingLOS, Vector3 trackingDirection)
{
// Ugly hack ahead
@@ -50,7 +64,7 @@ public override void PostCalculateTracking(Boolean trackingLOS, Vector3 tracking
foreach (KopernicusStar star in KopernicusStar.Stars)
{
if (KopernicusStar.SolarFlux.ContainsKey(star.name))
distMult += (Single)(KopernicusStar.SolarFlux[star.name] / star.shifter.solarLuminosity);
distMult += (Single)(KopernicusStar.SolarFlux[star.name] / stockLuminosity);
}
powerCurve = new FloatCurve(new [] { new Keyframe(0, distMult), new Keyframe(1, distMult) });
useCurve = true;

0 comments on commit 2a44890

Please sign in to comment.