Jump to content

Is there a programmatic way to "Recover Vessel"?


Recommended Posts

I know I can chase down the GUI component in the Altimeter widget in EVA, and maybe force that button to press itself, but I haven't figured out what the method is I'd call directly to request "Recover this vessel".  The Vessel class has a boolean I can query to see if it's recoverable, but is there a method anyone's found to trigger the recovery sequence (specifically, I want to find a method I can call while the player is in Flight, and in IVA)?

Link to comment
Share on other sites

On 5/26/2016 at 9:05 PM, Aelfhe1m said:

Haven't tried it but I did come across ShipConstruction.RecoverVesselFromFlight() the other day while I was poking around looking for something completely different.

I finally got around to trying this.  Unfortunately, all it does it put up the recovery dialog that you get after the craft is recovered (the dialog that shows crew, science, etc).  It doesn't actually trigger the recovery of the vessel.  Guess I need to keep rooting around.

Link to comment
Share on other sites

Some more poking around...  I can trigger a state change from Flight to the Spacecenter.  If I then call ShipConstruction.RecoverVesselFromFlight, in the message log I see a message that says something like "Can't recover vessel because it's the active vessel."  So I need to find a way to make it not active.  Calling FlightGlobals.SetActiveVessel(null) triggers an exception, so that's not the right way.

Link to comment
Share on other sites

31 minutes ago, xEvilReeperx said:

Looks like all you need to do is fire GameEvents.OnVesselRecoveryRequested, no need to switch scenes as it's already handled

Well, that's way too easy.  Looks like I'm going to learn something about Unity despite myself.

Thank you.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...