Skip to content

Commit

Permalink
Added OrbitGoal: minVerticalSpeed and maxVerticalSpeed mission script…
Browse files Browse the repository at this point in the history
… commands
  • Loading branch information
vaughner81 committed Jun 11, 2013
1 parent 0bd35d3 commit 14e6fdb
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions plugin/OrbitGoal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ public class OrbitGoal : MissionGoal
public double minSpeedOverGround = 0.0;
public double maxSpeedOverGround = 0.0;

public double minVerticalSpeed = 0.0;
public double maxVerticalSpeed = 0.0;

public String body = "Kerbin";

protected override List<Value> values(Vessel vessel) {
Expand Down Expand Up @@ -180,6 +183,24 @@ protected override List<Value> values(Vessel vessel) {
}
}

if (minVerticalSpeed != 0.0) { //both min and max Vertical Speed variables are tested in game. Good Test.
if (vessel == null) {
values.Add (new Value ("Min Vertical Speed", String.Format(MathTools.SingleDoubleValue, minVerticalSpeed)));
} else {
values.Add (new Value ("Min Vertical Speed", String.Format(MathTools.SingleDoubleValue, minVerticalSpeed),
vessel.verticalSpeed, vessel.verticalSpeed >= minVerticalSpeed));
}
}

if (maxVerticalSpeed != 0.0) {
if (vessel == null) {
values.Add (new Value ("Max Vertical Speed", String.Format(MathTools.SingleDoubleValue, maxVerticalSpeed)));
} else {
values.Add (new Value ("Max Vertical Speed", String.Format(MathTools.SingleDoubleValue, maxVerticalSpeed),
vessel.verticalSpeed, vessel.verticalSpeed <= maxVerticalSpeed));
}
}

return values;
}

Expand Down

0 comments on commit 14e6fdb

Please sign in to comment.