Skip to content

Commit

Permalink
Node executor code cleanup
Browse files Browse the repository at this point in the history
This is automated cleanup and shoudln't change behavior

Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
  • Loading branch information
lamont-granquist committed Oct 23, 2023
1 parent 87f6ef2 commit e047769
Show file tree
Hide file tree
Showing 19 changed files with 109 additions and 120 deletions.
2 changes: 1 addition & 1 deletion MechJeb2/LandingAutopilot/CoastToDeceleration.cs
Expand Up @@ -114,7 +114,7 @@ public override AutopilotStep OnFixedUpdate()
}

//Warp at a rate no higher than the rate that would have us impacting the ground 10 seconds from now:
if (_warpReady && Core.Node.autowarp)
if (_warpReady && Core.Node.Autowarp)
{
// Make sure if we're hovering that we don't go straight into too fast of a warp
// (g * 5 is average velocity falling for 10 seconds from a hover)
Expand Down
2 changes: 1 addition & 1 deletion MechJeb2/LandingAutopilot/DecelerationBurn.cs
Expand Up @@ -39,7 +39,7 @@ public override AutopilotStep OnFixedUpdate()
Core.Attitude.attitudeTo(decelerationStartAttitude, AttitudeReference.INERTIAL, Core.Landing);
bool warpReady = Core.Attitude.attitudeAngleFromTarget() < 5;

if (warpReady && Core.Node.autowarp)
if (warpReady && Core.Node.Autowarp)
Core.Warp.WarpToUT(decelerationStartTime - 5);
else if (!MuUtils.PhysicsRunning())
Core.Warp.MinimumWarp();
Expand Down
2 changes: 1 addition & 1 deletion MechJeb2/LandingAutopilot/DeorbitBurn.cs
Expand Up @@ -108,7 +108,7 @@ public override AutopilotStep OnFixedUpdate()
else
{
Core.Attitude.attitudeTo(Vector3d.back, AttitudeReference.ORBIT, Core.Landing);
if (Core.Node.autowarp) Core.Warp.WarpRegularAtRate((float)(Orbit.period / 10));
if (Core.Node.Autowarp) Core.Warp.WarpRegularAtRate((float)(Orbit.period / 10));

Status = Localizer.Format("#MechJeb_LandingGuidance_Status8"); //"Moving to high deorbit burn point"
}
Expand Down
2 changes: 1 addition & 1 deletion MechJeb2/LandingAutopilot/FinalDescent.cs
Expand Up @@ -18,7 +18,7 @@ public override AutopilotStep OnFixedUpdate()
{
double minalt = Math.Min(VesselState.altitudeBottom, Math.Min(VesselState.altitudeASL, VesselState.altitudeTrue));

if (!Core.Node.autowarp || _aggressivePolicy == null) return this;
if (!Core.Node.Autowarp || _aggressivePolicy == null) return this;

double maxVel = 1.02 * _aggressivePolicy.MaxAllowedSpeed(VesselState.CoM - MainBody.position, VesselState.surfaceVelocity);

Expand Down
2 changes: 1 addition & 1 deletion MechJeb2/LandingAutopilot/LowDeorbitBurn.cs
Expand Up @@ -62,7 +62,7 @@ public override AutopilotStep OnFixedUpdate()
"#MechJeb_LandingGuidance_Status12"); //"Moving to low deorbit burn point"

//Warp toward deorbit burn if it hasn't been triggerd yet:
if (!_deorbitBurnTriggered && Core.Node.autowarp && rangeToTarget > 2 * triggerDistance)
if (!_deorbitBurnTriggered && Core.Node.Autowarp && rangeToTarget > 2 * triggerDistance)
Core.Warp.WarpRegularAtRate((float)(Orbit.period / 6));
if (rangeToTarget < triggerDistance && !MuUtils.PhysicsRunning()) Core.Warp.MinimumWarp();

Expand Down
2 changes: 1 addition & 1 deletion MechJeb2/LandingAutopilot/PlaneChange.cs
Expand Up @@ -82,7 +82,7 @@ public override AutopilotStep OnFixedUpdate()
}
else
{
if (Core.Node.autowarp) Core.Warp.WarpRegularAtRate((float)(Orbit.period / 6));
if (Core.Node.Autowarp) Core.Warp.WarpRegularAtRate((float)(Orbit.period / 6));
Status = Localizer.Format("#MechJeb_LandingGuidance_Status15"); //"Moving to low orbit plane change burn point"
}

