Skip to content

Commit

Permalink
Don't auto-delete ejection burn when calculating plane change
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Nov 6, 2022
1 parent ea2cdb6 commit d976a43
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
5 changes: 5 additions & 0 deletions GameData/Astrogator/Astrogator-Changelog.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ KERBALCHANGELOG
change = Fix plane changes
type = Fix
}
CHANGE
{
change = Don't auto-delete ejection burn when calculating plane change
type = Fix
}
}
VERSION
{
Expand Down
14 changes: 9 additions & 5 deletions Source/TransferModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -520,15 +520,17 @@ public void CalculatePlaneChangeBurn()
bool ejectionAlreadyActive = false;

if (FlightGlobals.ActiveVessel.patchedConicSolver.maneuverNodes.Count > 0) {
if (Settings.Instance.DeleteExistingManeuvers) {

ClearManeuverNodes();

} else if (FlightGlobals.ActiveVessel.patchedConicSolver.maneuverNodes.Count == 1
if (FlightGlobals.ActiveVessel.patchedConicSolver.maneuverNodes.Count == 1
&& ejectionBurn.node != null) {

DbgFmt("Ejection burn is already active");
ejectionAlreadyActive = true;

} else if (Settings.Instance.DeleteExistingManeuvers) {

DbgFmt("Clearing nodes");
ClearManeuverNodes();

} else {
// At least one unrelated maneuver is active, and we're not allowed to delete them.
// Can't activate ejection burn for calculation.
Expand All @@ -540,6 +542,7 @@ public void CalculatePlaneChangeBurn()

ManeuverNode eNode;
if (ejectionAlreadyActive) {
DbgFmt("Using existing ejection burn");
eNode = ejectionBurn.node;
} else {
DbgFmt("Temporarily activating ejection burn to {0}", destination.GetName());
Expand Down Expand Up @@ -591,6 +594,7 @@ public void CalculatePlaneChangeBurn()

if (!ejectionAlreadyActive) {
// Clean up the node since we're just doing calculations, not intending to set things up for the user
DbgFmt("Removing temporary ejection burn");
ejectionBurn.RemoveNode();
}
DbgFmt("Released completed transfer to {0}", destination.GetName());
Expand Down

0 comments on commit d976a43

Please sign in to comment.