Skip to content
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

Return 0 if vessel is on escape trajectory. Since KSP recalcs the orbit ... #253

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
8 changes: 4 additions & 4 deletions BindingsFlightStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ public class BindingsFlightStats : Binding
public override void AddTo(BindingManager manager)
{
manager.AddGetter("ALT:RADAR", delegate(CPU cpu) { return cpu.Vessel.heightFromTerrain > 0 ? Mathf.Min(cpu.Vessel.heightFromTerrain, (float)cpu.Vessel.altitude) : (float)cpu.Vessel.altitude; });
manager.AddGetter("ALT:APOAPSIS", delegate(CPU cpu) { return cpu.Vessel.orbit.ApA; });
manager.AddGetter("ALT:PERIAPSIS", delegate(CPU cpu) { return cpu.Vessel.orbit.PeA; });
manager.AddGetter("ETA:APOAPSIS", delegate(CPU cpu) { return cpu.Vessel.orbit.timeToAp; });
manager.AddGetter("ETA:PERIAPSIS", delegate(CPU cpu) { return cpu.Vessel.orbit.timeToPe; });
manager.AddGetter("ALT:APOAPSIS", delegate(CPU cpu) { if (cpu.Vessel.situation.ToString() == "ESCAPING") { return 0;} else return cpu.Vessel.orbit.ApA; });
manager.AddGetter("ALT:PERIAPSIS", delegate(CPU cpu) { if (cpu.Vessel.situation.ToString() == "ESCAPING") { return 0;} else return cpu.Vessel.orbit.PeA; });
manager.AddGetter("ETA:APOAPSIS", delegate(CPU cpu) { if (cpu.Vessel.situation.ToString() == "ESCAPING") { return 0;} else return cpu.Vessel.orbit.timeToAp; });
manager.AddGetter("ETA:PERIAPSIS", delegate(CPU cpu) { if (cpu.Vessel.situation.ToString() == "ESCAPING") { return 0;} else return cpu.Vessel.orbit.timeToPe; });

manager.AddGetter("MISSIONTIME", delegate(CPU cpu) { return cpu.Vessel.missionTime; });
manager.AddGetter("TIME", delegate(CPU cpu) { return new kOS.TimeSpan(Planetarium.GetUniversalTime()); });
Expand Down
4 changes: 2 additions & 2 deletions VesselTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ public override object GetSuffix(string suffixName)
if (suffixName == "AIRSPEED") return (target.orbit.GetVel() - FlightGlobals.currentMainBody.getRFrmVel(target.GetWorldPos3D())).magnitude; //the velocity of the vessel relative to the air);
if (suffixName == "VESSELNAME") return target.vesselName;
if (suffixName == "ALTITUDE") return target.altitude;
if (suffixName == "APOAPSIS") return target.orbit.ApA;
if (suffixName == "PERIAPSIS") return target.orbit.PeA;
if (suffixName == "APOAPSIS") if (target.situation.ToString() == "ESCAPING") { return 0;} else return target.orbit.ApA;
if (suffixName == "PERIAPSIS") if (target.situation.ToString() == "ESCAPING") { return 0;} else return target.orbit.PeA;
if (suffixName == "SENSOR") return new VesselSensors(target);
if (suffixName == "TERMVELOCITY") return VesselUtils.GetTerminalVelocity(target);

Expand Down