Skip to content

Commit

Permalink
Fix 2 issues of permanent shutdown caused by duplicate hibernation co…
Browse files Browse the repository at this point in the history
…mmand and player's maneuver commands being deleted
  • Loading branch information
KSP-TaxiService committed Jul 17, 2018
1 parent a5186f9 commit 38fd37b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/RemoteTech/FlightComputer/Commands/HibernationCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,18 @@ public override bool Pop(FlightComputer fc)
{
activeHibCommand.Abort();
}
else if (this.PowerMode == PowerModes.Hibernate && activeHibCommand.PowerMode == PowerModes.Hibernate)
{
return false;
}
else if (this.PowerMode == PowerModes.AntennaSaver&& activeHibCommand.PowerMode == PowerModes.Hibernate)
{
activeHibCommand.Abort();
}
else if (this.PowerMode == PowerModes.AntennaSaver && activeHibCommand.PowerMode == PowerModes.AntennaSaver)
{
return false;
}
}

if (PowerMode == PowerModes.Hibernate)
Expand Down Expand Up @@ -141,7 +149,7 @@ public override bool Execute(FlightComputer fc, FlightCtrlState ctrlState)
var cmdsToDrop = new List<ICommand>();
for(int i=0; i<fc.QueuedCommands.Count(); i++)
{
if (!(fc.QueuedCommands.ElementAt(i) is HibernationCommand))
if (!(fc.QueuedCommands.ElementAt(i) is HibernationCommand || fc.QueuedCommands.ElementAt(i) is ManeuverCommand))//don't mess with player's maneuver nodes
cmdsToDrop.Add(fc.QueuedCommands.ElementAt(i));
else
break;//found next hiberation command
Expand Down

0 comments on commit 38fd37b

Please sign in to comment.