Skip to content

Commit

Permalink
Ensure craft vessel has a valid orbit
Browse files Browse the repository at this point in the history
This is in the build cost calculation only, but does take care of the
vessel being ripped out from underneath EL while calculating the cost
due to ObT being nan. It looks like this is the same cause for the
breakdown when actually building a survey stake, but that might be a
little trickier to sort out.
  • Loading branch information
taniwha committed Jan 17, 2022
1 parent 33485a2 commit e2e4ed1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Source/BuildControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1158,6 +1158,10 @@ public CostReport getBuildCost (ConfigNode craft, string craftText = null)
lockedParts = true;
}
GameObject ro = ship.parts[0].localRoot.gameObject;
var od = ro.GetComponent<OrbitDriver> () ?? ro.AddComponent<OrbitDriver> ();
od.orbit = new Orbit(builder.vessel.orbit);

EL_Utils.dumpxform (ro.transform, true);
Vessel craftVessel = ro.AddComponent<Vessel>();
craftVessel.vesselName = "EL craftVessel - " + craft.GetValue ("ship");
craftVessel.Initialize (true);
Expand Down

0 comments on commit e2e4ed1

Please sign in to comment.