Jump to content

How to get ship and ship Delta-V in VAB/SPH?


Recommended Posts

(new member)

I've been tearing my hair out over this for the past 2-3 days. I'm currently making a simple mod that calculates if a flight is possible given current delta-v's. However, I cannot figure out how to get the delta-v's of a ship in an editor, nor able to even get any sign of a ship being detected.

think it has to do with ShipConstruct, but I can't figure out how to get current vessel as a Ship. It could also be Vessel that handles editor, but I found nothing suggesting that to be the case. I've skimmed through the class index on the API site, and found nothing.

Does anyone know about this? I'm very new to C# modding.

Edited by Hyperion_21
More information about attempted solutions
Link to comment
Share on other sites

  • 2 weeks later...

Subscribe to the DeltaVCalcsCompleted event to be notified every time the user changes the ship:

GameEvents.onDeltaVCalcsCompleted.Add(OnDeltaVCalcsCompleted);

In that event's handler, you can get the complete delta V analysis from EditorLogic.fetch?.ship?.vesselDeltaV:

https://kerbalspaceprogram.com/api/class_vessel_delta_v.html

Quote
 
double  TotalDeltaVActual [get]
  The Total Simulated DeltaV produced by the Vessel/Ship in flight. More...
 
double  TotalDeltaVASL [get]
  The Total Simulated DeltaV produced by the Vessel/Ship at ASL More...
 
double  TotalDeltaVVac [get]
  The Total Simulated DeltaV produced by the Vessel/Ship in Vacuum More...

Sample code here:

https://github.com/HebaruSan/SmartTank/blob/master/src/SmartTank.cs

Edited by HebaruSan
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...