Expand Down
4 changes: 2 additions & 2 deletions MechJeb2/MechJebModuleAscentBaseAutopilot.cs
Expand Up @@ -117,7 +117,7 @@ public override void OnFixedUpdate()
}
else
{
if (Core.Node.autowarp)
if (Core.Node.Autowarp)
Core.Warp.WarpToUT(_launchTime - AscentSettings.WarpCountDown);
}

Expand Down Expand Up @@ -280,7 +280,7 @@ private void DriveCircularizationBurn()
Core.Node.ExecuteOneNode(this);
}

Status = Localizer.Format(Core.Node.burnTriggered ? "#MechJeb_Ascent_status7" : "#MechJeb_Ascent_status8");
Status = Localizer.Format(Core.Node.BurnTriggered ? "#MechJeb_Ascent_status7" : "#MechJeb_Ascent_status8");
}

protected abstract bool DriveAscent2();
Expand Down
2 changes: 1 addition & 1 deletion MechJeb2/MechJebModuleAscentClassicAutopilot.cs
Expand Up @@ -176,7 +176,7 @@ private void DriveCoastToApoapsis()
Core.Thrust.TargetThrottle = ThrottleToRaiseApoapsis(Orbit.ApR, AscentSettings.DesiredOrbitAltitude + MainBody.Radius);
}

