Skip to content

Commit

Permalink
fixed settings loading issues
Browse files Browse the repository at this point in the history
  • Loading branch information
neuoy committed Oct 14, 2014
1 parent 7babe3c commit 1a8830d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Plugin/DescentProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public void Reset(float AoA = 0)

public void Update()
{
if (attachedVessel != FlightGlobals.ActiveVessel)
if (HighLogic.LoadedScene == GameScenes.FLIGHT && attachedVessel != FlightGlobals.ActiveVessel)
{
//Debug.Log("Loading vessel descent profile");
attachedVessel = FlightGlobals.ActiveVessel;
Expand Down
26 changes: 13 additions & 13 deletions Plugin/Trajectory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,23 +143,23 @@ public void Start()

public void Update()
{
if (HighLogic.LoadedScene == GameScenes.FLIGHT && FlightGlobals.ActiveVessel != null && FlightGlobals.ActiveVessel.Parts.Count != 0 && (MapView.MapIsEnabled || targetPosition_.HasValue))
if (HighLogic.LoadedScene == GameScenes.FLIGHT && vessel_ != FlightGlobals.ActiveVessel)
{
if (vessel_ != FlightGlobals.ActiveVessel)
{
TrajectoriesVesselSettings module = FlightGlobals.ActiveVessel == null ? null : FlightGlobals.ActiveVessel.Parts.SelectMany(p => p.Modules.OfType<TrajectoriesVesselSettings>()).FirstOrDefault();
CelestialBody body = module == null ? null : FlightGlobals.Bodies.FirstOrDefault(b => b.name == module.targetReferenceBody);
TrajectoriesVesselSettings module = FlightGlobals.ActiveVessel == null ? null : FlightGlobals.ActiveVessel.Parts.SelectMany(p => p.Modules.OfType<TrajectoriesVesselSettings>()).FirstOrDefault();
CelestialBody body = module == null ? null : FlightGlobals.Bodies.FirstOrDefault(b => b.name == module.targetReferenceBody);

if (body == null || !module.hasTarget)
{
SetTarget();
}
else
{
SetTarget(body, body.transform.TransformDirection(module.targetLocation));
}
if (body == null || !module.hasTarget)
{
SetTarget();
}
else
{
SetTarget(body, body.transform.TransformDirection(module.targetLocation));
}
}

if (HighLogic.LoadedScene == GameScenes.FLIGHT && FlightGlobals.ActiveVessel != null && FlightGlobals.ActiveVessel.Parts.Count != 0 && (MapView.MapIsEnabled || targetPosition_.HasValue))
{
ComputeTrajectory(FlightGlobals.ActiveVessel, DescentProfile.fetch);
}
}
Expand Down

0 comments on commit 1a8830d

Please sign in to comment.