Skip to content

Add back INLIGHT and fix casting of sensors to allow for comparison. #252

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion BindingsFlightStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public override void AddTo(BindingManager manager)
manager.AddGetter("STATUS", delegate(CPU cpu) { return cpu.Vessel.situation.ToString().Replace("_", " "); });
manager.AddGetter("COMMRANGE", delegate(CPU cpu) { return VesselUtils.GetCommRange(cpu.Vessel); });
manager.AddGetter("INCOMMRANGE", delegate(CPU cpu) { return Convert.ToDouble(CheckCommRange(cpu.Vessel)); });

manager.AddGetter("INLIGHT", delegate(CPU cpu) { var KerbExpossure = new VesselSensors(cpu.Vessel).KerbolExposure; return KerbExpossure > 0 ? true : false; });

manager.AddGetter("AV", delegate(CPU cpu) { return cpu.Vessel.transform.InverseTransformDirection(cpu.Vessel.rigidbody.angularVelocity); });
manager.AddGetter("STAGE", delegate(CPU cpu) { return new StageValues(cpu.Vessel); });

Expand Down
10 changes: 5 additions & 5 deletions VesselSensors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ namespace kOS
public class VesselSensors : SpecialValue
{
Vector acceleration = new Vector(0, 0, 0);
Single pressure = 0;
Single temperature = 0;
double pressure = 0;
double temperature = 0;
Vector geeForce = new Vector(0, 0, 0);
Single KerbolExposure = 0;
public double KerbolExposure = 0;

public VesselSensors(Vessel target)
{
Expand All @@ -29,7 +29,7 @@ public VesselSensors(Vessel target)
acceleration = new Vector(FlightGlobals.getGeeForceAtPosition(part.transform.position) - target.acceleration);
break;
case "PRES":
pressure = (Single)FlightGlobals.getStaticPressure();
pressure = FlightGlobals.getStaticPressure();
break;
case "TEMP":
temperature = part.temperature;
Expand All @@ -41,7 +41,7 @@ public VesselSensors(Vessel target)
}
foreach (ModuleDeployableSolarPanel c in part.FindModulesImplementing<ModuleDeployableSolarPanel>())
{
KerbolExposure += (Single)c.sunAOA;
KerbolExposure += c.sunAOA;
}
}
}
Expand Down