if (Core.Node.autowarp)
if (Core.Node.Autowarp)
{
//warp at x2 physical warp:
Core.Warp.WarpPhysicsAtRate(2);
Expand Down
2 changes: 1 addition & 1 deletion MechJeb2/MechJebModuleAscentGTAutopilot.cs
Expand Up @@ -228,7 +228,7 @@ private void DriveCoastToApoapsis()
}
else
{
if (Core.Node.autowarp)
if (Core.Node.Autowarp)
{
//warp at x2 physical warp:
Core.Warp.WarpPhysicsAtRate(2);
Expand Down
2 changes: 1 addition & 1 deletion MechJeb2/MechJebModuleAscentMenu.cs
Expand Up @@ -260,7 +260,7 @@ private void ShowAutoWarpGUIElements()
Profiler.BeginSample("MJ.GUIWindow.ShowAutoWarp");
GUILayout.BeginVertical(GUI.skin.box);

if (Core.Node.autowarp)
if (Core.Node.Autowarp)
GuiUtils.SimpleTextBox(CachedLocalizer.Instance.MechJeb_Ascent_label33, _ascentSettings.WarpCountDown, "s", 35); //Launch countdown:

bool targetExists = Core.Target.NormalTargetExists;
Expand Down
2 changes: 1 addition & 1 deletion MechJeb2/MechJebModuleAscentSettingsMenu.cs
Expand Up @@ -93,7 +93,7 @@ private void ShowAscentSettingsGUIElements()
GUILayout.Toggle(_ascentSettings.AutoDeployAntennas, CachedLocalizer.Instance.MechJeb_Ascent_checkbox7); //Auto-deploy antennas

GUILayout.BeginHorizontal();
Core.Node.autowarp = GUILayout.Toggle(Core.Node.autowarp, CachedLocalizer.Instance.MechJeb_Ascent_checkbox8); //Auto-warp
Core.Node.Autowarp = GUILayout.Toggle(Core.Node.Autowarp, CachedLocalizer.Instance.MechJeb_Ascent_checkbox8); //Auto-warp
if (_ascentSettings.AscentType != AscentType.PVG)
{
_ascentSettings.SkipCircularization =
Expand Down
2 changes: 1 addition & 1 deletion MechJeb2/MechJebModuleLandingGuidance.cs
Expand Up @@ -137,7 +137,7 @@ protected override void WindowGUI(int windowID)
35); //Touchdown speed:

if (Core.Landing != null)
Core.Node.autowarp = GUILayout.Toggle(Core.Node.autowarp, Localizer.Format("#MechJeb_LandingGuidance_checkbox1")); //Auto-warp
Core.Node.Autowarp = GUILayout.Toggle(Core.Node.Autowarp, Localizer.Format("#MechJeb_LandingGuidance_checkbox1")); //Auto-warp

Core.Landing.DeployGears =
GUILayout.Toggle(Core.Landing.DeployGears, Localizer.Format("#MechJeb_LandingGuidance_checkbox2")); //Deploy Landing Gear
Expand Down
20 changes: 10 additions & 10 deletions MechJeb2/MechJebModuleManeuverPlanner.cs
Expand Up @@ -156,47 +156,47 @@ protected override void WindowGUI(int windowID)
}

GUILayout.BeginHorizontal();
Core.Node.autowarp =
GUILayout.Toggle(Core.Node.autowarp, Localizer.Format("#MechJeb_Maneu_Autowarp"), GUILayout.ExpandWidth(true)); //"Auto-warp"
Core.Node.Autowarp =
GUILayout.Toggle(Core.Node.Autowarp, Localizer.Format("#MechJeb_Maneu_Autowarp"), GUILayout.ExpandWidth(true)); //"Auto-warp"

GUILayout.BeginVertical();
GUILayout.BeginHorizontal();
GUILayout.Label(Localizer.Format("#MechJeb_Maneu_Tolerance"), GUILayout.ExpandWidth(false)); //"Tolerance:"
Core.Node.tolerance.text = GUILayout.TextField(Core.Node.tolerance.text, GUILayout.Width(35), GUILayout.ExpandWidth(false));
Core.Node.Tolerance.text = GUILayout.TextField(Core.Node.Tolerance.text, GUILayout.Width(35), GUILayout.ExpandWidth(false));
if (GUILayout.Button("+", GUILayout.ExpandWidth(false)))
{
Core.Node.tolerance.val += 0.1;
Core.Node.Tolerance.val += 0.1;
}

if (GUILayout.Button("-", GUILayout.ExpandWidth(false)))
{
Core.Node.tolerance.val -= Core.Node.tolerance.val > 0.1 ? 0.1 : 0.0;
Core.Node.Tolerance.val -= Core.Node.Tolerance.val > 0.1 ? 0.1 : 0.0;
}

if (GUILayout.Button("R", GUILayout.ExpandWidth(false)))
{
Core.Node.tolerance.val = 0.1;
Core.Node.Tolerance.val = 0.1;
}

GUILayout.Label("m/s", GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal();

GUILayout.BeginHorizontal();
GUILayout.Label(Localizer.Format("#MechJeb_Maneu_Lead_time"), GUILayout.ExpandWidth(false)); //Lead time:
Core.Node.leadTime.text = GUILayout.TextField(Core.Node.leadTime.text, GUILayout.Width(35), GUILayout.ExpandWidth(false));
Core.Node.LeadTime.text = GUILayout.TextField(Core.Node.LeadTime.text, GUILayout.Width(35), GUILayout.ExpandWidth(false));
if (GUILayout.Button("+", GUILayout.ExpandWidth(false)))
{
Core.Node.leadTime.val += 1;
Core.Node.LeadTime.val += 1;
}

if (GUILayout.Button("-", GUILayout.ExpandWidth(false)))
{
Core.Node.leadTime.val -= 1;
Core.Node.LeadTime.val -= 1;
}

if (GUILayout.Button("R", GUILayout.ExpandWidth(false)))
{
Core.Node.leadTime.val = 3;
Core.Node.LeadTime.val = 3;
}

GUILayout.Label("s", GUILayout.ExpandWidth(false));
Expand Down
4 changes: 2 additions & 2 deletions MechJeb2/MechJebModuleMenu.cs
Expand Up @@ -387,8 +387,8 @@ public void SetupToolBarButtons()

CreateFeatureButton(maneuverPlannerModule, "Auto_Warp", "MechJeb Auto-warp", b =>
{
Core.Node.autowarp = !Core.Node.autowarp;
}, () => Core.Node.autowarp);
Core.Node.Autowarp = !Core.Node.Autowarp;
}, () => Core.Node.Autowarp);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions MechJeb2/MechJebModuleNodeEditor.cs
Expand Up @@ -281,10 +281,10 @@ protected override void WindowGUI(int windowID)
}

GUILayout.BeginHorizontal();
Core.Node.autowarp =
GUILayout.Toggle(Core.Node.autowarp, Localizer.Format("#MechJeb_NodeEd_checkbox1"), GUILayout.ExpandWidth(true)); //"Auto-warp"
Core.Node.Autowarp =
GUILayout.Toggle(Core.Node.Autowarp, Localizer.Format("#MechJeb_NodeEd_checkbox1"), GUILayout.ExpandWidth(true)); //"Auto-warp"
GUILayout.Label(Localizer.Format("#MechJeb_NodeEd_Label7"), GUILayout.ExpandWidth(false)); //"Tolerance:"
Core.Node.tolerance.text = GUILayout.TextField(Core.Node.tolerance.text, GUILayout.Width(35), GUILayout.ExpandWidth(false));
Core.Node.Tolerance.text = GUILayout.TextField(Core.Node.Tolerance.text, GUILayout.Width(35), GUILayout.ExpandWidth(false));
GUILayout.Label("m/s", GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal();
}
Expand Down

0 comments on commit e047769

Please sign in to comment.