Skip to content

Commit

Permalink
Fix a couple avionics bugs
Browse files Browse the repository at this point in the history
Thanks, chrisl
* Was locking when current crew > required crew, rather than <
* Was skipping avionics modules that weren't on the same part as a
command module.
  • Loading branch information
NathanKell committed Apr 9, 2015
1 parent d555f20 commit 81f0c26
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Binary file modified GameData/RP-0/Plugins/RP0.dll
Binary file not shown.
12 changes: 5 additions & 7 deletions Source/ControlLocker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,8 @@ public static bool ShouldLock(List<Part> parts, bool countClamps, out float maxM
// if we count clamps, they can give control. If we don't, this works only if the part isn't a clamp.
if ((countClamps || !clamp) && cmd && !science && !avionics)
return false;

if (cmd && avionics) // check if need crew
{
bool flag = true;
if (mC.minimumCrew > 0) // if we need crew
{
if (crewCount < 0) // see if we cached crew
Expand All @@ -64,14 +62,14 @@ public static bool ShouldLock(List<Part> parts, bool countClamps, out float maxM
crewCount = CMAssignmentDialog.Instance.GetManifest().GetAllCrew(false).Count;
else crewCount = 0; // or assume no crew (should never trip this)
}
if (mC.minimumCrew < crewCount)
flag = false;
if (mC.minimumCrew > crewCount)
avionics = false; // not operational
}
if(flag)
maxMass += partAvionicsMass;
}
if (avionics)
maxMass += partAvionicsMass;
}
if (maxMass >= vesselMass) // will only be reached if the best we have is avionics.
if (maxMass > vesselMass) // will only be reached if the best we have is avionics.
return false; // unlock if our max avionics mass is >= vessel mass
// NOTE: we don't update for fuel burnt, because avionics needs to be able to handle the size
// as well as the fuel.
Expand Down

0 comments on commit 81f0c26

Please sign in to comment.