Skip to content

Commit

Permalink
Close flightcomputer after switching vessel
Browse files Browse the repository at this point in the history
  • Loading branch information
Peppie84 committed Jan 8, 2015
1 parent af5447f commit 94481a1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/RemoteTech/FlightComputer/FlightComputer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,24 @@ public FlightComputer(ISignalProcessor s)

var attitude = AttitudeCommand.Off();
mActiveCommands[attitude.Priority] = attitude;

GameEvents.onVesselChange.Add(OnVesselChange);
}

/// <summary>
/// After switching the vessel close the current flightcomputer.
/// </summary>
public void OnVesselChange(Vessel v)
{
Dispose();
}

public void Dispose()
{
RTLog.Notify("FlightComputer: Dispose");

GameEvents.onVesselChange.Remove(OnVesselChange);

if (Vessel != null)
{
Vessel.OnFlyByWire -= OnFlyByWirePre;
Expand Down

1 comment on commit 94481a1

@JDPKSP
Copy link
Contributor

@JDPKSP JDPKSP commented on 94481a1 Jan 14, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Damn. I actually liked the feature of having access to the flight computer of another vessel. It can be somewhat of a help in docking. Also: Formation flying 😄

Please sign in to comment.